Commit 8fd6747f authored by 神楽坂玲奈's avatar 神楽坂玲奈

update bootstrap & ygopro deck group init

parent 231a79bf
......@@ -2,22 +2,22 @@
<img *ngIf="currentApp.cover" class="cover rounded" [src]="currentApp.cover">
<div id="right">
<h1>{{currentApp.name}}</h1>
<div id="time">您已玩了 2564 小时</div>
<!-- <div id="time">您已玩了 2564 小时</div>-->
<!--应用未购买-->
<div *ngIf="!currentApp.isBought()">
<button i18n type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#purchase-modal">{{currentApp.price.cny | currency:'CNY':true}} 购买</button>
<button i18n type="button" (click)="updateInstallOption(currentApp)" class="btn btn-secondary btn-sm" data-toggle="modal" data-target="#install-modal">安装试玩版</button>
<button i18n type="button" class="btn btn-primary btn-sm" data-bs-toggle="modal" data-bs-target="#purchase-modal">{{currentApp.price.cny | currency:'CNY':true}} 购买</button>
<button i18n type="button" (click)="updateInstallOption(currentApp)" class="btn btn-secondary btn-sm" data-bs-toggle="modal" data-bs-target="#install-modal">安装试玩版</button>
<!--<button i18n (click)="updateInstallOption(currentApp)" type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#install-modal">我已经购买过</button>-->
<!--<button i18n (click)="updateInstallOption(currentApp)" type="button" class="btn btn-primary btn-sm" data-bs-toggle="modal" data-bs-target="#install-modal">我已经购买过</button>-->
</div>
<!--应用已购买,未安装-->
<div *ngIf="currentApp.isBought() && !currentApp.isInstalled()" class="i-b">
<button i18n (click)="updateInstallOption(currentApp)" type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#install-modal">安装</button>
<button i18n *ngIf="currentApp.runnable()" (click)="updateInstallOption(currentApp)" type="button" class="btn btn-secondary btn-sm" data-toggle="modal" data-target="#import-modal">导入</button>
<button i18n (click)="updateInstallOption(currentApp)" type="button" class="btn btn-primary btn-sm" data-bs-toggle="modal" data-bs-target="#install-modal">安装</button>
<button i18n *ngIf="currentApp.runnable()" (click)="updateInstallOption(currentApp)" type="button" class="btn btn-secondary btn-sm" data-bs-toggle="modal" data-bs-target="#import-modal">导入</button>
</div>
<!--应用变更中-->
......@@ -52,7 +52,7 @@
<!--<div class="input-group-btn" style="flex-direction: row">-->
<!--<button i18n *ngIf="!appsService.connections.get(currentApp)" [disabled]="!appsService.allReady(currentApp)" (click)="appsService.network(currentApp, currentApp.network.servers[0])" type="button" class="btn btn-secondary btn-sm">联机</button>-->
<!--<button i18n *ngIf="appsService.connections.get(currentApp)" (click)="copy(appsService.connections.get(currentApp).address)" [disabled]="!appsService.connections.get(currentApp).address" type="button" class="btn btn-secondary btn-sm">复制</button>-->
<!--<button type="button" class="btn btn-sm btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>-->
<!--<button type="button" class="btn btn-sm btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown"></button>-->
<!--<div class="dropdown-menu" [class.dropdown-menu-right]="appsService.connections.get(currentApp)">-->
<!--<h6 i18n class="dropdown-header">选择服务器</h6>-->
<!--<a *ngFor="let server of currentApp.network.servers" (click)="appsService.network(currentApp, server)" class="dropdown-item" href="#">{{server.id}}</a>-->
......@@ -200,7 +200,7 @@
<form id="install-form" class="modal-content" (ngSubmit)="install(currentApp,installOption,referencesInstall)" #theForm="ngForm">
<div class="modal-header">
<h5 i18n class="modal-title" id="myModalLabel">安装 {{currentApp.name}}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close">
<span>&times;</span>
</button>
</div>
......@@ -233,7 +233,7 @@
</div>
</div>
<div class="modal-footer">
<button i18n type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
<button i18n type="button" class="btn btn-secondary" data-bs-dismiss="modal">取消</button>
<button i18n type="submit" [disabled]="!theForm.form.valid" class="btn btn-primary">安装</button>
</div>
</form>
......@@ -242,20 +242,14 @@
<div class="modal fade" id="import-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" *ngIf="installOption">
<div class="modal-dialog" role="document">
<form id="import-form" class="modal-content" (ngSubmit)="importGame(currentApp,installOption,referencesInstall)" #theForm="ngForm">
<form id="import-form" class="modal-content" (ngSubmit)="importGame(file.files[0].path,currentApp,installOption,referencesInstall)" #theForm="ngForm" ngNativeValidate>
<div class="modal-header">
<h5 i18n class="modal-title">导入 {{currentApp.name}}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span>&times;</span>
</button>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p i18n>选择主程序 {{currentApp.actions.get('main').execute}}</p>
<label class="custom-file" lang="en">
<input (click)="$event.preventDefault();selectImport(currentApp)" type="file" id="file" class="custom-file-input">
<span class="custom-file-control">{{import_path || currentApp.actions.get('main').execute}}</span>
</label>
<input #file name="file" type="file" id="file" class="form-control" required>
<h4 i18n>导入到</h4>
<div class="form-group">
<select class="form-control" name="installPath" (change)="selectLibrary()" [(ngModel)]="installOption.installLibrary" title="path">
......@@ -283,7 +277,7 @@
</div>
</div>
<div class="modal-footer">
<button i18n type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
<button i18n type="button" class="btn btn-secondary" data-bs-dismiss="modal">取消</button>
<button i18n type="submit" [disabled]="import_path && !theForm.form.valid" class="btn btn-primary">导入</button>
</div>
</form>
......@@ -296,7 +290,7 @@
<div class="modal-content">
<div class="modal-header">
<h5 i18n class="modal-title">购买 {{currentApp.name}}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close">
<span>&times;</span>
</button>
</div>
......@@ -336,7 +330,7 @@
</div>
<div class="modal-footer">
<button i18n class="btn btn-secondary" data-dismiss="modal">取消</button>
<button i18n class="btn btn-secondary" data-bs-dismiss="modal">取消</button>
<button i18n [disabled]="creating_order" class="btn btn-primary" (click)="purchase()">购买</button>
</div>
</div>
......@@ -349,7 +343,7 @@
<div class="modal-content">
<div class="modal-header">
<h5 i18n class="modal-title">购买 {{currentApp.name}}</h5>
<!--<button type="button" class="close" data-dismiss="modal" aria-label="Close">-->
<!--<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close">-->
<!--<span>&times;</span>-->
<!--</button>-->
</div>
......@@ -360,7 +354,7 @@
若支付失败,请返回并选择其他支付方式
</div>
<div class="modal-footer">
<button i18n type="button" class="btn btn-secondary" data-dismiss="modal">返回</button>
<button i18n type="button" class="btn btn-secondary" data-bs-dismiss="modal">返回</button>
</div>
</div>
</div>
......
......@@ -36,7 +36,7 @@ export class AppDetailComponent implements OnInit, OnChanges {
references: App[];
referencesInstall: { [id: string]: boolean };
import_path: string;
// import_path: string;
background: string;
points: Points;
......@@ -68,9 +68,9 @@ export class AppDetailComponent implements OnInit, OnChanges {
}
async ngOnChanges(changes: SimpleChanges) {
if (this.currentApp.isBought()) {
$('#purchase-modal-alipay').modal('hide');
}
// if (this.currentApp.isBought()) {
// $('#purchase-modal-alipay').modal('hide');
// }
if (changes['currentApp']) {
if (this.currentApp.background) {
this.el.nativeElement.style.background = `url("${this.currentApp.background}") rgba(255,255,255,.8)`;
......@@ -150,7 +150,7 @@ export class AppDetailComponent implements OnInit, OnChanges {
}
async install(targetApp: App, options: InstallOption, referencesInstall: { [id: string]: boolean }) {
$('#install-modal').modal('hide');
// $('#install-modal').modal('hide');
try {
await this.appsService.install(targetApp, options);
......@@ -210,9 +210,8 @@ export class AppDetailComponent implements OnInit, OnChanges {
await this.appsService.runApp(app, 'roll');
}
async importGame(targetApp: App, option: InstallOption, referencesInstall: { [id: string]: boolean }) {
$('#import-modal').modal('hide');
let dir = path.dirname(this.import_path);
async importGame(origin: string, targetApp: App, option: InstallOption, referencesInstall: { [id: string]: boolean }) {
let dir = path.dirname(origin);
// TODO: 执行依赖和references安装
try {
await this.appsService.importApp(targetApp, dir, option);
......@@ -248,57 +247,57 @@ export class AppDetailComponent implements OnInit, OnChanges {
clipboard.writeText(text);
}
async selectImport(app: App) {
let main = app.actions.get('main');
if (!main) {
return;
}
if (!main.execute) {
return;
}
let filename = main.execute.split('/')[0];
let extname = path.extname(filename).slice(1);
// let remote = require('electron').remote
let filePaths = await new Promise<string[]>((resolve, reject) => {
remote.dialog.showOpenDialog({
filters: [{name: filename, extensions: [extname]}],
properties: ['openFile']
}, resolve);
});
if (filePaths && filePaths[0]) {
this.import_path = filePaths[0];
}
}
// async selectImport(app: App) {
// let main = app.actions.get('main');
// if (!main) {
// return;
// }
// if (!main.execute) {
// return;
// }
// let filename = main.execute.split('/')[0];
// let extname = path.extname(filename).slice(1);
//
// // let remote = require('electron').remote
// let filePaths = await new Promise<string[]>((resolve, reject) => {
// remote.dialog.showOpenDialog({
// filters: [{name: filename, extensions: [extname]}],
// properties: ['openFile']
// }, resolve);
// });
//
// if (filePaths && filePaths[0]) {
// this.import_path = filePaths[0];
// }
//
// }
onPoints(points: Points) {
this.points = points;
}
async purchase() {
this.creating_order = true;
let data = new URLSearchParams();
data.set('app_id', this.currentApp.id);
data.set('user_id', this.loginService.user.email);
data.set('currency', 'cny');
data.set('payment', this.payment);
try {
let {url} = await this.http.post('https://sapi.moecube.com:444/orders', data).map(response => response.json()).toPromise();
open(url);
$('#purchase-modal').modal('hide');
$('#purchase-modal-alipay').modal('show');
} catch (error) {
console.log(error);
if (error.status === 409) {
alert('卖完了 /\\');
} else if (error.status === 403) {
alert('已经购买过 /\\');
} else {
alert('出错了 /\\');
}
}
this.creating_order = false;
}
// async purchase() {
// this.creating_order = true;
// let data = new URLSearchParams();
// data.set('app_id', this.currentApp.id);
// data.set('user_id', this.loginService.user.email);
// data.set('currency', 'cny');
// data.set('payment', this.payment);
// try {
// let {url} = await this.http.post('https://sapi.moecube.com:444/orders', data).map(response => response.json()).toPromise();
// open(url);
// $('#purchase-modal').modal('hide');
// $('#purchase-modal-alipay').modal('show');
// } catch (error) {
// console.log(error);
// if (error.status === 409) {
// alert('卖完了 /\\');
// } else if (error.status === 403) {
// alert('已经购买过 /\\');
// } else {
// alert('出错了 /\\');
// }
// }
// this.creating_order = false;
// }
}
<!-- Begin page content -->
<div #nav id="nav-wrapper" class="resize-wrapper resize-right">
<nav id="apps" *ngIf="apps" class="bg-faded sidebar scroll">
<div id="search" class="input-group">
<i class="fa fa-search input-group-addon search" id="basic-addon1"></i>
<input i18n-placeholder #search id="search-input" type="text" class="form-control search" placeholder="搜索游戏" aria-describedby="basic-addon1">
</div>
<!-- <div id="search" class="input-group">-->
<!-- <i class="fa fa-search input-group-addon search" id="basic-addon1"></i>-->
<!-- <input i18n-placeholder #search id="search-input" type="text" class="form-control search" placeholder="搜索游戏" aria-describedby="basic-addon1">-->
<!-- </div>-->
<span i18n *ngIf="grouped_apps.installed">已安装</span>
<ul *ngIf="grouped_apps.installed" class="nav nav-pills flex-column">
......
<nav id="navbar" class="navbar navbar-toggleable-md navbar-light">
<header id="navbar" class="navbar navbar-toggleable-md navbar-light">
<a id="navbar-brand" class="navbar-brand" href="#">
<img src="images/icon.ico" /> MyCard
</a>
<ul class="navbar-nav mr-auto">
<ul class="nav me-auto">
<li *ngIf="!loginService.logged_in" class="nav-item active">
<a i18n class="nav-link" href="#">登录</a>
</li>
......@@ -26,16 +26,16 @@
</ul>
<div id="navbar-right">
<div id="update-status">
<i #error [hidden]="update_status != 'error'" (click)="update_retry()" class="fa fa-exclamation-circle" data-toggle="tooltip" i18n-title title="更新出错,点击重试"></i>
<i #checking_for_update [hidden]="update_status != 'checking-for-update'" class="fa fa-spinner fa-pulse fa-spin" data-toggle="tooltip" i18n-title title="正在检查更新"></i>
<i #update_available [hidden]="update_status != 'update-available'" class="fa fa-refresh fa-spin" data-toggle="tooltip" i18n-title title="正在下载更新"></i>
<i #update_downloaded [hidden]="update_status != 'update-downloaded'" (click)="update_install()" class="fa fa-angle-double-up" data-toggle="tooltip" i18n-title title="下载更新完成,点击安装"></i>
<i #error [hidden]="update_status != 'error'" (click)="update_retry()" class="fa fa-exclamation-circle" data-bs-toggle="tooltip" i18n-title title="更新出错,点击重试"></i>
<i #checking_for_update [hidden]="update_status != 'checking-for-update'" class="fa fa-spinner fa-pulse fa-spin" data-bs-toggle="tooltip" i18n-title title="正在检查更新"></i>
<i #update_available [hidden]="update_status != 'update-available'" class="fa fa-refresh fa-spin" data-bs-toggle="tooltip" i18n-title title="正在下载更新"></i>
<i #update_downloaded [hidden]="update_status != 'update-downloaded'" (click)="update_install()" class="fa fa-angle-double-up" data-bs-toggle="tooltip" i18n-title title="下载更新完成,点击安装"></i>
</div>
<div id="user" *ngIf="loginService.logged_in">
<a href="#" class="profile"><img id="avatar" [src]="loginService.user.avatar_url" alt="image"></a>
<a href="#" class="profile item" id="username">{{loginService.user.username}}</a>
<i i18n (click)="loginService.logout()" class="fa fa-sign-out item-icon" aria-hidden="true" i18n-title title="切换用户"></i>
<i i18n data-toggle="modal" data-target="#settings-modal" class="fa fa-cog item-icon" aria-hidden="true" i18n-title title="设置"></i>
<i i18n data-bs-toggle="modal" data-bs-target="#settings-modal" class="fa fa-cog item-icon" aria-hidden="true" i18n-title title="设置"></i>
</div>
<div id="border">|</div>
<div id="window-buttons">
......@@ -45,7 +45,7 @@
<i i18n (click)="currentWindow.hide()" class="fa fa-times" i18n-title title="关闭"></i>
</div>
</div>
</nav>
</header>
<login class="page" *ngIf="!loginService.logged_in"></login>
<store class="page" *ngIf="loginService.logged_in" [hidden]="currentPage != 'store'"></store>
<lobby class="page" *ngIf="loginService.logged_in" [hidden]="currentPage != 'lobby'"></lobby>
......@@ -59,9 +59,7 @@
<div class="modal-content">
<div class="modal-header">
<h5 i18n class="modal-title" id="myModalLabel">MyCard 设置</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<form (submit)="submit()">
<div class="modal-body">
......@@ -78,8 +76,8 @@
</div>
</div>
<div class="modal-footer">
<button i18n type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
<button i18n type="submit" class="btn btn-primary">确定</button>
<button i18n type="button" class="btn btn-secondary" data-bs-dismiss="modal">取消</button>
<button i18n type="submit" class="btn btn-primary" data-bs-dismiss="modal">确定</button>
</div>
</form>
</div>
......
import {ChangeDetectorRef, Component, ElementRef, OnInit, Renderer, ViewChild} from '@angular/core';
import 'bootstrap';
import {remote, shell} from 'electron';
import * as $ from 'jquery';
import * as Tether from 'tether';
import {LoginService} from './login.service';
import {SettingsService} from './settings.sevices';
window['Tether'] = Tether;
import 'bootstrap';
const autoUpdater: Electron.AutoUpdater = remote.getGlobal('autoUpdater');
const konami_code_logger: string[] = [];
......@@ -139,7 +137,6 @@ export class MyCardComponent implements OnInit {
remote.app.relaunch();
remote.app.quit();
}
$('#settings-modal').modal('hide');
}
//
......
<div id="network" *ngIf="currentApp.network && currentApp.network.protocol == 'maotama'">
<!--<button (click)="log(appsService)">test</button>-->
<div class="input-group input-group-sm">
<input *ngIf="appsService.connections.get(currentApp)" [value]="appsService.connections.get(currentApp).address || 'Loading...'" readonly type="text" class="form-control" title="address">
<div class="input-group-btn" style="flex-direction: row">
<button i18n *ngIf="!appsService.connections.get(currentApp)" [disabled]="!appsService.allReady(currentApp)" (click)="appsService.network(currentApp, currentApp.network.servers[0])" type="button" class="btn btn-secondary btn-sm">联机</button>
<button i18n *ngIf="appsService.connections.get(currentApp)" (click)="copy(appsService.connections.get(currentApp).address)" [disabled]="!appsService.connections.get(currentApp).address" type="button" class="btn btn-secondary btn-sm">复制</button>
<button type="button" class="btn btn-sm btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
<button i18n *ngIf="!appsService.connections.get(currentApp)" [disabled]="!appsService.allReady(currentApp)" (click)="appsService.network(currentApp, currentApp.network.servers[0])" type="button" class="btn btn-outline-secondary btn-sm">联机</button>
<button i18n *ngIf="appsService.connections.get(currentApp)" (click)="copy(appsService.connections.get(currentApp).address)" [disabled]="!appsService.connections.get(currentApp).address" type="button" class="btn btn-outline-secondary btn-sm">复制</button>
<button type="button" class="btn btn-sm btn-outline-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown"></button>
<div class="dropdown-menu" [class.dropdown-menu-right]="appsService.connections.get(currentApp)">
<h6 i18n class="dropdown-header">选择服务器</h6>
<a *ngFor="let server of currentApp.network.servers" (click)="appsService.network(currentApp, server)" class="dropdown-item" href="#">{{server.id}}</a>
......@@ -17,5 +11,4 @@
<a i18n *ngIf="appsService.connections.get(currentApp)" (click)="appsService.connections.get(currentApp).connection.close()" class="dropdown-item" href="#">取消</a>
</div>
</div>
</div>
</div>
import {clipboard} from 'electron';
import {Component, Injectable, Input} from '@angular/core';
import {AppsService} from './apps.service';
import {App} from './app';
......@@ -14,6 +15,10 @@ export class NetworkComponent {
currentApp: App;
constructor(private appsService: AppsService) {
console.log( 'constructor' );
console.log('constructor');
}
copy(text: string) {
clipboard.writeText(text);
}
}
This diff is collapsed.
......@@ -13,9 +13,10 @@ import {App} from './app';
import {AppsService} from './apps.service';
import {LoginService} from './login.service';
import {SettingsService} from './settings.sevices';
import Timer = NodeJS.Timer;
import * as _ from 'lodash';
import * as fg from 'fast-glob';
import WillNavigateEvent = Electron.WillNavigateEvent;
import _ = require('lodash');
import Timer = NodeJS.Timer;
interface SystemConf {
use_d3d: string;
......@@ -125,6 +126,7 @@ export class YGOProComponent implements OnInit, OnDestroy {
@Output()
points: EventEmitter<Points> = new EventEmitter();
decks: string[] = [];
decks_grouped: [string, string[]][];
replays: string[] = [];
current_deck: string;
system_conf: string;
......@@ -136,28 +138,19 @@ export class YGOProComponent implements OnInit, OnDestroy {
@ViewChild('youtube')
youtube: ElementRef;
// points: Points;
get windbot() {
return this.currentServer.windbot;
}
// points: Points;
servers: Server[];
selectableServers: Server[];
// selectingServerId: string;
currentServer: Server;
// tslint:disable-next-line:member-ordering
rooms_loading = true;
/*reloadCurrentServer() {
this.currentServer = this.servers.find(s => s.id === this.selectingServerId);
}*/
// tslint:disable-next-line:member-ordering
rooms_loading = true;
lastDeckFormat: RegExp;
default_options: Options = {
mode: 1,
rule: this.settingsService.getLocale().startsWith('zh') ? 0 : 1,
......@@ -172,12 +165,9 @@ export class YGOProComponent implements OnInit, OnDestroy {
time_limit: 180,
auto_death: false
};
room: Room = {title: this.loginService.user.username + '的房间', options: Object.assign({}, this.default_options)};
rooms: Room[] = [];
rooms_show: Room[];
connections: WebSocket[] = [];
replay_connections: WebSocket[] = [];
replay_rooms: Room[] = [];
......@@ -190,13 +180,11 @@ export class YGOProComponent implements OnInit, OnDestroy {
tag: true,
windbot: false
};
matching: ISubscription | undefined;
matching_arena: string | undefined;
match_time: string;
match_cancelable: boolean;
match_interval: Timer | undefined;
join_password: string;
host_password = (this.loginService.user.external_id ^ 0x54321).toString();
......@@ -242,6 +230,10 @@ export class YGOProComponent implements OnInit, OnDestroy {
}
}
get windbot() {
return this.currentServer.windbot;
}
refresh_rooms() {
this.rooms_show = this.rooms.filter((room) => room.server === this.currentServer);
}
......@@ -416,7 +408,7 @@ export class YGOProComponent implements OnInit, OnDestroy {
let watchDropdownMenu = $('#watch-filter');
watchDropdownMenu.on("change", "input[type='checkbox']", (event) => {
watchDropdownMenu.on('change', 'input[type=\'checkbox\']', (event) => {
// $(event.target).closest("label").toggleClass("active", (<HTMLInputElement> event.target).checked);
this.refresh_replay_rooms();
});
......@@ -440,6 +432,7 @@ export class YGOProComponent implements OnInit, OnDestroy {
async refresh(init?: boolean) {
this.decks = await this.get_decks();
this.decks_grouped = this.deckGroup();
if (this.lastDeckFormat) {
const systemConfString = await this.load_system_conf();
......@@ -484,37 +477,17 @@ export class YGOProComponent implements OnInit, OnDestroy {
async get_decks(): Promise<string[]> {
try {
/*
const deckPath = this.app.ygoproDeckPath;
let result: string[] = [];
const files: string[] = await fs.readdir(deckPath);
for (const file of files) {
if (file.startsWith('.git')) { // fuck
continue;
}
if (path.extname(file) === '.ydk') {
result.push(path.basename(file, '.ydk'));
} else {
const fullPath = path.join(deckPath, file);
const stat = await fs.stat(fullPath);
if (stat.isDirectory()) {
const innerDecks = (await fs.readdir(fullPath))
.filter((iFile) => path.extname(iFile) === '.ydk')
.map((iFile) => path.join(file, path.basename(iFile, '.ydk')));
result = result.concat(innerDecks);
}
}
}
return result;
*/
let files: string[] = await fs.readdir(this.app.ygoproDeckPath);
return files.filter(file => path.extname(file) === '.ydk').map(file => path.basename(file, '.ydk'));
return fg.sync('**/*.ydk', {cwd: this.app.ygoproDeckPath});
} catch (error) {
console.error(`Load deck fail: ${error.toString()}`);
return [];
}
}
deckGroup() {
return Object.entries(_.mapValues(_.groupBy(this.decks, p => path.dirname(p)), g => g.map(p => path.basename(p, '.ydk'))));
}
async get_replays(): Promise<string[]> {
try {
let files: string[] = await fs.readdir(this.app.ygoproReplayPath);
......@@ -568,7 +541,7 @@ export class YGOProComponent implements OnInit, OnDestroy {
// console.log(`Loading system conf from ${this.system_conf}`)
let data = await fs.readFile(this.system_conf, {encoding: 'utf-8'});
return data;
} catch(e) {
} catch (e) {
return null;
}
};
......@@ -598,7 +571,7 @@ export class YGOProComponent implements OnInit, OnDestroy {
system_conf.lastdeck = deck;
await this.save_system_conf(system_conf);*/
// return this.start_game(['-d', deck]);
return this.start_game('deck', { deck })
return this.start_game('deck', {deck})
}
async watch_replay(replay: string) {
......@@ -606,7 +579,7 @@ export class YGOProComponent implements OnInit, OnDestroy {
await this.fix_fonts(system_conf);
await this.save_system_conf(system_conf);*/
// return this.start_game(['-r', path.join('replay', replay + '.yrp')]);
return this.start_game('replay', { replay: path.join(this.app.ygoproReplayPath, `${replay}.yrp`) });
return this.start_game('replay', {replay: path.join(this.app.ygoproReplayPath, `${replay}.yrp`)});
}
join_windbot(name?: string) {
......@@ -899,7 +872,7 @@ export class YGOProComponent implements OnInit, OnDestroy {
avatar_fallback(event) {
if (!event.target.getAttribute('fallback')) {
event.target.src = "images/noavatar.png";
event.target.src = 'images/noavatar.png';
event.target.setAttribute('fallback', true);
}
}
......
This diff is collapsed.
......@@ -75,13 +75,11 @@ System.config({
"aria2": "@node/aria2",
"electron-sudo": "@node/electron-sudo",
'fs-extra': '@node/fs-extra',
'fast-glob': '@node/fast-glob',
'jquery': 'npm:jquery/dist/jquery.min.js',
'tether': 'npm:tether/dist/js/tether.min.js',
'bootstrap': 'npm:bootstrap/dist/js/bootstrap.min.js',
'bootstrap': 'npm:bootstrap/dist/js/bootstrap.bundle.min.js',
'reconnecting-websocket': 'npm:reconnecting-websocket/dist/index.js',
'popper.js': 'npm:popper.js/dist/umd/popper.min.js',
// 'typeahead.js': '@node/typeahead.js'
'raven-js': 'npm:raven-js',
'strophe.js': 'npm:strophe.js/dist/strophe.umd.js',
......@@ -105,12 +103,12 @@ System.config({
main: 'dist/raven.js'
}
},
meta: {
bootstrap: {
globals: {
jQuery: 'jquery',
Tether: 'tether'
}
}
}
// meta: {
// bootstrap: {
// globals: {
// jQuery: 'jquery',
// Tether: 'tether'
// }
// }
// }
});
......@@ -13,10 +13,11 @@
],
"suppressImplicitAnyIndexErrors": true,
"strict": false,
"skipLibCheck": true
"skipLibCheck": true,
"skipDefaultLibCheck": true
},
"exclude": [
"node_modules/*",
"node_modules",
"**/*-aot.ts"
]
}
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