Commit a295c6e8 authored by nanahira's avatar nanahira

fix ygopro switch

parent bc0b3261
......@@ -67,7 +67,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>
......
......@@ -10,9 +10,11 @@ import {
Inject,
Input,
LOCALE_ID,
OnChanges,
OnDestroy,
OnInit,
Output,
SimpleChanges,
ViewChild
} from '@angular/core';
import { clipboard, shell } from 'electron';
......@@ -144,12 +146,18 @@ export class DeckAndCategory {
templateUrl: 'ygopro.component.html',
styleUrls: ['ygopro.component.css']
})
export class YGOProComponent implements OnInit, OnDestroy, AfterViewInit {
export class YGOProComponent implements OnInit, OnDestroy, AfterViewInit, 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.refreshYGOProData()
}
}
@Output()
points: EventEmitter<any> = new EventEmitter();
decks: DeckAndCategory[] = [];
......@@ -340,9 +348,7 @@ export class YGOProComponent implements OnInit, OnDestroy, AfterViewInit {
ygoproData: YGOProData;
async refreshYGOProData() {
console.log(`Refreshing YGOPro Data.`);
this.ygoproData = this.getYGOProData(this.app);
console.log(JSON.stringify(this.ygoproData))
this.servers = this.ygoproData.servers;
this.selectableServers = this.servers.filter((s) => !s.hidden);
this.currentServer = this.selectableServers[0];
......
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