Commit 4abe323c authored by 神楽坂玲奈's avatar 神楽坂玲奈

Revert "update dependencies"

This reverts commit cd8508f4.
parent a6a5a285
This diff is collapsed.
......@@ -4,41 +4,41 @@
"license": "UNLISENCED",
"scripts": {
"ng": "ng",
"start": "ng serve --base-href /mobile/ --deploy-url /mobile/ --locale zh-CN --output-path mobile --open",
"start": "ng serve --base-href /mobile/ --deploy-url /mobile --locale zh-CN --output-path mobile --open",
"build": "ng build --base-href /mobile/ --locale zh-CN --aot --build-optimizer --extract-css --prod",
"build:dev": "ng build --base-href /mobile2/ --locale zh-CN --aot --build-optimizer --extract-css",
"lint": "ng lint --type-check --fix"
},
"dependencies": {
"@angular/animations": "5.2.10",
"@angular/cdk": "^5.2.5",
"@angular/common": "5.2.10",
"@angular/compiler": "5.2.10",
"@angular/core": "5.2.10",
"@angular/forms": "5.2.10",
"@angular/http": "5.2.10",
"@angular/material": "^5.2.5",
"@angular/platform-browser": "5.2.10",
"@angular/platform-browser-dynamic": "5.2.10",
"@angular/router": "5.2.10",
"core-js": "^2.5.5",
"@angular/animations": "^4.3.6",
"@angular/cdk": "^2.0.0-beta.8",
"@angular/common": "^4.3.6",
"@angular/compiler": "^4.3.6",
"@angular/core": "^4.3.6",
"@angular/forms": "^4.3.6",
"@angular/http": "^4.3.6",
"@angular/material": "^2.0.0-beta.8",
"@angular/platform-browser": "^4.3.6",
"@angular/platform-browser-dynamic": "^4.3.6",
"@angular/router": "^4.3.6",
"core-js": "^2.5.0",
"font-awesome": "^4.7.0",
"hammerjs": "^2.0.8",
"lodash": "^4.17.10",
"lodash": "^4.17.4",
"material-design-icons": "^3.0.1",
"rxjs": "^5.5.10",
"webdav": "^1.5.2",
"zone.js": "^0.8.26"
"rxjs": "^5.4.3",
"webdav": "https://github.com/moecube/webdav-client/releases/download/v1.0.1/webdav-1.0.1.tgz",
"zone.js": "^0.8.17"
},
"devDependencies": {
"@angular/cli": "1.7.4",
"@angular/compiler-cli": "5.2.10",
"@angular/language-service": "5.2.10",
"@angular/service-worker": "5.2.10",
"@types/lodash": "^4.14.108",
"@types/node": "^9.6.6",
"codelyzer": "^4.3.0",
"tslint": "^5.9.1",
"typescript": "2.6.2"
"@angular/cli": "^1.3.2",
"@angular/compiler-cli": "^4.3.6",
"@angular/language-service": "^4.3.6",
"@angular/service-worker": "^1.0.0-beta.16",
"@types/lodash": "^4.14.74",
"@types/node": "^8.0.25",
"codelyzer": "~3.1.1",
"tslint": "^5.6.0",
"typescript": "~2.3.3"
}
}
module.exports = {
printWidth: 140,
singleQuote: true
};
import { CdkTableModule } from '@angular/cdk';
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpModule, JsonpModule } from '@angular/http';
import {
MatAutocompleteModule,
MatButtonModule,
MatCardModule,
MatCheckboxModule,
MatDialogModule,
MatGridListModule,
MatIconModule,
MatInputModule,
MatListModule,
MatMenuModule,
MatProgressSpinnerModule,
MatSelectModule,
MatSlideToggleModule,
MatSnackBarModule,
MatTableModule,
MatToolbarModule
MdAutocompleteModule,
MdButtonModule,
MdCardModule,
MdCheckboxModule,
MdDialogModule,
MdGridListModule,
MdIconModule,
MdInputModule,
MdListModule,
MdMenuModule,
MdProgressSpinnerModule,
MdSelectModule,
MdSlideToggleModule,
MdSnackBarModule,
MdTableModule,
MdToolbarModule
} from '@angular/material';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
......@@ -55,27 +56,29 @@ import { YGOProService } from './ygopro.service';
HttpModule,
AppRoutingModule,
BrowserAnimationsModule,
MatInputModule,
MatSelectModule,
MatCheckboxModule,
MatButtonModule,
MatSlideToggleModule,
MatCardModule,
MatGridListModule,
MatIconModule,
MatTableModule,
MatListModule,
MatDialogModule,
MatToolbarModule,
MatSnackBarModule,
MatAutocompleteModule,
MdInputModule,
MdSelectModule,
MdCheckboxModule,
MdButtonModule,
MdSlideToggleModule,
MdCardModule,
MdGridListModule,
MdIconModule,
MdTableModule,
CdkTableModule,
MdListModule,
MdDialogModule,
MdToolbarModule,
MdSnackBarModule,
MdAutocompleteModule,
ReactiveFormsModule,
JsonpModule,
MatMenuModule,
MatProgressSpinnerModule
MdMenuModule,
MdProgressSpinnerModule
],
providers: [YGOProService, StorageService],
bootstrap: [AppComponent],
entryComponents: [MatchDialogComponent, ResultDialogComponent]
})
export class AppModule {}
export class AppModule {
}
......@@ -35,33 +35,33 @@ input::placeholder {
/*color: lightgray;*/
/*}*/
mat-input-container {
md-input-container {
width: 100%;
}
[mat-raised-button] {
[md-raised-button] {
border-radius: 0;
box-shadow: none;
}
[mat-button], [mat-raised-button] {
[md-button], [md-raised-button] {
width: 100%;
height: 100%;
}
a[mat-button], a[mat-raised-button] {
a[md-button], a[md-raised-button] {
display: flex;
align-items: center;
justify-content: center;
}
mat-card-content {
md-card-content {
display: flex;
flex-direction: row;
}
[mat-card-avatar] {
[md-card-avatar] {
width: 128px;
height: 72px;
object-fit: cover;
......
This diff is collapsed.
mat-icon {
md-icon {
width: 96px;
height: 96px;
font-size: 96px;
}
mat-dialog-content {
md-dialog-content {
display: flex;
}
mat-dialog-actions {
md-dialog-actions {
justify-content: flex-end
}
ul {
......
<h2 mat-dialog-title *ngIf="arena == 'athletic'">竞技匹配</h2>
<h2 mat-dialog-title *ngIf="arena == 'entertain'">娱乐匹配</h2>
<h2 md-dialog-title *ngIf="arena == 'athletic'">竞技匹配</h2>
<h2 md-dialog-title *ngIf="arena == 'entertain'">娱乐匹配</h2>
<mat-dialog-content>
<mat-icon *ngIf="arena == 'athletic'" fontSet="fa" fontIcon="fa-futbol-o" class="fa-spin"></mat-icon>
<mat-icon *ngIf="arena == 'entertain'" class="fa-spin">toys</mat-icon>
<md-dialog-content>
<md-icon *ngIf="arena == 'athletic'" fontSet="fa" fontIcon="fa-futbol-o" class="fa-spin"></md-icon>
<md-icon *ngIf="arena == 'entertain'" class="fa-spin">toys</md-icon>
<ul>
<dt>预计等待时间</dt>
<dd>{{expect_wait | async | date: 'mm:ss'}}</dd>
<dt>实际等待时间</dt>
<dd>{{actual_wait | async | date: 'mm:ss'}}</dd>
</ul>
</mat-dialog-content>
<mat-dialog-actions>
<button mat-button mat-dialog-close>取消</button>
</mat-dialog-actions>
</md-dialog-content>
<md-dialog-actions>
<button md-button md-dialog-close>取消</button>
</md-dialog-actions>
import { Component, Inject, OnDestroy, OnInit } from '@angular/core';
import { Headers, Http } from '@angular/http';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
import { MD_DIALOG_DATA, MdDialogRef } from '@angular/material';
import { Observable } from 'rxjs/Observable';
import { Subscription } from 'rxjs/Subscription';
import { LoginService } from '../login.service';
......@@ -14,39 +14,34 @@ const offset = new Date().getTimezoneOffset() * 60 * second;
styleUrls: ['./match.component.css']
})
export class MatchDialogComponent implements OnInit, OnDestroy {
expect_wait = this.http.get('https://api.mycard.moe/ygopro/match/stats/' + this.arena).map(response => response.json() * second + offset);
actual_wait = Observable.timer(0, second).map(timestamp => timestamp * second + offset);
matching: Subscription;
constructor(
@Inject(MAT_DIALOG_DATA) public arena: string,
private dialogRef: MatDialogRef<MatchDialogComponent>,
private http: Http,
private login: LoginService
) {}
constructor(@Inject(MD_DIALOG_DATA) public arena: string,
private dialogRef: MdDialogRef<MatchDialogComponent>,
private http: Http,
private login: LoginService) {
}
ngOnInit() {
this.matching = this.http
.post('https://api.mycard.moe/ygopro/match', null, {
headers: new Headers({
Authorization: 'Basic ' + Buffer.from(this.login.user.username + ':' + this.login.user.external_id).toString('base64')
}),
params: { arena: this.arena, locale: 'zh-CN' }
})
.map(response => response.json())
.subscribe(
data => {
this.dialogRef.close(data);
},
error => {
alert(`匹配失败`);
this.dialogRef.close();
}
);
this.matching = this.http.post('https://api.mycard.moe/ygopro/match', null, {
headers: new Headers({
Authorization: 'Basic ' + Buffer.from(this.login.user.username + ':' + this.login.user.external_id).toString('base64')
}),
params: {arena: this.arena, locale: 'zh-CN'}
}).map(response => response.json()).subscribe((data) => {
this.dialogRef.close(data);
}, (error) => {
alert(`匹配失败`);
this.dialogRef.close();
});
}
ngOnDestroy() {
this.matching.unsubscribe();
}
}
......@@ -11,7 +11,7 @@ form {
/*margin: 0 10px;*/
/*}*/
mat-select {
md-select {
padding: 1.2734375em 0;
}
......
<app-toolbar>创建房间</app-toolbar>
<form (submit)="ygopro.create_room(room, host_password)" ngNativeValidate>
<mat-input-container *ngIf="!room.private" class="full-width">
<input matInput placeholder="游戏标题" name="title" [(ngModel)]="room.title" minlength="1" maxlength="12" required>
<mat-hint align="end">{{room.title?.length || 0}} / 12</mat-hint>
</mat-input-container>
<mat-input-container *ngIf="room.private" class="full-width">
<mat-placeholder>
<mat-icon>&#xe0da;</mat-icon><!-- vpn_key -->
<md-input-container *ngIf="!room.private" class="full-width">
<input mdInput placeholder="游戏标题" name="title" [(ngModel)]="room.title" minlength="1" maxlength="12" required>
<md-hint align="end">{{room.title?.length || 0}} / 12</md-hint>
</md-input-container>
<md-input-container *ngIf="room.private" class="full-width">
<md-placeholder>
<md-icon>&#xe0da;</md-icon><!-- vpn_key -->
<span>房间密码</span>
</mat-placeholder>
<input #hostPasswordInput matInput name="title" [(ngModel)]="host_password" readonly>
<button type="button" mat-icon-button matSuffix (click)="copy(host_password)">
<mat-icon>&#xe14d;</mat-icon><!-- content_copy -->
</md-placeholder>
<input #hostPasswordInput mdInput name="title" [(ngModel)]="host_password" readonly>
<button type="button" md-icon-button mdSuffix (click)="copy(host_password)">
<md-icon>&#xe14d;</md-icon><!-- content_copy -->
</button>
<button type="button" mat-icon-button matSuffix (click)="share(host_password)">
<mat-icon>share</mat-icon>
<button type="button" md-icon-button mdSuffix (click)="share(host_password)">
<md-icon>share</md-icon>
</button>
<mat-hint align="end">把这个分享给你的朋友</mat-hint>
</mat-input-container>
<mat-select class="full-width" placeholder="卡片允许" name="rule" [(ngModel)]="room.options.rule" required>
<mat-option [value]="0">OCG</mat-option>
<mat-option [value]="1">TCG</mat-option>
<mat-option [value]="2">OCG & TCG</mat-option>
<mat-option [value]="3">专有卡禁止</mat-option>
</mat-select>
<mat-select class="full-width" placeholder="决斗模式" name="mode" [(ngModel)]="room.options.mode" (ngModelChange)="set_start_lp()" required>
<mat-option [value]="0">单局模式</mat-option>
<mat-option [value]="1">比赛模式</mat-option>
<mat-option [value]="2">TAG</mat-option>
</mat-select>
<md-hint align="end">把这个分享给你的朋友</md-hint>
</md-input-container>
<md-select class="full-width" placeholder="卡片允许" name="rule" [(ngModel)]="room.options.rule" required>
<md-option [value]="0">OCG</md-option>
<md-option [value]="1">TCG</md-option>
<md-option [value]="2">OCG & TCG</md-option>
<md-option [value]="3">专有卡禁止</md-option>
</md-select>
<md-select class="full-width" placeholder="决斗模式" name="mode" [(ngModel)]="room.options.mode" (ngModelChange)="set_start_lp()" required>
<md-option [value]="0">单局模式</md-option>
<md-option [value]="1">比赛模式</md-option>
<md-option [value]="2">TAG</md-option>
</md-select>
<!--<h2>额外选项</h2>-->
<!--<mat-slide-toggle #extra class="example-margin" color="primary">额外选项</mat-slide-toggle>-->
<!--<md-slide-toggle #extra class="example-margin" color="primary">额外选项</md-slide-toggle>-->
<mat-input-container class="full-width">
<input name="start_lp" [(ngModel)]="room.options.start_lp" matInput type="number" min="1" max="65536" placeholder="初始 LP" required>
</mat-input-container>
<mat-input-container class="full-width">
<input name="start_hand" [(ngModel)]="room.options.start_hand" matInput type="number" min="0" max="16" placeholder="初始手牌数" required>
</mat-input-container>
<mat-input-container class="full-width">
<input name="draw_count" [(ngModel)]="room.options.draw_count" matInput type="number" min="0" max="16" placeholder="每回合抽卡" required>
</mat-input-container>
<md-input-container class="full-width">
<input name="start_lp" [(ngModel)]="room.options.start_lp" mdInput type="number" min="1" max="65536" placeholder="初始 LP" required>
</md-input-container>
<md-input-container class="full-width">
<input name="start_hand" [(ngModel)]="room.options.start_hand" mdInput type="number" min="0" max="16" placeholder="初始手牌数" required>
</md-input-container>
<md-input-container class="full-width">
<input name="draw_count" [(ngModel)]="room.options.draw_count" mdInput type="number" min="0" max="16" placeholder="每回合抽卡" required>
</md-input-container>
<mat-checkbox class="full-width" name="room.private" [(ngModel)]="room.private">私密房间</mat-checkbox>
<mat-checkbox class="full-width" name="room.enable_priority" [(ngModel)]="room.options.enable_priority">旧规则
</mat-checkbox>
<mat-checkbox class="full-width" name="room.no_check_deck" [(ngModel)]="room.options.no_check_deck">不检查卡组</mat-checkbox>
<mat-checkbox class="full-width" name="room.no_shuffle_deck" [(ngModel)]="room.options.no_shuffle_deck">不洗切卡组
</mat-checkbox>
<md-checkbox class="full-width" name="room.private" [(ngModel)]="room.private">私密房间</md-checkbox>
<md-checkbox class="full-width" name="room.enable_priority" [(ngModel)]="room.options.enable_priority">旧规则
</md-checkbox>
<md-checkbox class="full-width" name="room.no_check_deck" [(ngModel)]="room.options.no_check_deck">不检查卡组</md-checkbox>
<md-checkbox class="full-width" name="room.no_shuffle_deck" [(ngModel)]="room.options.no_shuffle_deck">不洗切卡组
</md-checkbox>
<div id="actions">
<!--<button routerLink="/ygopro/lobby" mat-raised-button>返回大厅</button>-->
<button type="submit" color="primary" mat-raised-button>创建游戏</button>
<!--<button routerLink="/ygopro/lobby" md-raised-button>返回大厅</button>-->
<button type="submit" color="primary" md-raised-button>创建游戏</button>
</div>
</form>
import { Component, ElementRef, HostBinding, ViewChild } from '@angular/core';
import { MatSnackBar } from '@angular/material';
import { MdSnackBar } from '@angular/material';
import { LoginService } from '../login.service';
import { routerTransition } from '../router.animations';
import { YGOProService } from '../ygopro.service';
......@@ -27,7 +27,7 @@ export class NewRoomComponent {
options: {...this.ygopro.default_options}
};
constructor(public ygopro: YGOProService, private login: LoginService, private snackBar: MatSnackBar) {
constructor(public ygopro: YGOProService, private login: LoginService, private snackBar: MdSnackBar) {
}
copy(host_password: string) {
......
mat-list-item /deep/ .mat-list-item-content {
md-list-item /deep/ .mat-list-item-content {
justify-content: space-between;
height: 28px !important;
padding: 0
}
mat-grid-list {
md-grid-list {
font-size: 14px;
}
mat-grid-tile dt, mat-grid-tile dd {
md-grid-tile dt, md-grid-tile dd {
width: 100%;
}
mat-grid-tile {
md-grid-tile {
text-align: left;
}
mat-grid-tile dd {
md-grid-tile dd {
margin: 0;
text-align: left;
}
......
<h2 mat-dialog-title *ngIf="result === 'win'">胜利</h2>
<h2 mat-dialog-title *ngIf="result === 'lose'">败北</h2>
<h2 mat-dialog-title *ngIf="result === 'draw'">平局</h2>
<mat-dialog-content>
<mat-list [ngClass]="result" *ngIf="dp || exp || firstWin">
<mat-list-item *ngIf="dp">
<h2 md-dialog-title *ngIf="result === 'win'">胜利</h2>
<h2 md-dialog-title *ngIf="result === 'lose'">败北</h2>
<h2 md-dialog-title *ngIf="result === 'draw'">平局</h2>
<md-dialog-content>
<md-list [ngClass]="result" *ngIf="dp || exp || firstWin">
<md-list-item *ngIf="dp">
<dt>D.P</dt>
<dd>{{dp}}</dd>
</mat-list-item>
<mat-list-item *ngIf="exp">
</md-list-item>
<md-list-item *ngIf="exp">
<dt>EXP</dt>
<dd>{{exp}}</dd>
</mat-list-item>
<mat-list-item *ngIf="firstWin">
</md-list-item>
<md-list-item *ngIf="firstWin">
<dt>D.P (首胜)</dt>
<dd>{{firstWin}}</dd>
</mat-list-item>
</mat-list>
</mat-dialog-content>
<mat-dialog-actions>
<button mat-button mat-dialog-close>关闭</button>
</md-list-item>
</md-list>
</md-dialog-content>
<md-dialog-actions>
<button md-button md-dialog-close>关闭</button>
<!-- Can optionally provide a result for the closing dialog. -->
<button mat-button (click)="again()">再来一局</button>
</mat-dialog-actions>
<button md-button (click)="again()">再来一局</button>
</md-dialog-actions>
import { Component, Inject } from '@angular/core';
import { Http } from '@angular/http';
import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material';
import { MD_DIALOG_DATA, MdDialog, MdDialogRef } from '@angular/material';
import { LoginService } from '../login.service';
import { MatchDialogComponent } from '../match/match.component';
......@@ -15,11 +15,11 @@ export class ResultDialogComponent {
exp: string | undefined;
firstWin: string | undefined;
constructor(@Inject(MAT_DIALOG_DATA) public last: any,
constructor(@Inject(MD_DIALOG_DATA) public last: any,
public login: LoginService,
private http: Http,
public dialog: MatDialog,
private dialogRef: MatDialogRef<MatchDialogComponent>) {
public dialog: MdDialog,
private dialogRef: MdDialogRef<MatchDialogComponent>) {
if (this.last.userscorea === this.last.userscoreb) {
this.result = 'draw';
} else if (this.last.winner === this.login.user.username) {
......
......@@ -26,7 +26,7 @@
flex: 2
}
mat-table {
md-table {
flex: 1;
padding-bottom: 36px;
}
......
<app-toolbar>房间列表</app-toolbar>
<div class="hint" *ngIf="dataSource.loading"><mat-spinner></mat-spinner></div>
<div class="hint" *ngIf="dataSource.loading"><md-spinner></md-spinner></div>
<div class="hint" *ngIf="dataSource.empty">现在没有等待中的游戏,可以自行创建一个房间或者去匹配</div>
<div class="hint" *ngIf="dataSource.error">网络错误</div>
<mat-table #table [dataSource]="dataSource">
<md-table #table [dataSource]="dataSource">
<!--- Note that these columns can be defined in any order.
The actual rendered columns are set as a property on room row definition" -->
<!-- ID Column -->
<ng-container matColumnDef="title">
<mat-header-cell class="game-title" *matHeaderCellDef>游戏标题</mat-header-cell>
<mat-cell class="game-title" *matCellDef="let room">{{room.title}}</mat-cell>
<ng-container cdkColumnDef="title">
<md-header-cell class="game-title" *cdkHeaderCellDef>游戏标题</md-header-cell>
<md-cell class="game-title" *cdkCellDef="let room">{{room.title}}</md-cell>
</ng-container>
<!-- Progress Column -->
<ng-container matColumnDef="users">
<mat-header-cell *matHeaderCellDef>玩家</mat-header-cell>
<mat-cell *matCellDef="let room">
<ng-container cdkColumnDef="users">
<md-header-cell *cdkHeaderCellDef>玩家</md-header-cell>
<md-cell *cdkCellDef="let room">
<img *ngFor="let user of room.users" class="avatar" [src]="login.avatar(user.username)">
</mat-cell>
</md-cell>
</ng-container>
<!-- Name Column -->
<ng-container matColumnDef="mode">
<mat-header-cell *matHeaderCellDef>决斗模式</mat-header-cell>
<mat-cell *matCellDef="let room">
<ng-container cdkColumnDef="mode">
<md-header-cell *cdkHeaderCellDef>决斗模式</md-header-cell>
<md-cell *cdkCellDef="let room">
<span *ngIf="room.options.mode === 0">单局模式</span>
<span *ngIf="room.options.mode === 1">比赛模式</span>
<span *ngIf="room.options.mode === 2">TAG</span>
</mat-cell>
</md-cell>
</ng-container>
<!-- Color Column -->
<ng-container matColumnDef="extra">
<mat-header-cell *matHeaderCellDef>额外选项</mat-header-cell>
<mat-cell *matCellDef="let room">
<ng-container cdkColumnDef="extra">
<md-header-cell *cdkHeaderCellDef>额外选项</md-header-cell>
<md-cell *cdkCellDef="let room">
<span *ngIf="room.options.rule != ygopro.default_options.rule">{{{'0': 'OCG', '1': 'TCG', '2': 'O/T', '3': '专有卡禁止'}[room.options.rule]}}</span>
<span *ngIf="room.options.start_lp != ygopro.default_options.start_lp">{{room.options.start_lp}} LP</span>
<span *ngIf="room.options.start_hand != ygopro.default_options.start_hand">{{room.options.start_hand}} 初始</span>
......@@ -44,14 +44,14 @@
<span *ngIf="room.options.enable_priority != ygopro.default_options.enable_priority">旧规则</span>
<span *ngIf="room.options.no_check_deck != ygopro.default_options.no_check_deck">不检查</span>
<span *ngIf="room.options.no_shuffle_deck != ygopro.default_options.no_shuffle_deck">不洗卡</span>
</mat-cell>
</md-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let room; columns: displayedColumns;" (click)="ygopro.join_room(room)"></mat-row>
</mat-table>
<md-header-row *cdkHeaderRowDef="displayedColumns"></md-header-row>
<md-row *cdkRowDef="let room; columns: displayedColumns;" (click)="ygopro.join_room(room)"></md-row>
</md-table>
<form (submit)="ygopro.join_private(joinPassword.value)" ngNativeValidate>
<input #joinPassword placeholder="在这输入你朋友的私密房间密码就可以进去了哦!" required>
<button mat-raised-button color="primary">加入私密房间</button>
<button md-raised-button color="primary">加入私密房间</button>
</form>
......@@ -120,7 +120,7 @@ export class StorageService {
this.working = true;
// console.log('download', local_path, remote_path, index_path, time);
const data: Uint8Array = await this.client.getFileContents(remote_path);
window.ygopro.writeFile(local_path, Buffer.from(<ArrayBuffer>data.buffer).toString('base64'));
window.ygopro.writeFile(local_path, Buffer.from(data.buffer).toString('base64'));
window.ygopro.setFileLastModified(local_path, time);
// console.log(local_path, time);
localStorage.setItem(index_path, time.toString());
......
<mat-toolbar color="primary">
<button mat-icon-button (click)="history.back()">
<mat-icon>&#xe5c4;</mat-icon><!--arrow_back--></button>
<md-toolbar color="primary">
<button md-icon-button (click)="history.back()">
<md-icon>&#xe5c4;</md-icon><!--arrow_back--></button>
<span><ng-content></ng-content></span>
</mat-toolbar>
</md-toolbar>
<app-toolbar>观战</app-toolbar>
<div class="hint" *ngIf="dataSource.loading"><mat-spinner></mat-spinner></div>
<div class="hint" *ngIf="dataSource.loading"><md-spinner></md-spinner></div>
<div class="hint" *ngIf="dataSource.empty">现在没有进行中的游戏</div>
<div class="hint" *ngIf="dataSource.error">网络错误</div>
<mat-table #table [dataSource]="dataSource">
<md-table #table [dataSource]="dataSource">
<!--- Note that these columns can be defined in any order.
The actual rendered columns are set as a property on room row definition" -->
<!-- ID Column -->
<ng-container matColumnDef="mode">
<mat-header-cell *matHeaderCellDef>游戏模式</mat-header-cell>
<mat-cell *matCellDef="let room">
<ng-container cdkColumnDef="mode">
<md-header-cell *cdkHeaderCellDef>游戏模式</md-header-cell>
<md-cell *cdkCellDef="let room">
<span i18n *ngIf="room.id.startsWith('AI#')">单人模式</span>
<span i18n *ngIf="room.arena === 'athletic'">竞技匹配</span>
<span i18n *ngIf="room.arena === 'entertain'">娱乐匹配</span>
<span i18n *ngIf="!(room.arena || room.id.startsWith('AI#')) && room.options.mode === 0">单局模式</span>
<span i18n *ngIf="!(room.arena || room.id.startsWith('AI#')) && room.options.mode === 1">比赛模式</span>
<span i18n *ngIf="!(room.arena || room.id.startsWith('AI#')) && room.options.mode === 2">TAG</span>
</mat-cell>
</md-cell>
</ng-container>
<!-- ID Column -->
<ng-container matColumnDef="title">
<mat-header-cell class="game-title" *matHeaderCellDef>游戏标题</mat-header-cell>
<mat-cell class="game-title" *matCellDef="let room">
<ng-container cdkColumnDef="title">
<md-header-cell class="game-title" *cdkHeaderCellDef>游戏标题</md-header-cell>
<md-cell class="game-title" *cdkCellDef="let room">
<span *ngIf="room.private">{{room.users[0] && room.users[0].username}}的私密房间</span>
<span i18n *ngIf="room.arena || room.id.startsWith('AI#')">{{room.users[0] && room.users[0].username}} Vs. {{room.users[1] && room.users[1].username}}</span>
<span *ngIf="!(room.arena || room.id.startsWith('AI#') || room.private)">{{room.title}}</span>
</mat-cell>
</md-cell>
</ng-container>
<!-- Progress Column -->
<ng-container matColumnDef="users">
<mat-header-cell *matHeaderCellDef>玩家</mat-header-cell>
<mat-cell *matCellDef="let room">
<ng-container cdkColumnDef="users">
<md-header-cell *cdkHeaderCellDef>玩家</md-header-cell>
<md-cell *cdkCellDef="let room">
<img *ngFor="let user of room.users" class="avatar" [src]="login.avatar(user.username)">
</mat-cell>
</md-cell>
</ng-container>
<!-- Color Column -->
<ng-container matColumnDef="extra">
<mat-header-cell *matHeaderCellDef>额外选项</mat-header-cell>
<mat-cell *matCellDef="let room">
<ng-container cdkColumnDef="extra">
<md-header-cell *cdkHeaderCellDef>额外选项</md-header-cell>
<md-cell *cdkCellDef="let room">
<span *ngIf="room.options.rule != ygopro.default_options.rule">{{{'0': 'OCG', '1': 'TCG', '2': 'O/T', '3': '专有卡禁止'}[room.options.rule]}}</span>
<span *ngIf="room.options.start_lp != ygopro.default_options.start_lp">{{room.options.start_lp}} LP</span>
<span *ngIf="room.options.start_hand != ygopro.default_options.start_hand">{{room.options.start_hand}} 初始</span>
......@@ -51,10 +51,10 @@
<span *ngIf="room.options.enable_priority != ygopro.default_options.enable_priority">旧规则</span>
<span *ngIf="room.options.no_check_deck != ygopro.default_options.no_check_deck">不检查</span>
<span *ngIf="room.options.no_shuffle_deck != ygopro.default_options.no_shuffle_deck">不洗卡</span>
</mat-cell>
</md-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let room; columns: displayedColumns;" (click)="ygopro.join_room(room)"></mat-row>
</mat-table>
<md-header-row *cdkHeaderRowDef="displayedColumns"></md-header-row>
<md-row *cdkRowDef="let room; columns: displayedColumns;" (click)="ygopro.join_room(room)"></md-row>
</md-table>
<app-toolbar>单人模式</app-toolbar>
<mat-list>
<h3 mat-subheader>选择对手</h3>
<mat-list-item (click)="ygopro.join_windbot()">
<mat-icon mat-list-icon>&#xe195;</mat-icon><!-- airplanemode_active -->
<h4 mat-line>随机</h4>
</mat-list-item>
<mat-list-item *ngFor="let windbot of ygopro.windbot" (click)="ygopro.join_windbot(windbot)">
<img mat-list-icon [src]="login.avatar(windbot)">
<h4 mat-line>{{windbot}}</h4>
</mat-list-item>
</mat-list>
<md-list>
<h3 md-subheader>选择对手</h3>
<md-list-item (click)="ygopro.join_windbot()">
<md-icon md-list-icon>&#xe195;</md-icon><!-- airplanemode_active -->
<h4 md-line>随机</h4>
</md-list-item>
<md-list-item *ngFor="let windbot of ygopro.windbot" (click)="ygopro.join_windbot(windbot)">
<img md-list-icon [src]="login.avatar(windbot)">
<h4 md-line>{{windbot}}</h4>
</md-list-item>
</md-list>
This diff is collapsed.
......@@ -15,7 +15,6 @@
"typeRoots": [
"node_modules/@types"
],
"skipLibCheck": true,
"lib": [
"esnext",
"dom.iterable"
......
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