Commit c1251714 authored by 神楽坂玲奈's avatar 神楽坂玲奈

fix start

parent cdcf2540
...@@ -16,13 +16,13 @@ ...@@ -16,13 +16,13 @@
</progress> </progress>
</div> </div>
</div> </div>
<div *ngIf="isInstalled && (appsService.currentApp != 'ygopro')"> <div *ngIf="isInstalled && (appsService.currentApp.id != 'ygopro')">
<button (click)="startApp(appsService.currentApp)" type="button" class="btn btn-primary">运行</button> <button (click)="startApp(appsService.currentApp)" type="button" class="btn btn-primary">运行</button>
<button type="button" data-toggle="modal" data-target="#settings-modal" class="btn btn-secondary">设置</button> <button type="button" data-toggle="modal" data-target="#settings-modal" class="btn btn-secondary">设置</button>
<!--<button (click)="appsService.browse(appsService.currentApp)" type="button" class="btn btn-secondary">游览本地文件</button>--> <!--<button (click)="appsService.browse(appsService.currentApp)" type="button" class="btn btn-secondary">游览本地文件</button>-->
<button type="button" class="btn btn-secondary">联机</button> <button type="button" class="btn btn-secondary">联机</button>
</div> </div>
<ygopro *ngIf="isInstalled && (appsService.currentApp == 'ygopro')"></ygopro> <ygopro *ngIf="isInstalled && (appsService.currentApp.id == 'ygopro')"></ygopro>
<br> <br>
......
...@@ -129,19 +129,19 @@ export class AppDetailComponent implements OnInit { ...@@ -129,19 +129,19 @@ export class AppDetailComponent implements OnInit {
return dir[0]; return dir[0];
} }
startApp(id) { startApp(app) {
let execute = this.path.join(this.appsService.searchApp(id).local.path, this.appsService.searchApp(id).actions[process.platform]["main"].execute); let execute = this.path.join(app.local.path, app.actions[process.platform]["main"].execute);
let args = this.appsService.searchApp(id).actions[process.platform]["main"].args; let args = app.actions[process.platform]["main"].args;
let env = this.appsService.searchApp(id).actions[process.platform]["main"].env; let env = app.actions[process.platform]["main"].env;
let opt = { let opt = {
cwd: this.appsService.searchApp(id).local.path, cwd: app.local.path,
env: env env: env
}; };
let open = ''; let open = '';
let openId = this.appsService.searchApp(id).actions[process.platform]["main"].open; let openId = app.actions[process.platform]["main"].open;
if (openId) { if (openId) {
this.appsService.searchApp(openId).actions[process.platform]["main"].execute; //this.appsService.searchApp(openId).actions[process.platform]["main"].execute;
if (this.checkInstall(openId)) { if (this.checkInstall(openId)) {
open = this.path.join(this.appsService.searchApp(openId).local.path, this.appsService.searchApp(openId).actions[process.platform]["main"].execute); open = this.path.join(this.appsService.searchApp(openId).local.path, this.appsService.searchApp(openId).actions[process.platform]["main"].execute);
args.push(execute); args.push(execute);
......
<span *ngIf="grouped_apps.installed.length">已安装</span> <span *ngIf="grouped_apps.installed">已安装</span>
<ul *ngIf="grouped_apps.installed" class="nav nav-sidebar"> <ul *ngIf="grouped_apps.installed" class="nav nav-sidebar">
<li *ngFor="let app of grouped_apps.installed" [class.active]="app===appsService.currentApp"> <li *ngFor="let app of grouped_apps.installed" [class.active]="app===appsService.currentApp">
<a (click)="chooseApp(app)" href="#">{{app.name}}</a> <a (click)="chooseApp(app)" href="#">{{app.name}}</a>
</li> </li>
</ul> </ul>
<span *ngIf="grouped_apps.yugioh.length">游戏王</span> <span *ngIf="grouped_apps.yugioh">游戏王</span>
<ul *ngIf="grouped_apps.yugioh" class="nav nav-sidebar"> <ul *ngIf="grouped_apps.yugioh" class="nav nav-sidebar">
<li *ngFor="let app of grouped_apps.yugioh" [class.active]="app===appsService.currentApp"> <li *ngFor="let app of grouped_apps.yugioh" [class.active]="app===appsService.currentApp">
<a (click)="chooseApp(app)" href="#">{{app.name}}</a> <a (click)="chooseApp(app)" href="#">{{app.name}}</a>
</li> </li>
</ul> </ul>
<span *ngIf="grouped_apps.touhou.length">东方 Project</span> <span *ngIf="grouped_apps.touhou">东方 Project</span>
<ul *ngIf="grouped_apps.touhou" class="nav nav-sidebar"> <ul *ngIf="grouped_apps.touhou" class="nav nav-sidebar">
<li *ngFor="let app of grouped_apps.touhou" [class.active]="app===appsService.currentApp"> <li *ngFor="let app of grouped_apps.touhou" [class.active]="app===appsService.currentApp">
<a (click)="chooseApp(app)" href="#">{{app.name}}</a> <a (click)="chooseApp(app)" href="#">{{app.name}}</a>
</li> </li>
</ul> </ul>
<span *ngIf="grouped_apps.touhou_pc98.length">东方旧作</span> <span *ngIf="grouped_apps.touhou_pc98">东方旧作</span>
<ul *ngIf="grouped_apps.touhou_pc98" class="nav nav-sidebar"> <ul *ngIf="grouped_apps.touhou_pc98" class="nav nav-sidebar">
<li *ngFor="let app of grouped_apps.touhou_pc98" [class.active]="app===appsService.currentApp"> <li *ngFor="let app of grouped_apps.touhou_pc98" [class.active]="app===appsService.currentApp">
<a (click)="chooseApp(app)" href="#">{{app.name}}</a> <a (click)="chooseApp(app)" href="#">{{app.name}}</a>
......
...@@ -23,17 +23,19 @@ export class AppsComponent implements OnInit { ...@@ -23,17 +23,19 @@ export class AppsComponent implements OnInit {
get grouped_apps() { get grouped_apps() {
let contains = ["game", "music", "book"]; let contains = ["game", "music", "book"];
let apps = Array.from(this.appsService.allApps.values()); let apps = Array.from(this.appsService.allApps.values());
let result = {'installed': []}; let result = {};
for (let app of apps) { for (let app of apps) {
if (contains.includes(app.category)) { if (contains.includes(app.category)) {
let tag;
if (app.local) { if (app.local) {
result.installed.push(app) tag = 'installed';
} else { } else {
if (!result[app.tags[0]]) { tag = app.tags[0];
result[app.tags[0]] = []
}
result[app.tags[0]].push(app)
} }
if (!result[tag]) {
result[tag] = []
}
result[tag].push(app)
} }
} }
//console.log(result) //console.log(result)
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
</a> </a>
<a href="#forum" class="require-login profile item" id="username"></a> <a href="#forum" class="require-login profile item" id="username"></a>
<a (click)="loginService.logout()" href="#ygopro" id="logout" class="require-login item">切换账号</a> <a (click)="loginService.logout()" href="#ygopro" id="logout" class="require-login item">切换账号</a>
<a (click)="refresh()" href="#ygopro" id="refresh" class="item">刷新</a> <!--<a (click)="refresh()" href="#ygopro" id="refresh" class="item">刷新</a>-->
</div> </div>
<div id="window-buttons" [hidden]="platform == 'darwin'"> <div id="window-buttons" [hidden]="platform == 'darwin'">
<i id="minimize" class="fa fa-minus" aria-hidden="true"></i> <i id="minimize" class="fa fa-minus" aria-hidden="true"></i>
......
...@@ -13,7 +13,6 @@ const fs = System._nodeRequire('fs'); ...@@ -13,7 +13,6 @@ const fs = System._nodeRequire('fs');
const path = System._nodeRequire('path'); const path = System._nodeRequire('path');
const crypto = System._nodeRequire('crypto'); const crypto = System._nodeRequire('crypto');
const child_process = System._nodeRequire('child_process'); const child_process = System._nodeRequire('child_process');
//const Promise = System._nodeRequire('bluebird');
const ini = System._nodeRequire('ini'); const ini = System._nodeRequire('ini');
const electron = System._nodeRequire('electron'); const electron = System._nodeRequire('electron');
...@@ -111,7 +110,7 @@ export class YGOProComponent implements OnInit { ...@@ -111,7 +110,7 @@ export class YGOProComponent implements OnInit {
return new Promise((resolve, reject)=> { return new Promise((resolve, reject)=> {
fs.readdir(path.join(this.app.local.path, 'deck'), (error, files)=> { fs.readdir(path.join(this.app.local.path, 'deck'), (error, files)=> {
if (error) { if (error) {
reject(error) resolve([])
} else { } else {
resolve(files.filter(file=>path.extname(file) == ".ydk").map(file=>path.basename(file, '.ydk'))); resolve(files.filter(file=>path.extname(file) == ".ydk").map(file=>path.basename(file, '.ydk')));
} }
......
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