Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
mycard
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
syntax_j
mycard
Commits
aa081edb
Commit
aa081edb
authored
Dec 07, 2016
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ygopro i18n
parent
09e7a347
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
196 additions
and
150 deletions
+196
-150
app/app-detail.component.html
app/app-detail.component.html
+4
-4
app/app-detail.component.ts
app/app-detail.component.ts
+1
-1
app/app.ts
app/app.ts
+1
-1
app/apps.service.ts
app/apps.service.ts
+31
-10
app/lobby.component.html
app/lobby.component.html
+6
-6
app/ygopro.component.ts
app/ygopro.component.ts
+47
-7
apps.json
apps.json
+105
-120
index.js
index.js
+1
-1
No files found.
app/app-detail.component.html
View file @
aa081edb
...
...
@@ -8,10 +8,10 @@
<!--应用变更中-->
<div
class=
"actions"
*ngIf=
"currentApp.isInstalled() && !currentApp.isReady()"
>
<div>
<span
*ngIf=
"currentApp.isDownloading()"
>
正在下载
</span>
<span
*ngIf=
"currentApp.isInstalling()"
>
正在安装...
</span>
<span
*ngIf=
"currentApp.isUninstalling()"
>
正在卸载...
</span>
<span
*ngIf=
"currentApp.isWaiting()"
>
等待安装...
</span>
<span
i18n
*ngIf=
"currentApp.isDownloading()"
>
正在下载
</span>
<span
i18n
*ngIf=
"currentApp.isInstalling()"
>
正在安装...
</span>
<span
i18n
*ngIf=
"currentApp.isUninstalling()"
>
正在卸载...
</span>
<span
i18n
*ngIf=
"currentApp.isWaiting()"
>
等待安装...
</span>
<span
*ngIf=
"currentApp.status.total"
>
{{(currentApp.status.progress/currentApp.status.total * 100).toFixed()}}%
</span>
<span>
{{currentApp.progressMessage()}}
</span>
</div>
...
...
app/app-detail.component.ts
View file @
aa081edb
...
...
@@ -74,7 +74,7 @@ export class AppDetailComponent implements OnInit {
async
installMod
(
mod
:
App
)
{
let
option
=
new
InstallOption
(
mod
,
path
.
dirname
(
mod
.
parent
.
local
!
.
path
));
let
option
=
new
InstallOption
(
mod
,
path
.
dirname
(
mod
.
parent
!
.
local
!
.
path
));
await
this
.
install
(
mod
,
option
,
{});
}
...
...
app/app.ts
View file @
aa081edb
...
...
@@ -52,7 +52,7 @@ export class App {
author
:
string
;
// English Only
homepage
:
string
;
category
:
Category
;
parent
:
App
;
parent
?
:
App
;
get
download
():
string
{
let
downloadUrl
=
"
https://thief.mycard.moe/metalinks/
"
;
...
...
app/apps.service.ts
View file @
aa081edb
import
{
Injectable
,
ApplicationRef
,
EventEmitter
}
from
"
@angular/core
"
;
import
{
Http
}
from
"
@angular/http
"
;
import
{
App
,
AppStatus
,
Action
}
from
"
./app
"
;
import
{
App
,
AppStatus
,
Action
,
Category
}
from
"
./app
"
;
import
{
SettingsService
}
from
"
./settings.sevices
"
;
import
*
as
fs
from
"
fs
"
;
import
*
as
path
from
"
path
"
;
...
...
@@ -77,13 +77,15 @@ export class AppsService {
}
// 去除无关语言
for
(
let
key
of
[
'
name
'
,
'
description
'
])
{
for
(
let
key
of
[
'
name
'
,
'
description
'
,
'
news
'
])
{
if
(
app
[
key
])
{
let
value
=
app
[
key
][
locale
];
if
(
!
value
)
{
value
=
app
[
key
][
"
zh-CN
"
];
}
app
[
key
]
=
value
;
}
}
// 去除平台无关的内容
for
(
let
key
of
[
'
actions
'
,
'
dependencies
'
,
'
references
'
,
'
version
'
])
{
...
...
@@ -102,8 +104,8 @@ export class AppsService {
// 设置App关系
//TODO: 这里有必要重新整理一下么?
for
(
let
[
id
]
of
apps
)
{
let
temp
=
app
s
.
get
(
id
)
!
.
actions
;
for
(
let
[
id
,
app
]
of
apps
)
{
let
temp
=
app
.
actions
;
let
map
=
new
Map
<
string
,
any
>
();
for
(
let
action
of
Object
.
keys
(
temp
))
{
let
openId
=
temp
[
action
][
"
open
"
];
...
...
@@ -112,10 +114,9 @@ export class AppsService {
}
map
.
set
(
action
,
temp
[
action
]);
}
app
s
.
get
(
id
)
!
.
actions
=
map
;
app
.
actions
=
map
;
for
(
let
key
of
[
'
dependencies
'
,
'
references
'
,
'
parent
'
])
{
let
app
=
apps
.
get
(
id
)
!
;
let
value
=
app
[
key
];
if
(
value
)
{
if
(
Array
.
isArray
(
value
))
{
...
...
@@ -129,6 +130,26 @@ export class AppsService {
}
}
}
// 为语言包置一个默认的名字
// 这里简易做个 i18n 的 hack
const
lang
=
{
'
en-US
'
:
{
'
en-US
'
:
'
English
'
,
'
zh-CN
'
:
'
Simplified Chinese
'
,
'
zh-TW
'
:
'
Traditional Chinese
'
,
'
language_pack
'
:
'
Language
'
},
'
zh-CN
'
:
{
'
en-US
'
:
'
英文
'
,
'
zh-CN
'
:
'
简体中文
'
,
'
zh-TW
'
:
'
繁体中文
'
,
'
language_pack
'
:
'
语言包
'
}
};
if
(
!
app
.
name
&&
app
.
category
==
Category
.
module
&&
app
.
tags
.
includes
(
'
language
'
)
&&
app
.
parent
)
{
app
.
name
=
`
${
app
.
parent
.
name
}
${
lang
[
locale
].
language_pack
}
(
${
app
.
locales
.
map
((
l
)
=>
lang
[
locale
][
l
]).
join
(
'
,
'
)}
)`
}
}
return
apps
;
};
...
...
app/lobby.component.html
View file @
aa081edb
...
...
@@ -2,7 +2,7 @@
<div
id=
"main"
>
<div
id=
"apps"
*ngIf=
"apps"
>
<span
*ngIf=
"grouped_apps.installed"
>
已安装
</span>
<span
i18n
*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===currentApp"
>
<i
*ngIf=
"!app.isReady() && !app.status.total"
class=
"spin fa fa-circle-o-notch fa-spin fa-fw"
></i>
...
...
@@ -17,13 +17,13 @@
</li>
</ul>
<span
*ngIf=
"grouped_apps.recommend"
>
推荐
</span>
<span
i18n
*ngIf=
"grouped_apps.recommend"
>
推荐
</span>
<ul
*ngIf=
"grouped_apps.recommend"
class=
"nav nav-sidebar"
>
<li
*ngFor=
"let app of grouped_apps.recommend"
[class.active]=
"app===currentApp"
>
<a
(click)=
"chooseApp(app)"
href=
"#"
>
{{app.name}}
</a>
</li>
</ul>
<span
*ngIf=
"grouped_apps.mysterious"
>
迷之物体
</span>
<span
i18n
*ngIf=
"grouped_apps.mysterious"
>
迷之物体
</span>
<ul
*ngIf=
"grouped_apps.mysterious"
class=
"nav nav-sidebar"
>
<li
*ngFor=
"let app of grouped_apps.mysterious"
[class.active]=
"app===currentApp"
>
<a
(click)=
"chooseApp(app)"
href=
"#"
>
{{app.name}}
</a>
...
...
@@ -33,7 +33,7 @@
max=
"{{app.status.total}}"
></progress>
</li>
</ul>
<span
*ngIf=
"grouped_apps.touhou"
>
东方 Project
</span>
<span
i18n
*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===currentApp"
>
<a
(click)=
"chooseApp(app)"
href=
"#"
>
{{app.name}}
</a>
...
...
@@ -43,13 +43,13 @@
max=
"{{app.status.total}}"
></progress>
</li>
</ul>
<span
*ngIf=
"grouped_apps.touhou_pc98"
>
东方旧作
</span>
<span
i18n
*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===currentApp"
>
<a
(click)=
"chooseApp(app)"
href=
"#"
>
{{app.name}}
</a>
</li>
</ul>
<span
*ngIf=
"grouped_apps.runtime_installed"
>
已安装的运行库
</span>
<span
i18n
*ngIf=
"grouped_apps.runtime_installed"
>
已安装的运行库
</span>
<ul
*ngIf=
"grouped_apps.runtime_installed"
class=
"nav nav-sidebar"
>
<li
*ngFor=
"let app of grouped_apps.runtime_installed"
[class.active]=
"app===currentApp"
>
<a
(click)=
"chooseApp(app)"
href=
"#"
>
{{app.name}}
</a>
...
...
app/ygopro.component.ts
View file @
aa081edb
...
...
@@ -2,7 +2,6 @@
* Created by zh99998 on 16/9/2.
*/
import
{
Component
,
OnInit
,
ChangeDetectorRef
,
Input
}
from
"
@angular/core
"
;
import
{
AppsService
}
from
"
./apps.service
"
;
import
*
as
fs
from
"
fs
"
;
import
*
as
path
from
"
path
"
;
import
*
as
crypto
from
"
crypto
"
;
...
...
@@ -15,7 +14,7 @@ import {App} from "./app";
import
{
Http
,
Headers
,
URLSearchParams
}
from
"
@angular/http
"
;
import
"
rxjs/Rx
"
;
import
{
ISubscription
}
from
"
rxjs/Subscription
"
;
import
{
AppLocal
}
from
"
./app-local
"
;
import
{
SettingsService
}
from
"
./settings.sevices
"
;
declare
const
$
:
any
;
...
...
@@ -109,7 +108,7 @@ export class YGOProComponent implements OnInit {
connections
:
WebSocket
[]
=
[];
constructor
(
private
http
:
Http
,
private
appsService
:
App
sService
,
private
loginService
:
LoginService
,
private
ref
:
ChangeDetectorRef
)
{
constructor
(
private
http
:
Http
,
private
settingsService
:
Setting
sService
,
private
loginService
:
LoginService
,
private
ref
:
ChangeDetectorRef
)
{
switch
(
process
.
platform
)
{
case
'
darwin
'
:
this
.
numfont
=
[
'
/System/Library/Fonts/SFNSTextCondensed-Bold.otf
'
];
...
...
@@ -117,7 +116,7 @@ export class YGOProComponent implements OnInit {
break
;
case
'
win32
'
:
this
.
numfont
=
[
path
.
join
(
process
.
env
[
'
SystemRoot
'
],
'
Fonts
'
,
'
arialbd.ttf
'
)];
this
.
textfont
=
[
path
.
join
(
process
.
env
[
'
SystemRoot
'
],
'
Fonts
'
,
'
simsun.ttc
'
)];
this
.
textfont
=
[
path
.
join
(
process
.
env
[
'
SystemRoot
'
],
'
Fonts
'
,
'
msyh.ttc
'
),
path
.
join
(
process
.
env
[
'
SystemRoot
'
],
'
Fonts
'
,
'
msyh.ttf
'
),
path
.
join
(
process
.
env
[
'
SystemRoot
'
],
'
Fonts
'
,
'
simsun.ttc
'
)];
break
;
}
}
...
...
@@ -208,7 +207,7 @@ export class YGOProComponent implements OnInit {
}
}
if
(
!
await
this
.
get_font
([
data
.
textfont
.
split
(
'
'
,
2
)[
0
]]))
{
if
(
data
.
textfont
==
'
c:/windows/fonts/simsun.ttc 14
'
||
!
await
this
.
get_font
([
data
.
textfont
.
split
(
'
'
,
2
)[
0
]]))
{
let
font
=
await
this
.
get_font
(
this
.
textfont
);
if
(
font
)
{
data
[
'
textfont
'
]
=
`
${
font
}
14`
...
...
@@ -258,10 +257,51 @@ export class YGOProComponent implements OnInit {
return
this
.
join
(
'
AI#
'
+
name
,
this
.
servers
[
0
])
}
start_game
(
args
:
string
[])
{
async
start_game
(
args
:
string
[])
{
let
win
=
remote
.
getCurrentWindow
();
win
.
minimize
();
console
.
log
(
path
.
join
(
this
.
app
.
local
!
.
path
,
this
.
app
.
actions
.
get
(
'
main
'
)
!
.
execute
),
args
,
{
cwd
:
this
.
app
.
local
!
.
path
});
let
locale
=
this
.
settingsService
.
getLocale
();
if
(
localStorage
.
getItem
(
'
ygopro-locale
'
)
!=
locale
)
{
console
.
log
(
`try convert ygopro locale to
${
locale
}
`
)
try
{
await
new
Promise
((
resolve
,
reject
)
=>
{
let
source
=
fs
.
createReadStream
(
path
.
join
(
this
.
app
.
local
!
.
path
,
'
locales
'
,
locale
,
'
strings.conf
'
));
source
.
on
(
'
open
'
,
(
error
:
Error
)
=>
{
let
destination
=
fs
.
createWriteStream
(
path
.
join
(
this
.
app
.
local
!
.
path
,
'
strings.conf
'
));
source
.
pipe
(
destination
);
destination
.
on
(
'
error
'
,
(
error
:
Error
)
=>
{
reject
(
error
)
});
destination
.
on
(
'
close
'
,
()
=>
{
resolve
()
})
});
source
.
on
(
'
error
'
,
(
error
:
Error
)
=>
{
reject
(
error
)
});
});
await
new
Promise
((
resolve
,
reject
)
=>
{
let
source
=
fs
.
createReadStream
(
path
.
join
(
this
.
app
.
local
!
.
path
,
'
locales
'
,
locale
,
'
cards.cdb
'
));
source
.
on
(
'
open
'
,
(
error
:
Error
)
=>
{
let
destination
=
fs
.
createWriteStream
(
path
.
join
(
this
.
app
.
local
!
.
path
,
'
cards.cdb
'
));
source
.
pipe
(
destination
);
destination
.
on
(
'
error
'
,
(
error
:
Error
)
=>
{
reject
(
error
)
});
destination
.
on
(
'
close
'
,
()
=>
{
resolve
()
})
});
source
.
on
(
'
error
'
,
(
error
:
Error
)
=>
{
reject
(
error
)
});
});
localStorage
.
setItem
(
'
ygopro-locale
'
,
locale
)
console
.
log
(
`convert ygopro locale to
${
locale
}
success`
)
}
catch
(
error
)
{
console
.
error
(
`convert ygopro locale to
${
locale
}
failed`
,
error
)
}
}
return
new
Promise
((
resolve
,
reject
)
=>
{
let
child
=
child_process
.
spawn
(
path
.
join
(
this
.
app
.
local
!
.
path
,
this
.
app
.
actions
.
get
(
'
main
'
)
!
.
execute
),
args
,
{
cwd
:
this
.
app
.
local
!
.
path
,
...
...
apps.json
View file @
aa081edb
This diff is collapsed.
Click to expand it.
index.js
View file @
aa081edb
...
...
@@ -10,7 +10,7 @@ function handleElevate() {
if
(
process
.
argv
[
1
]
==
'
-e
'
)
{
if
(
process
.
platform
==
'
darwin
'
)
{
app
.
dock
.
hide
();
require
(
'
electron
'
).
app
.
dock
.
hide
();
}
let
elevate
=
JSON
.
parse
(
new
Buffer
(
process
.
argv
[
2
],
'
base64
'
).
toString
());
require
(
'
net
'
).
connect
(
elevate
[
'
ipc
'
],
function
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment