Skip to content

Commit 0fef65d

Browse files
committed
[chusan] Filter play records by fumen
1 parent 87b5418 commit 0fef65d

File tree

8 files changed

+155
-36
lines changed

8 files changed

+155
-36
lines changed

src/app/sega/chunithm/v2/v2-recent/v2-recent.component.css

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,3 +212,42 @@
212212
font-size: 0.8em;
213213
}
214214
}
215+
216+
.filter-text {
217+
font-size: 12px;
218+
}
219+
220+
.difficulty-basic {
221+
background: #00ab84;
222+
border: 1px solid #145830;
223+
color: white;
224+
}
225+
226+
.difficulty-advanced {
227+
background: #ff7e00;
228+
border: 1px solid #995014;
229+
color: white;
230+
}
231+
232+
.difficulty-expert {
233+
background: #f12929;
234+
border: 1px solid #7B1F18;
235+
color: white;
236+
}
237+
238+
.difficulty-master {
239+
background: #8e1be5;
240+
border: 1px solid #381C47;
241+
color: white;
242+
}
243+
244+
.difficulty-ultima {
245+
background: #424242;
246+
border: 1px solid #ff2854;
247+
color: white;
248+
}
249+
250+
.difficulty-we {
251+
background: #343636;
252+
border: 1px solid var(--bs-secondary);
253+
}

src/app/sega/chunithm/v2/v2-recent/v2-recent.component.html

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<h1 class="page-heading">{{"ChuniV2.RecentPage.Title" | translate}}</h1>
1+
<h1 class="page-heading">{{ "ChuniV2.RecentPage.Title" | translate }}</h1>
22

33
<ng-template #pagination>
44
<pagination-template *ngIf="!loading" #p="paginationApi" class="user-select-none" id="server" maxSize="7"
@@ -20,11 +20,32 @@ <h1 class="page-heading">{{"ChuniV2.RecentPage.Title" | translate}}</h1>
2020
</pagination-template>
2121
</ng-template>
2222

23+
<ng-container *ngIf="musicName">
24+
<div class="d-flex align-items-center gap-2 mb-2">
25+
<ng-container [ngSwitch]="level">
26+
<span *ngSwitchCase="0" class="col-auto filter-text difficulty-basic badge rounded-pill">Basic</span>
27+
<span *ngSwitchCase="1" class="col-auto filter-text difficulty-advanced badge rounded-pill">Advanced</span>
28+
<span *ngSwitchCase="2" class="col-auto filter-text difficulty-expert badge rounded-pill">Expert</span>
29+
<span *ngSwitchCase="3" class="col-auto filter-text difficulty-master badge rounded-pill">Master</span>
30+
<span *ngSwitchCase="4" class="col-auto filter-text difficulty-ultima badge rounded-pill">Ultima</span>
31+
<span *ngSwitchCase="5" class="col-auto filter-text difficulty-we badge rounded-pill">
32+
<span class="color-we">World's End</span>
33+
</span>
34+
</ng-container>
35+
<span>{{musicName}}</span>
36+
</div>
37+
</ng-container>
38+
39+
<div class="d-flex align-items-center gap-2 mb-3">
40+
<span>{{'ChuniV2.RecentPage.TotalPlayLogNum' | translate: {num: totalElements} }}</span>
41+
<a *ngIf="musicName" class="link-btn" [routerLink]="[]" [queryParams]="{}">{{ "ChuniV2.RecentPage.ResetFilter" | translate }}</a>
42+
</div>
43+
2344
<ng-container *ngTemplateOutlet="pagination;"></ng-container>
2445

2546
<div *ngIf="recent" class="d-flex flex-column gap-2 my-3 this-page">
2647
<div class="card"
27-
*ngFor="let item of recent | async | paginate: { id: 'server', itemsPerPage: 10, currentPage: currentPage, totalItems: totalElements }">
48+
*ngFor="let item of recent | async | paginate: { id: 'server', itemsPerPage: 10, currentPage: currentPage, totalItems: totalElements }">
2849
<div class="card-header p-0">
2950
<div class="position-relative">
3051
<div class="d-flex rounded-top g-0 flex-nowrap">
@@ -33,16 +54,16 @@ <h1 class="page-heading">{{"ChuniV2.RecentPage.Title" | translate}}</h1>
3354
</div>
3455
<div class="flex-grow-1 overflow-hidden">
3556
<div class="info-container">
36-
<div class="ps-2 py-1 user-select-none difficulty-{{item.level}}" >
37-
<div class="track"><span [class.color-we]="item.level==5">Track.{{item.track}}</span></div>
38-
<div class="difficulty"><span [class.color-we]="item.level==5">{{difficulty[item.level]}}</span></div>
57+
<div class="ps-2 py-1 user-select-none difficulty-{{item.level}}">
58+
<div class="track"><span [class.color-we]="item.level==5">Track.{{ item.track }}</span></div>
59+
<div class="difficulty"><span [class.color-we]="item.level==5">{{ difficulty[item.level] }}</span></div>
3960
<!-- <div>{{item.songInfo.levels[item.level] | toLevelString}}</div>-->
4061
</div>
4162
<div class="info-second">
4263
<div class="w-100">
43-
<div class="title ps-2">{{item.songInfo?.name ?? 'musicId:' + item.musicId }}</div>
64+
<div class="title ps-2">{{ item.songInfo?.name ?? 'musicId:' + item.musicId }}</div>
4465
<hr class="w-100 my-1">
45-
<div class="artist ps-2">{{item.songInfo?.artistName??'Unknown Artist' }}</div>
66+
<div class="artist ps-2">{{ item.songInfo?.artistName ?? 'Unknown Artist' }}</div>
4667
</div>
4768
</div>
4869
</div>
@@ -99,16 +120,20 @@ <h1 class="page-heading">{{"ChuniV2.RecentPage.Title" | translate}}</h1>
99120
<div class="h-100 d-flex align-items-center">
100121
<div>
101122
<div>
102-
<div class="new-record-badge rounded-pill badge" [class.new-record]="item.isNewRecord">NEW RECORD</div>
123+
<div class="new-record-badge rounded-pill badge" [class.new-record]="item.isNewRecord">NEW RECORD
124+
</div>
103125
<div class="score-label">Score</div>
104126
<div class="score">{{ item.score }}</div>
105127
</div>
106128
<div *ngIf="item.songInfo?.levels[item.level]">
107129
<div class="score-label">Rating</div>
108-
<div class="rating">{{ ((item.score | toTechRating: (item.songInfo.levels[item.level].level * 100 + item.songInfo.levels[item.level].levelDecimal)) / 100).toFixed(2).toString() }}</div>
130+
<div
131+
class="rating">{{ ((item.score | toTechRating: (item.songInfo.levels[item.level].level * 100 + item.songInfo.levels[item.level].levelDecimal)) / 100).toFixed(2).toString() }}
132+
</div>
109133
</div>
110134
<div>
111-
<img class="honor" [class.grayscale]="!item.isFullCombo" src="{{host}}assets/chuni/gameUi/CHU_UI_Result_{{getFcLevel(item)}}.webp">
135+
<img class="honor" [class.grayscale]="!item.isFullCombo"
136+
src="{{host}}assets/chuni/gameUi/CHU_UI_Result_{{getFcLevel(item)}}.webp">
112137
</div>
113138
</div>
114139
</div>
@@ -118,23 +143,26 @@ <h1 class="page-heading">{{"ChuniV2.RecentPage.Title" | translate}}</h1>
118143
<div class="d-flex flex-nowrap align-items-start">
119144
<ng-container *ngFor="let char of (item.rank | toRank).split('')">
120145
<ng-container [ngSwitch]="char">
121-
<img *ngSwitchCase="'+'" class="result-plus" src="{{host}}assets/chuni/gameUi/CHU_UI_Result_Plus.webp">
122-
<img *ngSwitchDefault class="result-char" src="{{host}}assets/chuni/gameUi/CHU_UI_Result_{{char}}.webp">
146+
<img *ngSwitchCase="'+'" class="result-plus"
147+
src="{{host}}assets/chuni/gameUi/CHU_UI_Result_Plus.webp">
148+
<img *ngSwitchDefault class="result-char"
149+
src="{{host}}assets/chuni/gameUi/CHU_UI_Result_{{char}}.webp">
123150
</ng-container>
124151
</ng-container>
125152
</div>
126153
</div>
127154
</div>
128155
</div>
129-
</div>
130156
</div>
157+
</div>
131158
</div>
132159
<div class="card-footer fw-bold">
133160
<div *ngIf="item.songInfo" class="float-start">
134-
<a type="button" class="text-primary" (click)="showDetail(item.songInfo)">{{"ChuniV2.RecentPage.Ranking" | translate}}</a>
161+
<a type="button" class="text-primary"
162+
(click)="showDetail(item.songInfo)">{{ "ChuniV2.RecentPage.Details" | translate }}</a>
135163
</div>
136164
<div class="float-end">
137-
{{item.userPlayDate.toLocaleString()}}
165+
{{ item.userPlayDate.toLocaleString() }}
138166
</div>
139167
</div>
140168
</div>

src/app/sega/chunithm/v2/v2-recent/v2-recent.component.ts

Lines changed: 51 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ import {NgxIndexedDBService} from 'ngx-indexed-db';
88
import {ChusanMusic, Difficulty} from '../model/ChusanMusic';
99
import {environment} from '../../../../../environments/environment';
1010
import {map, tap} from 'rxjs/operators';
11-
import {Observable} from 'rxjs';
11+
import {lastValueFrom, Observable} from 'rxjs';
1212
import {NgbOffcanvas} from '@ng-bootstrap/ng-bootstrap';
1313
import {V2SongScoreRankingComponent} from '../v2-song-score-ranking/v2-song-score-ranking.component';
14-
import { UserService } from 'src/app/user.service';
14+
import {UserService} from 'src/app/user.service';
1515
import {ActivatedRoute, Router} from '@angular/router';
16+
import {load} from '@angular-devkit/build-angular/src/utils/server-rendering/esm-in-memory-file-loader';
1617

1718
@Component({
1819
selector: 'app-v2-recent',
@@ -25,6 +26,9 @@ export class V2RecentComponent implements OnInit {
2526
enableImages = environment.enableImages;
2627
loading: boolean;
2728
aimeId: string;
29+
id: number;
30+
musicName: string;
31+
level: number;
2832

2933
recent: Observable<V2PlayLog[]>;
3034
difficulty = Difficulty;
@@ -48,15 +52,36 @@ export class V2RecentComponent implements OnInit {
4852
this.loading = true;
4953
this.route.queryParams.subscribe((data) => {
5054
if (data.page) {
51-
this.currentPage = data.page;
55+
this.currentPage = Number(data.page);
56+
} else {
57+
this.currentPage = 1;
58+
}
59+
if (data.id && data.level) {
60+
this.id = Number(data.id);
61+
this.getMusicName(this.id);
62+
this.level = Number(data.level);
63+
if (this.level > 5){
64+
this.router.navigate(['chuni/v2/recent'], {queryParams: {}});
65+
}
66+
} else {
67+
this.id = null;
68+
this.musicName = null;
69+
this.level = null;
5270
}
5371
this.load(this.currentPage);
5472
});
5573
}
5674

5775
load(page: number) {
5876
const param = new HttpParams().set('aimeId', this.aimeId).set('page', String(page - 1));
59-
this.recent = this.api.get('api/game/chuni/v2/recent', param).pipe(
77+
78+
let api;
79+
if (this.id && this.level) {
80+
api = `api/game/chuni/v2/song/${this.id}/${this.level}`;
81+
} else {
82+
api = 'api/game/chuni/v2/recent';
83+
}
84+
this.recent = this.api.get(api, param).pipe(
6085
tap(
6186
data => {
6287
this.totalElements = data.totalElements;
@@ -88,21 +113,34 @@ export class V2RecentComponent implements OnInit {
88113
}
89114

90115
pageChanged(page: number) {
91-
this.router.navigate(['chuni/v2/recent'], {queryParams: {page}});
116+
this.router.navigate(['chuni/v2/recent'], {queryParams: {page, id: this.id, level: this.level}});
92117
}
93118

94-
getFcLevel(item: V2PlayLog){
95-
if (item.score === 1010000){
119+
getFcLevel(item: V2PlayLog) {
120+
if (item.score === 1010000) {
96121
return 'AJC';
97-
}
98-
else if (item.isAllJustice){
122+
} else if (item.isAllJustice) {
99123
return 'AJ';
100-
}
101-
else if (item.isFullCombo){
124+
} else if (item.isFullCombo) {
102125
return 'FC';
103-
}
104-
else{
126+
} else {
105127
return 'FC_Base';
106128
}
107129
}
130+
131+
getMusicName(id: number) {
132+
this.dbService.getByID<ChusanMusic>('chusanMusic', id).subscribe({
133+
next: (data) => {
134+
if (data) {
135+
this.musicName = data.name;
136+
}
137+
else {
138+
this.musicName = `ID: ${id}`;
139+
}
140+
},
141+
error: error => {
142+
this.musicName = `ID: ${id}`;
143+
}
144+
});
145+
}
108146
}

src/app/sega/chunithm/v2/v2-song-score-ranking/v2-song-score-ranking.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ <h5 class="card-title mb-1 fw-bold">「{{music.name}}」</h5>
1515
</div>
1616
<section *ngIf="songData">
1717
<ng-template #difficultyDetail let-difficulty>
18-
<div class="card my-2">
18+
<div class="card my-2" [class.card-btn]="songData[difficulty]" (click)="showPlayLog(music.musicId, difficulty)">
1919
<ng-container [ngSwitch]="difficulty">
2020
<div *ngSwitchCase="0" class="card-header py-1 px-2 text-truncate">
2121
<div class="hstack">

src/app/sega/chunithm/v2/v2-song-score-ranking/v2-song-score-ranking.component.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {MessageService} from '../../../../message.service';
77
import {NgbOffcanvas} from '@ng-bootstrap/ng-bootstrap';
88
import {HttpParams} from '@angular/common/http';
99
import { UserService } from 'src/app/user.service';
10+
import {Router} from '@angular/router';
1011

1112
interface ISongData {
1213
musicId: number;
@@ -54,6 +55,7 @@ export class V2SongScoreRankingComponent {
5455

5556
constructor(
5657
private api: ApiService,
58+
private router: Router,
5759
private userService: UserService,
5860
public messageService: MessageService,
5961
public offcanvasService: NgbOffcanvas,
@@ -75,12 +77,12 @@ export class V2SongScoreRankingComponent {
7577
}
7678
);
7779
const param = new HttpParams().set('musicId', musicId).set('level', 3);
78-
this.api.get("api/game/chuni/v2/musicScoreRanking", param).subscribe((res) => {
80+
this.api.get('api/game/chuni/v2/musicScoreRanking', param).subscribe((res) => {
7981
if (res.length > 0) {
8082
this.ranking = res;
8183
} else {
82-
const param = new HttpParams().set("musicId", musicId).set("level", 5);
83-
this.api.get("api/game/chuni/v2/musicScoreRanking", param).subscribe((res) => {
84+
const param = new HttpParams().set('musicId', musicId).set('level', 5);
85+
this.api.get('api/game/chuni/v2/musicScoreRanking', param).subscribe((res) => {
8486
this.ranking = res;
8587
});
8688
}
@@ -102,4 +104,10 @@ export class V2SongScoreRankingComponent {
102104
return `${level.level}.${level.levelDecimal.toString().charAt(0)}` ?? '0';
103105
}
104106

107+
showPlayLog(id: number, level: any) {
108+
if (this.songData[level]){
109+
this.offcanvasService.dismiss();
110+
this.router.navigate(['chuni/v2/recent'], {queryParams: {id, level}});
111+
}
112+
}
105113
}

src/app/sega/chunithm/v2/v2-songlist/v2-songlist.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ <h1 class="page-heading">{{ "ChuniV2.MusicListPage.Title" | translate }}</h1>
3232
</div>
3333
</div>
3434
<div class="row mb-2 g-1">
35-
<div class="col-12 col-sm-auto pt-1 me-3">分类</div>
35+
<div class="col-12 col-sm-auto pt-1 me-3">{{'ChuniV2.MusicListPage.Genre' | translate}}</div>
3636
<div class="col-12 col-sm">
3737
<div class="row justify-content-start align-items-center g-1">
3838
<div *ngFor="let genre of genres; let i = index" class="col-auto">

src/assets/i18n/en.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@
402402
"Unacquired": "Unacquired",
403403
"Version": "Version",
404404
"SearchPlaceholder": "ID,Name,Illustrator,WorkName",
405-
"TotalCharaNum": "Total {{num}} characters",
405+
"TotalCharaNum": "Total {{num}} Characters",
406406
"ShowFilter": "Show Filter",
407407
"HideFilter": "Hide Filter",
408408
"ResetFilter": "Reset Filter",
@@ -448,6 +448,7 @@
448448
"MusicListPage": {
449449
"Title": "Music List",
450450
"ReleaseVersion": "Release Version",
451+
"Genre": "Genre",
451452
"TotalSongNum": "Total {{num}} Songs",
452453
"ShowFilter": "Show Filter",
453454
"HideFilter": "Hide Filter",
@@ -489,7 +490,9 @@
489490
},
490491
"RecentPage": {
491492
"Title": "Play Record",
492-
"Ranking": "Ranking"
493+
"Details": "Details",
494+
"TotalPlayLogNum": "Total {{num}} Play Records",
495+
"ResetFilter": "Reset Filter"
493496
},
494497
"SettingsPage": {
495498
"Title": "Settings",

src/assets/i18n/zh.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,7 @@
448448
"MusicListPage": {
449449
"Title": "乐曲列表",
450450
"ReleaseVersion": "发布版本",
451+
"Genre": "分类",
451452
"TotalSongNum": "共 {{num}} 首乐曲",
452453
"ShowFilter": "显示过滤",
453454
"HideFilter": "隐藏过滤",
@@ -489,7 +490,9 @@
489490
},
490491
"RecentPage": {
491492
"Title": "游玩记录",
492-
"Ranking": "排名"
493+
"Details": "详情",
494+
"TotalPlayLogNum": "共 {{num}} 条游玩记录",
495+
"ResetFilter": "重置过滤"
493496
},
494497
"SettingsPage": {
495498
"Title": "设定",

0 commit comments

Comments
 (0)