Commit bc0b3261 authored by nanahira's avatar nanahira

modal and reload

parent 5e48de4d
...@@ -357,11 +357,11 @@ ...@@ -357,11 +357,11 @@
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title" id="staticBackdropLabel">Modal title</h5> <h5 class="modal-title" id="staticBackdropLabel">决斗结果</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
... {{ matchResultData.myname }} {{ matchResultData.athletic_win }}
</div> </div>
</div> </div>
</div> </div>
......
...@@ -171,7 +171,7 @@ export class YGOProComponent implements OnInit, OnDestroy, AfterViewInit { ...@@ -171,7 +171,7 @@ export class YGOProComponent implements OnInit, OnDestroy, AfterViewInit {
@ViewChild('resultModal') @ViewChild('resultModal')
resultModal: ElementRef<HTMLElement>; resultModal: ElementRef<HTMLElement>;
ygoproMatchResultModel: Modal; ygoproMatchResultModal: Modal;
// points: Points; // points: Points;
servers: Server[] = []; servers: Server[] = [];
...@@ -342,6 +342,7 @@ export class YGOProComponent implements OnInit, OnDestroy, AfterViewInit { ...@@ -342,6 +342,7 @@ export class YGOProComponent implements OnInit, OnDestroy, AfterViewInit {
async refreshYGOProData() { async refreshYGOProData() {
console.log(`Refreshing YGOPro Data.`); console.log(`Refreshing YGOPro Data.`);
this.ygoproData = this.getYGOProData(this.app); this.ygoproData = this.getYGOProData(this.app);
console.log(JSON.stringify(this.ygoproData))
this.servers = this.ygoproData.servers; this.servers = this.ygoproData.servers;
this.selectableServers = this.servers.filter((s) => !s.hidden); this.selectableServers = this.servers.filter((s) => !s.hidden);
this.currentServer = this.selectableServers[0]; this.currentServer = this.selectableServers[0];
...@@ -366,8 +367,8 @@ export class YGOProComponent implements OnInit, OnDestroy, AfterViewInit { ...@@ -366,8 +367,8 @@ export class YGOProComponent implements OnInit, OnDestroy, AfterViewInit {
} }
async ngOnInit() { async ngOnInit() {
this.ygoproMatchResultModel = new Modal(this.resultModal.nativeElement, {keyboard: false})
await this.refreshYGOProData(); await this.refreshYGOProData();
this.ygoproMatchResultModal = new Modal(this.resultModal.nativeElement, {keyboard: false})
remote.ipcMain.on('YGOPro', (e: any, type: string) => { remote.ipcMain.on('YGOPro', (e: any, type: string) => {
console.log('rrrrr'); console.log('rrrrr');
this.request_match(type); this.request_match(type);
...@@ -702,8 +703,10 @@ export class YGOProComponent implements OnInit, OnDestroy, AfterViewInit { ...@@ -702,8 +703,10 @@ export class YGOProComponent implements OnInit, OnDestroy, AfterViewInit {
return this.join('AI#' + name, this.currentServer); return this.join('AI#' + name, this.currentServer);
} }
matchResultData: any = {};
async start_game(action: string, param: any) { async start_game(action: string, param: any) {
let data: any; // let data: any;
let start_time: string; let start_time: string;
let exp_rank_ex: number; let exp_rank_ex: number;
let arena_rank_ex: number; let arena_rank_ex: number;
...@@ -762,8 +765,8 @@ export class YGOProComponent implements OnInit, OnDestroy, AfterViewInit { ...@@ -762,8 +765,8 @@ export class YGOProComponent implements OnInit, OnDestroy, AfterViewInit {
} }
}) })
).then((d) => { ).then((d) => {
data = d.data[0]; this.matchResultData = d.data[0];
data.myname = this.loginService.user.username; this.matchResultData.myname = this.loginService.user.username;
}); });
await lastValueFrom( await lastValueFrom(
...@@ -773,17 +776,17 @@ export class YGOProComponent implements OnInit, OnDestroy, AfterViewInit { ...@@ -773,17 +776,17 @@ export class YGOProComponent implements OnInit, OnDestroy, AfterViewInit {
} }
}) })
).then((data2) => { ).then((data2) => {
data.athletic_win = data2.athletic_win; this.matchResultData.athletic_win = data2.athletic_win;
data.athletic_lose = data2.athletic_lose; this.matchResultData.athletic_lose = data2.athletic_lose;
data.entertain_win = data2.entertain_win; this.matchResultData.entertain_win = data2.entertain_win;
data.entertain_lose = data2.entertain_lose; this.matchResultData.entertain_lose = data2.entertain_lose;
data.exp_rank = data2.exp_rank; this.matchResultData.exp_rank = data2.exp_rank;
data.arena_rank = data2.arena_rank; this.matchResultData.arena_rank = data2.arena_rank;
data.exp_rank_ex = exp_rank_ex; this.matchResultData.exp_rank_ex = exp_rank_ex;
data.arena_rank_ex = arena_rank_ex; this.matchResultData.arena_rank_ex = arena_rank_ex;
// if (start_time !== data.start_time) { // if (start_time !== data.start_time) {
// this.appsService.showResult('projects/ygopro-result/end_YGOPro_single.html', data, 202, 222); // this.appsService.showResult('projects/ygopro-result/end_YGOPro_single.html', data, 202, 222);
this.ygoproMatchResultModal.show();
// } // }
}); });
} catch (error) { } catch (error) {
......
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