Commit 92c66884 authored by 神楽坂玲奈's avatar 神楽坂玲奈

Merge branch 'v3' of github.com:mycard/mycard into v3

parents fb3e4ac2 70650f20
...@@ -20,13 +20,13 @@ ...@@ -20,13 +20,13 @@
<!--应用ready--> <!--应用ready-->
<div class="actions" *ngIf="currentApp.isReady() && (currentApp.id != 'ygopro')"> <div class="actions" *ngIf="currentApp.isReady() && (currentApp.id != 'ygopro')">
<button i18n *ngIf="currentApp.runable()" (click)="runApp(currentApp)" type="button" class="btn btn-primary">运行</button> <button i18n *ngIf="currentApp.runnable()" (click)="runApp(currentApp)" [disabled]="!appsService.allReady(currentApp)" type="button" class="btn btn-primary">运行</button>
<button i18n *ngIf="currentApp.runable() && currentApp.actions.get('custom')" (click)="custom(currentApp)" type="button" class="btn btn-secondary">设置</button> <button i18n *ngIf="currentApp.runnable() && currentApp.actions.get('custom')" [disabled]="!appsService.allReady(currentApp)" (click)="custom(currentApp)" type="button" class="btn btn-secondary">设置</button>
<div id="network" *ngIf="currentApp.network && currentApp.network.protocol == 'maotama'"> <div id="network" *ngIf="currentApp.network && currentApp.network.protocol == 'maotama'">
<div class="input-group"> <div class="input-group">
<input *ngIf="appsService.connections.get(currentApp)" [value]="appsService.connections.get(currentApp).address || 'Loading...'" readonly type="text" class="form-control" title="address"> <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"> <div class="input-group-btn">
<button i18n *ngIf="!appsService.connections.get(currentApp)" (click)="appsService.network(currentApp, currentApp.network.servers[0])" type="button" class="btn btn-secondary">联机</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-secondary">联机</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">复制</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">复制</button>
<button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" style="height: 38px;"></button> <button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" style="height: 38px;"></button>
<div class="dropdown-menu" [class.dropdown-menu-right]="appsService.connections.get(currentApp)"> <div class="dropdown-menu" [class.dropdown-menu-right]="appsService.connections.get(currentApp)">
...@@ -61,10 +61,10 @@ ...@@ -61,10 +61,10 @@
<th scope="row">{{i + 1}}</th> <th scope="row">{{i + 1}}</th>
<td>{{mod.name}}</td> <td>{{mod.name}}</td>
<td *ngIf="mod.isReady()"> <td *ngIf="mod.isReady()">
<button i18n type="button" (click)="uninstall(mod)" class="btn btn-danger btn-sm">卸载</button> <button i18n type="button" [disabled]="mod.isInstalled()&&!appsService.allReady(mod)" (click)="uninstall(mod)" class="btn btn-danger btn-sm">卸载</button>
</td> </td>
<td *ngIf="!mod.isInstalled()"> <td *ngIf="!mod.isInstalled()">
<button i18n (click)="installMod(mod)" type="button" *ngIf="!mod.isInstalled()" class="btn btn-primary btn-sm">安装</button> <button i18n (click)="installMod(mod)" [disabled]="mod.isInstalled()&&!appsService.allReady(mod)" type="button" *ngIf="!mod.isInstalled()" class="btn btn-primary btn-sm">安装</button>
</td> </td>
<td *ngIf="mod.isInstalled()&&!mod.isReady()"> <td *ngIf="mod.isInstalled()&&!mod.isReady()">
<progress class="progress progress-striped progress-animated" value="{{mod.status.progress}}" max="{{mod.status.total}}"></progress> <progress class="progress progress-striped progress-animated" value="{{mod.status.progress}}" max="{{mod.status.total}}"></progress>
...@@ -75,9 +75,9 @@ ...@@ -75,9 +75,9 @@
</table> </table>
</div> </div>
<h2 i18n>本地文件</h2> <h2 i18n>本地文件</h2>
<button i18n (click)="appsService.browse(currentApp)" type="button" class="btn btn-secondary">浏览本地文件</button> <button i18n (click)="appsService.browse(currentApp)" [disabled]="!appsService.allReady(currentApp)" type="button" class="btn btn-secondary">浏览本地文件</button>
<!--<button i18n type="button" (click)="verifyFiles(currentApp)" class="btn btn-secondary">校验完整性</button>--> <!--<button i18n type="button" (click)="verifyFiles(currentApp)" class="btn btn-secondary">校验完整性</button>-->
<button i18n (click)="uninstall(currentApp)" type="button" class="btn btn-secondary">卸载</button> <button i18n (click)="uninstall(currentApp)" [disabled]="!appsService.allReady(currentApp)" type="button" class="btn btn-secondary">卸载</button>
</div> </div>
<!--安装modal--> <!--安装modal-->
......
...@@ -115,7 +115,7 @@ export class App { ...@@ -115,7 +115,7 @@ export class App {
return this.status.status === "uninstalling"; return this.status.status === "uninstalling";
} }
runable(): boolean { runnable(): boolean {
return [Category.game].includes(this.category); return [Category.game].includes(this.category);
} }
......
This diff is collapsed.
...@@ -31,10 +31,10 @@ export class LobbyComponent implements OnInit { ...@@ -31,10 +31,10 @@ export class LobbyComponent implements OnInit {
async ngOnInit() { async ngOnInit() {
this.apps = await this.appsService.loadApps(); this.apps = await this.appsService.loadApps();
await this.appsService.migrate(); await this.appsService.migrate();
for(let app of this.apps.values()) { for (let app of this.apps.values()) {
this.appsService.update(app); this.appsService.update(app);
} }
this.chooseApp(Array.from(this.apps.values()).find(app => app.isInstalled()) || this.apps.get("ygopro")!); this.chooseApp(this.appsService.lastVisted || this.apps.get("ygopro")!);
// 初始化聊天室 // 初始化聊天室
let url = new URL('candy/index.html', location.href); let url = new URL('candy/index.html', location.href);
...@@ -42,7 +42,7 @@ export class LobbyComponent implements OnInit { ...@@ -42,7 +42,7 @@ export class LobbyComponent implements OnInit {
params.set('jid', this.loginService.user.username + '@mycard.moe'); params.set('jid', this.loginService.user.username + '@mycard.moe');
params.set('password', this.loginService.user.external_id.toString()); params.set('password', this.loginService.user.external_id.toString());
params.set('nickname', this.loginService.user.username); params.set('nickname', this.loginService.user.username);
switch(this.settingsService.getLocale()){ switch (this.settingsService.getLocale()) {
case 'zh-CN': case 'zh-CN':
params.set('language', 'cn'); params.set('language', 'cn');
break; break;
...@@ -57,6 +57,7 @@ export class LobbyComponent implements OnInit { ...@@ -57,6 +57,7 @@ export class LobbyComponent implements OnInit {
chooseApp(app: App) { chooseApp(app: App) {
this.currentApp = app; this.currentApp = app;
this.appsService.lastVisted = app;
if (this.candy && this.currentApp.conference) { if (this.candy && this.currentApp.conference) {
(<WebViewElement>this.candy.nativeElement).send('join', this.currentApp.conference + '@conference.mycard.moe'); (<WebViewElement>this.candy.nativeElement).send('join', this.currentApp.conference + '@conference.mycard.moe');
} }
......
...@@ -5,19 +5,19 @@ ...@@ -5,19 +5,19 @@
<option *ngFor="let deck of decks" [ngValue]="deck">{{deck}}</option> <option *ngFor="let deck of decks" [ngValue]="deck">{{deck}}</option>
</select> </select>
</div> </div>
<button i18n type="submit" class="btn btn-secondary" (click)="edit_deck(current_deck)">编辑</button> <button i18n [disabled]="!appsService.allReady(app)" type="submit" class="btn btn-secondary" (click)="edit_deck(current_deck)">编辑</button>
<button i18n type="submit" (click)="delete_deck(current_deck)" class="btn btn-secondary">删除</button> <button i18n [disabled]="!appsService.allReady(app)" type="submit" (click)="delete_deck(current_deck)" class="btn btn-secondary">删除</button>
<button i18n types="submit" (click)="refresh()" class="btn btn-secondary">刷新</button> <button i18n [disabled]="!appsService.allReady(app)" type="submit" (click)="refresh()" class="btn btn-secondary">刷新</button>
</form> </form>
<div class="actions"> <div class="actions">
<button i18n (click)="request_match('athletic')" *ngIf="matching_arena != 'athletic'" [disabled]="matching" type="button" class="btn btn-primary">竞技匹配</button> <button i18n [disabled]="matching||!appsService.allReady(app)" (click)="request_match('athletic')" *ngIf="matching_arena != 'athletic'" type="button" class="btn btn-primary">竞技匹配</button>
<button i18n (click)="cancel_match()" *ngIf="matching_arena == 'athletic'" type="button" class="btn btn-primary">取消等待</button> <button i18n [disabled]="!appsService.allReady(app)" (click)="cancel_match()" *ngIf="matching_arena == 'athletic'" type="button" class="btn btn-primary">取消等待</button>
<button i18n (click)="request_match('entertain')" *ngIf="matching_arena != 'entertain'" [disabled]="matching" type="button" class="btn btn-secondary">娱乐匹配</button> <button i18n [disabled]="matching||!appsService.allReady(app)" (click)="request_match('entertain')" *ngIf="matching_arena != 'entertain'" type="button" class="btn btn-secondary">娱乐匹配</button>
<button i18n (click)="cancel_match()" *ngIf="matching_arena == 'entertain'" type="button" class="btn btn-secondary">取消等待</button> <button i18n [disabled]="!appsService.allReady(app)" (click)="cancel_match()" *ngIf="matching_arena == 'entertain'" type="button" class="btn btn-secondary">取消等待</button>
<button i18n [disabled]="matching" type="button" class="btn btn-secondary" data-toggle="modal" data-target="#game-create-modal">创建房间</button> <button i18n [disabled]="matching||!appsService.allReady(app)" type="button" class="btn btn-secondary" data-toggle="modal" data-target="#game-create-modal">创建房间</button>
<button i18n [disabled]="matching" type="button" class="btn btn-secondary" data-toggle="modal" data-target="#game-list-modal">房间列表</button> <button i18n [disabled]="matching||!appsService.allReady(app)" type="button" class="btn btn-secondary" data-toggle="modal" data-target="#game-list-modal">房间列表</button>
<button i18n type="button" class="btn btn-secondary" data-toggle="modal" data-target="#game-create-windbot">单人模式</button> <button i18n [disabled]="!appsService.allReady(app)" type="button" class="btn btn-secondary" data-toggle="modal" data-target="#game-create-windbot">单人模式</button>
</div> </div>
<div class="modal fade" id="game-create-windbot" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal fade" id="game-create-windbot" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
......
...@@ -15,6 +15,7 @@ import {Http, Headers, URLSearchParams} from "@angular/http"; ...@@ -15,6 +15,7 @@ import {Http, Headers, URLSearchParams} from "@angular/http";
import "rxjs/Rx"; import "rxjs/Rx";
import {ISubscription} from "rxjs/Subscription"; import {ISubscription} from "rxjs/Subscription";
import {SettingsService} from "./settings.sevices"; import {SettingsService} from "./settings.sevices";
import {AppsService} from "./apps.service";
declare const $: any; declare const $: any;
...@@ -108,7 +109,7 @@ export class YGOProComponent implements OnInit { ...@@ -108,7 +109,7 @@ export class YGOProComponent implements OnInit {
connections: WebSocket[] = []; connections: WebSocket[] = [];
constructor(private http: Http, private settingsService: SettingsService, private loginService: LoginService, private ref: ChangeDetectorRef) { constructor(private http: Http, private appsService: AppsService, private loginService: LoginService, private ref: ChangeDetectorRef) {
switch (process.platform) { switch (process.platform) {
case 'darwin': case 'darwin':
this.numfont = ['/System/Library/Fonts/SFNSTextCondensed-Bold.otf']; this.numfont = ['/System/Library/Fonts/SFNSTextCondensed-Bold.otf'];
......
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