Commit 5e48de4d authored by nanahira's avatar nanahira

Merge branch 'v3-refactor3' into v3.1-refresh-ygopro

parents 4966752b 5b96a05c
...@@ -4,6 +4,7 @@ import ini from 'ini'; ...@@ -4,6 +4,7 @@ import ini from 'ini';
import fs from 'fs'; import fs from 'fs';
import child_process from 'child_process'; import child_process from 'child_process';
import Mustache from 'mustache'; import Mustache from 'mustache';
import _ from 'lodash-es';
export enum Category { export enum Category {
game, game,
...@@ -68,7 +69,9 @@ export class AppStatus { ...@@ -68,7 +69,9 @@ export class AppStatus {
export interface YGOProDistroData { export interface YGOProDistroData {
deckPath: string; deckPath: string;
replayPath: string; replayPath: string;
systemConf: string; systemConf?: string;
lastDeckFormat?: string;
lastCategoryFormat?: string;
} }
export class App { export class App {
...@@ -366,24 +369,24 @@ export class App { ...@@ -366,24 +369,24 @@ export class App {
return this.data.ygopro || undefined; return this.data.ygopro || undefined;
} }
get ygoproDeckPath(): string | undefined { ygoproDeckPath(_distroData: YGOProDistroData): string | undefined {
const distroData = this.ygoproDistroData; const distroData = _distroData || this.ygoproDistroData;
if (!distroData) { if (!distroData) {
return; return;
} }
return path.join(this.local!.path, distroData.deckPath); return path.join(this.local!.path, distroData.deckPath);
} }
get ygoproReplayPath(): string | undefined { ygoproReplayPath(_distroData: YGOProDistroData): string | undefined {
const distroData = this.ygoproDistroData; const distroData = _distroData || this.ygoproDistroData;
if (!distroData || !distroData.replayPath) { if (!distroData || !distroData.replayPath) {
return; return;
} }
return path.join(this.local!.path, distroData.replayPath); return path.join(this.local!.path, distroData.replayPath);
} }
get systemConfPath(): string | undefined { systemConfPath(_distroData: YGOProDistroData): string | undefined {
const distroData = this.ygoproDistroData; const distroData = _distroData || this.ygoproDistroData;
if (!distroData || !distroData.systemConf) { if (!distroData || !distroData.systemConf) {
return; return;
} }
......
...@@ -26,17 +26,14 @@ ...@@ -26,17 +26,14 @@
</div> </div>
<div class="col-sm-8 input-group input-group-sm"> <div class="col-sm-8 input-group input-group-sm">
<label i18n class="input-group-text" id="basic-addon1">卡组</label> <label i18n class="input-group-text" id="basic-addon1">卡组</label>
<select class="form-select form-select-sm" id="exampleSelect1" name="deck" [(ngModel)]="current_deck"> <select class="form-select form-select-sm" id="exampleSelect1" name="deck" [(ngModel)]="currentDeckSymbol" (change)="onDeckChange()">
<option *ngFor="let deck of decks_grouped['.']" [value]="deck">{{deck}}</option> <optgroup *ngFor="let group of decks_grouped" [label]="group[0] === '.' ? '未分类卡组' : group[0]">
<ng-container *ngFor="let group of decks_grouped | keyvalue"> <option *ngFor="let deck of group[1]" [value]="deck.symbol">{{deck.deck}}</option>
<optgroup *ngIf="group.key !== '.'" [label]='group.key'> </optgroup>
<option *ngFor="let deck of group.value" [value]="group.key + '/' + deck">{{deck}}</option>
</optgroup>
</ng-container>
</select> </select>
<span class="input-group-btn"> <span class="input-group-btn">
<button id="edit_deck_button" i18n [disabled]="!appsService.allReady(app)" class="btn btn-secondary btn-sm" (click)="edit_deck(current_deck)">编辑</button> <button id="edit_deck_button" i18n [disabled]="!appsService.allReady(app)" class="btn btn-secondary btn-sm" (click)="edit_deck()">编辑</button>
</span> </span>
</div> </div>
</div> </div>
...@@ -124,10 +121,10 @@ ...@@ -124,10 +121,10 @@
<small i18n class="form-text text-muted">最多 12 个字</small> <small i18n class="form-text text-muted">最多 12 个字</small>
</ng-container> </ng-container>
<ng-template #private> <ng-template #private>
<label *ngIf="room.private" for="game-create-title"><i class="fa fa-key" aria-hidden="true"></i> <label *ngIf="room.private" for="game-create-password"><i class="fa fa-key" aria-hidden="true"></i>
<span i18n>房间密码</span></label> <span i18n>房间密码</span></label>
<div class="input-group input-group-sm"> <div class="input-group input-group-sm">
<input type="text" maxlength="12" class="form-control" id="game-create-title" name="title" [(ngModel)]="host_password" readonly> <input type="text" maxlength="12" class="form-control" id="game-create-password" name="title" [(ngModel)]="host_password" readonly>
<span i18n-title id="copy-wrapper" class="input-group-btn" data-bs-toggle="tooltip" title="房间密码已复制到剪贴板"> <span i18n-title id="copy-wrapper" class="input-group-btn" data-bs-toggle="tooltip" title="房间密码已复制到剪贴板">
<button i18n-title class="btn btn-secondary fa fa-clipboard" type="button" title="复制" (click)="copy(host_password, $event)"></button> <button i18n-title class="btn btn-secondary fa fa-clipboard" type="button" title="复制" (click)="copy(host_password, $event)"></button>
</span> </span>
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment