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

tags

parent 34dcca76
<span>已安装</span>
<ul class="nav nav-sidebar">
<span *ngIf="grouped_apps.installed">已安装</span>
<ul *ngIf="grouped_apps.installed" class="nav nav-sidebar">
<li *ngFor="let app of grouped_apps.installed" [class.active]="app.id==routingService.app">
<a (click)="selectApp(app.id)" href="#">{{app.name[app.locales[0]]}}</a>
</li>
</ul>
<span>未安装</span>
<ul class="nav nav-sidebar">
<li *ngFor="let app of grouped_apps.not_installed" [class.active]="app.id==routingService.app">
<span *ngIf="grouped_apps.yugioh">游戏王</span>
<ul *ngIf="grouped_apps.yugioh" class="nav nav-sidebar">
<li *ngFor="let app of grouped_apps.yugioh" [class.active]="app.id==routingService.app">
<a (click)="selectApp(app.id)" href="#">{{app.name[app.locales[0]]}}</a>
</li>
</ul>
<!--<ul class="nav nav-sidebar">
<li><a href="">Nav item</a></li>
<li><a href="">Nav item again</a></li>
<li><a href="">One more nav</a></li>
<li><a href="">Another nav item</a></li>
<li><a href="">More navigation</a></li>
<span *ngIf="grouped_apps.touhou">东方 Project</span>
<ul *ngIf="grouped_apps.touhou" class="nav nav-sidebar">
<li *ngFor="let app of grouped_apps.touhou" [class.active]="app.id==routingService.app">
<a (click)="selectApp(app.id)" href="#">{{app.name[app.locales[0]]}}</a>
</li>
</ul>
<ul class="nav nav-sidebar">
<li><a href="">Nav item again</a></li>
<li><a href="">One more nav</a></li>
<li><a href="">Another nav item</a></li>
</ul>-->
<!--<div class="list-group">
</div>-->
\ No newline at end of file
<span *ngIf="grouped_apps.touhou_pc98">东方旧作</span>
<ul *ngIf="grouped_apps.touhou_pc98" class="nav nav-sidebar">
<li *ngFor="let app of grouped_apps.touhou_pc98" [class.active]="app.id==routingService.app">
<a (click)="selectApp(app.id)" href="#">{{app.name[app.locales[0]]}}</a>
</li>
</ul>
\ No newline at end of file
......@@ -42,16 +42,18 @@ export class AppsComponent {
}
get grouped_apps() {
let result = {'installed': [], 'not_installed': []};
let result = {'installed': []};
for (let app of this.apps) {
if (app.local) {
result.installed.push(app)
} else {
result.not_installed.push(app)
if (!result[app.tags[0]]) {
result[app.tags[0]] = []
}
result[app.tags[0]].push(app)
}
}
//console.log(result)
return result
}
}
}
\ No newline at end of file
.float-left {
float: left;
}
\ No newline at end of file
......@@ -53,19 +53,19 @@
</button>
<h4 class="modal-title" id="myModalLabel">创建房间</h4>
</div>
<form id="game-create">
<form id="game-create" (submit)="create_room(room)">
<div class="modal-body">
<div class="form-group row">
<label for="game-create-title" class="col-sm-2 form-control-label">游戏标题</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="game-create-title" name="title">
<input type="text" class="form-control" id="game-create-title" name="title" [(ngModel)]="room.title">
</div>
</div>
<div class="form-group row">
<label for="game-create-rule" class="col-sm-2 form-control-label">卡片允许</label>
<div class="col-sm-10">
<select class="form-control" id="game-create-rule" name="rule">
<option value="0" selected>OCG</option>
<select class="form-control" id="game-create-rule" name="rule" [(ngModel)]="room.rule">
<option value="0">OCG</option>
<option value="1">TCG</option>
<option value="2">OCG & TCG</option>
<option value="3">专有卡禁止</option>
......@@ -75,22 +75,22 @@
<div class="form-group row">
<label for="game-create-mode" class="col-sm-2 form-control-label">决斗模式</label>
<div class="col-sm-10">
<select class="form-control" id="game-create-mode" name="mode">
<select class="form-control" id="game-create-mode" name="mode" [(ngModel)]="room.mode">
<option value="0">单局模式</option>
<option value="1" selected>比赛模式</option>
<option value="1">比赛模式</option>
<option value="2">TAG</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 form-control-label">额外选项</label>
<div class="col-sm-4">
<div class="col-sm-5">
<div class="row">
<label for="game-create-start-lp" class="col-sm-6 form-control-label">初始 LP</label>
<div class="col-sm-6">
<input name="start_lp" type="number" value="8000" min="1" max="65536"
class="form-control form-control-sm game-create-extra"
id="game-create-start-lp">
id="game-create-start-lp" [(ngModel)]="room.start_lp">
</div>
</div>
<div class="row">
......@@ -98,7 +98,7 @@
<div class="col-sm-6">
<input name="start_hand" type="number" value="5" min="0" max="16"
class="form-control form-control-sm game-create-extra"
id="game-create-start-hand">
id="game-create-start-hand" [(ngModel)]="room.start_hand">
</div>
</div>
<div class="row">
......@@ -106,29 +106,29 @@
<div class="col-sm-6">
<input name="draw_count" type="number" value="1" min="0" max="16"
class="form-control form-control-sm game-create-extra"
id="game-create-draw-count">
id="game-create-draw-count" [(ngModel)]="room.draw_count">
</div>
</div>
</div>
<div class="col-sm-6">
<div class="col-sm-5">
<div class="checkbox">
<label>
<input name="enable_priority" type="checkbox">允许启动效果优先权
<input name="enable_priority" type="checkbox" [(ngModel)]="room.enable_priority">允许启动效果优先权
</label>
</div>
<div class="checkbox">
<label>
<input name="no_check_deck" type="checkbox">不检查卡组
<input name="no_check_deck" type="checkbox" [(ngModel)]="room.no_check_deck" >不检查卡组
</label>
</div>
<div class="checkbox">
<label>
<input name="no_shuffle_deck" type="checkbox">开局不洗卡组
<input name="no_shuffle_deck" type="checkbox" [(ngModel)]="room.no_shuffle_deck">开局不洗卡组
</label>
</div>
</div>
</div>
<div class="form-group row">
<!--<div class="form-group row">
<label class="col-sm-2">私密房间</label>
<div class="col-sm-10">
<div class="checkbox">
......@@ -137,7 +137,7 @@
</label>
</div>
</div>
</div>
</div>-->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary float-left" data-dismiss="modal" data-toggle="modal"
......
......@@ -7,8 +7,11 @@ import {RoutingService} from "./routing.service";
declare var process;
declare var System;
declare var $;
const fs = System._nodeRequire('fs');
const path = System._nodeRequire('path');
const crypto = System._nodeRequire('crypto');
const child_process = System._nodeRequire('child_process');
//const Promise = System._nodeRequire('bluebird');
const ini = System._nodeRequire('ini');
......@@ -32,8 +35,71 @@ export class YGOProComponent {
servers = [{address:"112.124.105.11", port: 7911}];
user = {external_id: 1, username: 'zh99998'}; // for test
room = {
title: this.user.username + '的房间',
rule: 0,
mode: 1,
start_lp: 8000,
start_hand: 5,
draw_count: 1,
enable_priority: false,
no_check_deck: false,
no_shuffle_deck: false
};
rooms = [];
constructor(private appsService: AppsService, private routingService: RoutingService) {
this.refresh()
// $('#game-list-modal').on('show.bs.modal', function (event) {
// var tbody = $('#game-list-modal tbody');
// for (let serfer of this.servers) {
//
// if (server.private) return;
// var connection = new ReconnectingWebSocket(server.url);
// connection.onclose = function (event) {
// tbody.children('[data-server-id="' + server.id + '"]').remove()
// };
// connection.onmessage = function (event) {
// console.log(event)
// var message = JSON.parse(event.data);
// switch (message.event) {
// case 'init':
// tbody.children('[data-server-id="' + server.id + '"]').remove();
// for (var i = 0; i < message.data.length; i++) {
// tbody.append(room_template(message.data[i], server));
// }
// break;
// case 'create':
// tbody.append(room_template(message.data, server));
// break;
// case 'update':
// $('#room-' + server.id + '-' + message.data.id).replaceWith(room_template(message.data, server));
// break;
// case 'delete':
// $('#room-' + server.id + '-' + message.data).remove();
// //auto width not works.
// /*var thead = $('#game-list-modal .modal-header th');
// tbody.find('tr:first-child td').each(function (index, element) {
// $(thead[index]).width($(element).width())
// });
// */
// }
// };
// roomlist_connections[server_id] = connection;
//
// }
// });
//
// $('#game-list-modal').on('hide.bs.modal', function (event) {
// for (var i in roomlist_connections) {
// roomlist_connections[i].close();
// }
// });
}
refresh = () => {
......@@ -124,12 +190,14 @@ export class YGOProComponent {
data['lastip'] = server.address;
data['lastport'] = server.port;
data['roompass'] = name;
data['nickname'] = this.user.username;
console.log(data)
return data
})
.then(this.save_system_conf)
.then(()=>['-j'])
.then(this.start_game)
.catch(reason=>console.log(reason))
.catch(reason=>alert(reason))
};
join_windbot(name) {
......@@ -152,4 +220,33 @@ export class YGOProComponent {
})
})
};
create_room(options) {
let options_buffer = new Buffer(6);
// 建主密码 https://docs.google.com/document/d/1rvrCGIONua2KeRaYNjKBLqyG9uybs9ZI-AmzZKNftOI/edit
options_buffer.writeUInt8((options.private ? 2 : 1) << 4, 1);
options_buffer.writeUInt8(parseInt(options.rule) << 5 | parseInt(options.mode) << 3 | (options.enable_priority ? 1 << 2 : 0) | (options.no_check_deck ? 1 << 1 : 0) | (options.no_shuffle_deck ? 1 : 0), 2);
options_buffer.writeUInt16LE(parseInt(options.start_lp), 3);
options_buffer.writeUInt8(parseInt(options.start_hand) << 4 | parseInt(options.draw_count), 5);
let checksum = 0;
for (let i = 1; i < options_buffer.length; i++) {
checksum -= options_buffer.readUInt8(i)
}
options_buffer.writeUInt8(checksum & 0xFF, 0);
let secret = this.user.external_id % 65535 + 1;
for (let i = 0; i < options_buffer.length; i += 2) {
options_buffer.writeUInt16LE(options_buffer.readUInt16LE(i) ^ secret, i)
}
let password = options_buffer.toString('base64') + options.title.replace(/\s/, String.fromCharCode(0xFEFF));
let room_id = crypto.createHash('md5').update(password + this.user.username).digest('base64').slice(0, 10).replace('+', '-').replace('/', '_')
this.join(password, this.servers[0]);
$('#game-create-modal').modal('hide');
}
}
......@@ -47,7 +47,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u7ea2\u9b54\u4e61 \u8bed\u8a00\u5305(\u7e41\u4f53\u4e2d\u6587)"
"zh-CN": "东方红魔乡 语言包(繁体中文)"
}
},
{
......@@ -56,7 +56,7 @@
"zh-CN": "fxt desc"
},
"tags": [
"game"
"touhou"
],
"homepage": "http://www.myacg.cc",
"author": "ZUN",
......@@ -113,7 +113,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u7ea2\u9b54\u4e61"
"zh-CN": "东方红魔乡"
}
},
{
......@@ -151,8 +151,7 @@
"darwin": "1.06"
},
"references": {
"win32": [
],
"win32": [],
"darwin": []
},
"download": {
......@@ -165,7 +164,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u8403\u68a6\u60f3 \u8bed\u8a00\u5305(\u7e41\u4f53\u4e2d\u6587)"
"zh-CN": "东方萃梦想 语言包(繁体中文)"
}
},
{
......@@ -174,7 +173,7 @@
"zh-CN": "fxt desc"
},
"tags": [
"game"
"touhou"
],
"homepage": "http://www.myacg.cc",
"author": "ZUN",
......@@ -216,7 +215,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u8403\u68a6\u60f3"
"zh-CN": "东方萃梦想"
}
},
{
......@@ -267,7 +266,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u5996\u5996\u68a6 \u8bed\u8a00\u5305(\u7e41\u4f53\u4e2d\u6587)"
"zh-CN": "东方妖妖梦 语言包(繁体中文)"
}
},
{
......@@ -276,7 +275,7 @@
"zh-CN": "fxt desc"
},
"tags": [
"game"
"touhou"
],
"homepage": "http://www.myacg.cc",
"author": "ZUN",
......@@ -318,7 +317,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u5996\u5996\u68a6"
"zh-CN": "东方妖妖梦"
}
},
{
......@@ -369,7 +368,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u6c38\u591c\u6284 \u8bed\u8a00\u5305(\u7b80\u4f53\u4e2d\u6587)"
"zh-CN": "东方永夜抄 语言包(简体中文)"
}
},
{
......@@ -378,7 +377,7 @@
"zh-CN": "fxt desc"
},
"tags": [
"game"
"touhou"
],
"homepage": "http://www.myacg.cc",
"author": "ZUN",
......@@ -420,7 +419,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u6c38\u591c\u6284"
"zh-CN": "东方永夜抄"
}
},
{
......@@ -471,7 +470,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u6587\u82b1\u5e16 (\u7e41\u4f53\u4e2d\u6587)"
"zh-CN": "东方文花帖 (繁体中文)"
}
},
{
......@@ -480,7 +479,7 @@
"zh-CN": "fxt desc"
},
"tags": [
"game"
"touhou"
],
"homepage": "http://www.myacg.cc",
"author": "ZUN",
......@@ -522,7 +521,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u6587\u82b1\u5e16"
"zh-CN": "东方文花帖"
}
},
{
......@@ -573,7 +572,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u82b1\u6620\u51a2 (\u7e41\u4f53\u4e2d\u6587)"
"zh-CN": "东方花映冢 (繁体中文)"
}
},
{
......@@ -582,7 +581,7 @@
"zh-CN": "fxt desc"
},
"tags": [
"game"
"touhou"
],
"homepage": "http://www.myacg.cc",
"author": "ZUN",
......@@ -624,7 +623,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u82b1\u6620\u51a2"
"zh-CN": "东方花映冢"
}
},
{
......@@ -675,7 +674,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u7eef\u60f3\u5929 \u8bed\u8a00\u5305 (\u7b80\u4f53\u4e2d\u6587)"
"zh-CN": "东方绯想天 语言包 (简体中文)"
}
},
{
......@@ -684,7 +683,7 @@
"zh-CN": "fxt desc"
},
"tags": [
"game"
"touhou"
],
"homepage": "http://www.myacg.cc",
"author": "ZUN",
......@@ -726,7 +725,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u7eef\u60f3\u5929"
"zh-CN": "东方绯想天"
}
},
{
......@@ -777,7 +776,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u98ce\u795e\u5f55 \u8bed\u8a00\u5305 (\u7b80\u4f53\u4e2d\u6587, \u7e41\u4f53\u4e2d\u6587)"
"zh-CN": "东方风神录 语言包 (简体中文, 繁体中文)"
}
},
{
......@@ -786,7 +785,7 @@
"zh-CN": "fxt desc"
},
"tags": [
"game"
"touhou"
],
"homepage": "http://www.myacg.cc",
"author": "ZUN",
......@@ -828,7 +827,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u98ce\u795e\u5f55"
"zh-CN": "东方风神录"
}
},
{
......@@ -879,7 +878,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u5730\u7075\u6bbf \u8bed\u8a00\u5305 (\u7e41\u4f53\u4e2d\u6587)"
"zh-CN": "东方地灵殿 语言包 (繁体中文)"
}
},
{
......@@ -888,7 +887,7 @@
"zh-CN": "fxt desc"
},
"tags": [
"game"
"touhou"
],
"homepage": "http://www.myacg.cc",
"author": "ZUN",
......@@ -930,7 +929,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u5730\u7075\u6bbf"
"zh-CN": "东方地灵殿"
}
},
{
......@@ -981,7 +980,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u975e\u60f3\u5929\u5219 \u8bed\u8a00\u5305 (\u7b80\u4f53\u4e2d\u6587)"
"zh-CN": "东方非想天则 语言包 (简体中文)"
}
},
{
......@@ -990,7 +989,7 @@
"zh-CN": "fxt desc"
},
"tags": [
"game"
"touhou"
],
"homepage": "http://www.myacg.cc",
"author": "ZUN",
......@@ -1032,7 +1031,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u975e\u60f3\u5929\u5219"
"zh-CN": "东方非想天则"
}
},
{
......@@ -1083,7 +1082,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u661f\u83b2\u8239 \u8bed\u8a00\u5305 (\u7e41\u4f53\u4e2d\u6587)"
"zh-CN": "东方星莲船 语言包 (繁体中文)"
}
},
{
......@@ -1092,7 +1091,7 @@
"zh-CN": "fxt desc"
},
"tags": [
"game"
"touhou"
],
"homepage": "http://www.myacg.cc",
"author": "ZUN",
......@@ -1134,7 +1133,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u661f\u83b2\u8239"
"zh-CN": "东方星莲船"
}
},
{
......@@ -1185,7 +1184,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u7075\u5f02\u4f20 \u8bed\u8a00\u5305 (\u7e41\u4f53\u4e2d\u6587)"
"zh-CN": "东方灵异传 语言包 (繁体中文)"
}
},
{
......@@ -1194,7 +1193,7 @@
"zh-CN": "fxt desc"
},
"tags": [
"game"
"touhou_pc98"
],
"homepage": "http://www.myacg.cc",
"author": "ZUN",
......@@ -1236,7 +1235,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u7075\u5f02\u4f20"
"zh-CN": "东方灵异传"
}
},
{
......@@ -1287,7 +1286,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u68a6\u65f6\u7a7a \u8bed\u8a00\u5305 (\u7e41\u4f53\u4e2d\u6587)"
"zh-CN": "东方梦时空 语言包 (繁体中文)"
}
},
{
......@@ -1296,7 +1295,7 @@
"zh-CN": "fxt desc"
},
"tags": [
"game"
"touhou_pc98"
],
"homepage": "http://www.myacg.cc",
"author": "ZUN",
......@@ -1338,7 +1337,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u68a6\u65f6\u7a7a"
"zh-CN": "东方梦时空"
}
},
{
......@@ -1389,7 +1388,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u5c01\u9b54\u5f55 \u8bed\u8a00\u5305 (\u7e41\u4f53\u4e2d\u6587)"
"zh-CN": "东方封魔录 语言包 (繁体中文)"
}
},
{
......@@ -1398,7 +1397,7 @@
"zh-CN": "fxt desc"
},
"tags": [
"game"
"touhou_pc98"
],
"homepage": "http://www.myacg.cc",
"author": "ZUN",
......@@ -1440,7 +1439,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u5c01\u9b54\u5f55"
"zh-CN": "东方封魔录"
}
},
{
......@@ -1491,7 +1490,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u5e7b\u60f3\u4e61 \u8bed\u8a00\u5305 (\u7e41\u4f53\u4e2d\u6587)"
"zh-CN": "东方幻想乡 语言包 (繁体中文)"
}
},
{
......@@ -1500,7 +1499,7 @@
"zh-CN": "fxt desc"
},
"tags": [
"game"
"touhou_pc98"
],
"homepage": "http://www.myacg.cc",
"author": "ZUN",
......@@ -1542,7 +1541,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u5e7b\u60f3\u4e61"
"zh-CN": "东方幻想乡"
}
},
{
......@@ -1593,7 +1592,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u602a\u7eee\u8c08 \u8bed\u8a00\u5305 (\u7e41\u4f53\u4e2d\u6587)"
"zh-CN": "东方怪绮谈 语言包 (繁体中文)"
}
},
{
......@@ -1602,7 +1601,7 @@
"zh-CN": "fxt desc"
},
"tags": [
"game"
"touhou_pc98"
],
"homepage": "http://www.myacg.cc",
"author": "ZUN",
......@@ -1644,7 +1643,7 @@
"zh-CN"
],
"name": {
"zh-CN": "\u4e1c\u65b9\u602a\u7eee\u8c08"
"zh-CN": "东方怪绮谈"
}
},
{
......@@ -1657,8 +1656,7 @@
},
"category": "game",
"tags": [
"game",
"card"
"yugioh"
],
"locales": [
"zh-CN"
......
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