Commit ca6c7f2c authored by nanahira's avatar nanahira

fix ygopro switch issue

parent 4fd28f46
Pipeline #14954 passed with stages
in 3 minutes and 35 seconds
......@@ -68,7 +68,7 @@
</div>
<!--<button (click)="log(appsService)">test</button>-->
<network *ngIf="currentApp && !currentApp.isYGOPro && currentApp.network && currentApp.network.protocol == 'maotama'" [currentApp]="currentApp"></network>
<ygopro *ngIf="currentApp.isReady() && currentApp.isYGOPro" [app]="currentApp" [currentApp]="currentApp" (points)="onPoints($event)"></ygopro>
<ygopro *ngIf="currentApp.isReady() && currentApp.isYGOPro" [app]="currentApp" (points)="onPoints($event)"></ygopro>
</div>
</div>
......
......@@ -1250,4 +1250,8 @@ export class AppsService {
});
}
onSwitchApp(app: App) {
this.lastVisited = app;
}
}
......@@ -162,7 +162,7 @@ export class LobbyComponent implements OnInit {
chooseApp(app: App) {
this.currentApp = app;
this.appsService.lastVisited = app;
this.appsService.onSwitchApp(app);
}
get grouped_apps() {
......
/**
* Created by zh99998 on 16/9/2.
*/
import {ChangeDetectorRef, Component, ElementRef, EventEmitter, Input, OnDestroy, OnInit, Output, ViewChild} from '@angular/core';
import {ChangeDetectorRef, Component, ElementRef, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, ViewChild} from '@angular/core';
import {Headers, Http} from '@angular/http';
import {clipboard, remote, shell} from 'electron';
import * as fs from 'fs-extra';
......@@ -116,11 +116,15 @@ let match_started_at: Date;
templateUrl: 'ygopro.component.html',
styleUrls: ['ygopro.component.css'],
})
export class YGOProComponent implements OnInit, OnDestroy {
export class YGOProComponent implements OnInit, OnDestroy, OnChanges {
@Input()
app: App;
@Input()
currentApp: App;
async ngOnChanges(changes: SimpleChanges) {
if (changes.app && changes.app.previousValue && changes.app.currentValue !== changes.app.previousValue) {
await this.reloadInfo()
}
}
@Output()
points: EventEmitter<Points> = new EventEmitter();
......@@ -146,13 +150,8 @@ export class YGOProComponent implements OnInit, OnDestroy {
selectableServers: Server[];
// selectingServerId: string;
currentServer: Server;
/*reloadCurrentServer() {
this.currentServer = this.servers.find(s => s.id === this.selectingServerId);
}*/
// tslint:disable-next-line:member-ordering
rooms_loading = true;
......@@ -324,28 +323,35 @@ export class YGOProComponent implements OnInit, OnDestroy {
return ygoproData;
}
async ngOnInit() {
async reloadInfo() {
const ygoproData = this.getYGOProData(this.app);
const previousServer = this.currentServer;
this.servers = ygoproData.servers;
this.selectableServers = this.servers.filter(s => !s.hidden);
this.currentServer = this.selectableServers[0];
// this.reloadCurrentServer();
let locale: string;
if (this.settingsService.getLocale().startsWith('zh')) {
locale = 'zh-CN';
} else {
locale = 'en-US';
if (!previousServer || !this.selectableServers.includes(previousServer)) {
this.currentServer = this.selectableServers[0];
}
if (ygoproData.ygopro.lastDeckFormat) {
// console.log(`Deck format pattern: ${ygoproData.ygopro.lastDeckFormat}`)
this.lastDeckFormat = new RegExp(ygoproData.ygopro.lastDeckFormat);
} else {
this.lastDeckFormat = undefined;
}
this.system_conf = this.app.systemConfPath;
console.log(`Will load system conf file from ${this.system_conf}`);
await this.refresh(true);
}
async ngOnInit() {
let locale: string;
if (this.settingsService.getLocale().startsWith('zh')) {
locale = 'zh-CN';
} else {
locale = 'en-US';
}
await this.reloadInfo();
let modal = $('#game-list-modal');
......
......@@ -78,7 +78,7 @@
"rollup-plugin-node-resolve": "latest",
"rollup-plugin-uglify": "latest",
"tslint": "^3.15.1",
"typescript": "^2.9.2"
"typescript": "^4.7.4"
}
},
"node_modules/@angular/animations": {
......@@ -134,6 +134,54 @@
"typescript": "^2.0.2"
}
},
"node_modules/@angular/compiler-cli/node_modules/@angular/tsc-wrapped": {
"version": "4.2.6",
"resolved": "https://registry.npmjs.org/@angular/tsc-wrapped/-/tsc-wrapped-4.2.6.tgz",
"integrity": "sha512-5jeHJGhyzsDKSv5s8F/0oLvm48WbLrXP+TL/ZsGgWFBPL0qi2j9S0n4UE3Nq/Rb+B9x2haVnragrfoiO0vL/wA==",
"dev": true,
"dependencies": {
"tsickle": "^0.21.0"
},
"peerDependencies": {
"typescript": "^2.1.5"
}
},
"node_modules/@angular/compiler-cli/node_modules/@angular/tsc-wrapped/node_modules/tsickle": {
"version": "0.21.6",
"resolved": "https://registry.npmjs.org/tsickle/-/tsickle-0.21.6.tgz",
"integrity": "sha512-S0WhNQvuO7zbTDeOrNJ1LGKPVLUE0kjSdpMxMiyeZE0c0MtpvB93p787iOnjKqUOFl1+x2v1CN/DDMFOX6WKdA==",
"dev": true,
"dependencies": {
"minimist": "^1.2.0",
"mkdirp": "^0.5.1",
"source-map": "^0.5.6",
"source-map-support": "^0.4.2"
},
"bin": {
"tsickle": "build/src/main.js"
},
"peerDependencies": {
"typescript": "^2.1.0"
}
},
"node_modules/@angular/compiler-cli/node_modules/source-map": {
"version": "0.5.7",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
"integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==",
"dev": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/@angular/compiler-cli/node_modules/source-map-support": {
"version": "0.4.18",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz",
"integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==",
"dev": true,
"dependencies": {
"source-map": "^0.5.6"
}
},
"node_modules/@angular/core": {
"version": "4.2.6",
"resolved": "https://registry.npmjs.org/@angular/core/-/core-4.2.6.tgz",
......@@ -231,18 +279,6 @@
"rxjs": "^5.0.1"
}
},
"node_modules/@angular/tsc-wrapped": {
"version": "4.2.6",
"resolved": "https://registry.npmjs.org/@angular/tsc-wrapped/-/tsc-wrapped-4.2.6.tgz",
"integrity": "sha1-YORLWzjzNA7hTFSlinoHEzxk6Jg=",
"dev": true,
"dependencies": {
"tsickle": "^0.21.0"
},
"peerDependencies": {
"typescript": "^2.1.5"
}
},
"node_modules/@babel/code-frame": {
"version": "7.14.5",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.14.5.tgz",
......@@ -5572,42 +5608,6 @@
"utf8-byte-length": "^1.0.1"
}
},
"node_modules/tsickle": {
"version": "0.21.6",
"resolved": "https://registry.npmjs.org/tsickle/-/tsickle-0.21.6.tgz",
"integrity": "sha1-U7Abl5xcE/2xOvs/uVgXflmRWI0=",
"dev": true,
"dependencies": {
"minimist": "^1.2.0",
"mkdirp": "^0.5.1",
"source-map": "^0.5.6",
"source-map-support": "^0.4.2"
},
"bin": {
"tsickle": "build/src/main.js"
},
"peerDependencies": {
"typescript": "^2.1.0"
}
},
"node_modules/tsickle/node_modules/source-map": {
"version": "0.5.7",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
"integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=",
"dev": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/tsickle/node_modules/source-map-support": {
"version": "0.4.18",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz",
"integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==",
"dev": true,
"dependencies": {
"source-map": "^0.5.6"
}
},
"node_modules/tslib": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
......@@ -5697,9 +5697,9 @@
}
},
"node_modules/typescript": {
"version": "2.9.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz",
"integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==",
"version": "4.7.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz",
"integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
......@@ -6100,6 +6100,46 @@
"@angular/tsc-wrapped": "4.2.6",
"minimist": "^1.2.0",
"reflect-metadata": "^0.1.2"
},
"dependencies": {
"@angular/tsc-wrapped": {
"version": "4.2.6",
"resolved": "https://registry.npmjs.org/@angular/tsc-wrapped/-/tsc-wrapped-4.2.6.tgz",
"integrity": "sha512-5jeHJGhyzsDKSv5s8F/0oLvm48WbLrXP+TL/ZsGgWFBPL0qi2j9S0n4UE3Nq/Rb+B9x2haVnragrfoiO0vL/wA==",
"dev": true,
"requires": {
"tsickle": "^0.21.0"
},
"dependencies": {
"tsickle": {
"version": "0.21.6",
"resolved": "https://registry.npmjs.org/tsickle/-/tsickle-0.21.6.tgz",
"integrity": "sha512-S0WhNQvuO7zbTDeOrNJ1LGKPVLUE0kjSdpMxMiyeZE0c0MtpvB93p787iOnjKqUOFl1+x2v1CN/DDMFOX6WKdA==",
"dev": true,
"requires": {
"minimist": "^1.2.0",
"mkdirp": "^0.5.1",
"source-map": "^0.5.6",
"source-map-support": "^0.4.2"
}
}
}
},
"source-map": {
"version": "0.5.7",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
"integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==",
"dev": true
},
"source-map-support": {
"version": "0.4.18",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz",
"integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==",
"dev": true,
"requires": {
"source-map": "^0.5.6"
}
}
}
},
"@angular/core": {
......@@ -6161,15 +6201,6 @@
"tslib": "^1.7.1"
}
},
"@angular/tsc-wrapped": {
"version": "4.2.6",
"resolved": "https://registry.npmjs.org/@angular/tsc-wrapped/-/tsc-wrapped-4.2.6.tgz",
"integrity": "sha1-YORLWzjzNA7hTFSlinoHEzxk6Jg=",
"dev": true,
"requires": {
"tsickle": "^0.21.0"
}
},
"@babel/code-frame": {
"version": "7.14.5",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.14.5.tgz",
......@@ -10420,35 +10451,6 @@
"utf8-byte-length": "^1.0.1"
}
},
"tsickle": {
"version": "0.21.6",
"resolved": "https://registry.npmjs.org/tsickle/-/tsickle-0.21.6.tgz",
"integrity": "sha1-U7Abl5xcE/2xOvs/uVgXflmRWI0=",
"dev": true,
"requires": {
"minimist": "^1.2.0",
"mkdirp": "^0.5.1",
"source-map": "^0.5.6",
"source-map-support": "^0.4.2"
},
"dependencies": {
"source-map": {
"version": "0.5.7",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
"integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=",
"dev": true
},
"source-map-support": {
"version": "0.4.18",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz",
"integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==",
"dev": true,
"requires": {
"source-map": "^0.5.6"
}
}
}
},
"tslib": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
......@@ -10522,9 +10524,9 @@
}
},
"typescript": {
"version": "2.9.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz",
"integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==",
"version": "4.7.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz",
"integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==",
"dev": true
},
"uglify-js": {
......
......@@ -91,7 +91,7 @@
"rollup-plugin-node-resolve": "latest",
"rollup-plugin-uglify": "latest",
"tslint": "^3.15.1",
"typescript": "^2.9.2"
"typescript": "^4.7.4"
},
"build": {
"productName": "MyCard",
......
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
......
{"version":3,"file":"patch-linux-wine.js","sourceRoot":"","sources":["patch-linux-wine.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2BAAoC;AAEpC,4BAA4B;AAE5B;;QACI,MAAM,IAAI,GAAmB,IAAI,CAAC,KAAK,CAAC,MAAM,aAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;QACrF,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;YACpB,OAAO,CAAC,GAAG,CAAC,WAAW,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;YACjC,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;YAC5B,OAAO,CAAC,KAAK,GAAG,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAC5C,KAAK,MAAM,CAAC,UAAU,EA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GAAG,CAAC,yBAAyB,GAAG,CAAC,EAAE,IAAI,UAAU,EAAE,CAAC,CAAC;oBAC7D,MAAM,CAAC,IAAI,GAAG,SAAS,CAAC;oBACxB,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC;iBAC/B;aACJ;SACJ;QACD,MAAM,aAAE,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACvE,CAAC;CAAA;AACD,IAAI,EAAE,CAAC"}
\ No newline at end of file
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