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
132eef84
Commit
132eef84
authored
Jun 02, 2017
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix, 3.0.30
parent
5d120d0e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
app/ygopro.component.ts
app/ygopro.component.ts
+13
-13
No files found.
app/ygopro.component.ts
View file @
132eef84
...
@@ -27,7 +27,7 @@ import { AppsService } from './apps.service';
...
@@ -27,7 +27,7 @@ import { AppsService } from './apps.service';
import
{
SettingsService
}
from
'
./settings.sevices
'
;
import
{
SettingsService
}
from
'
./settings.sevices
'
;
import
*
as
$
from
'
jquery
'
;
import
*
as
$
from
'
jquery
'
;
import
Timer
=
NodeJS
.
Timer
;
import
Timer
=
NodeJS
.
Timer
;
import
WillNavigateEvent
=
Electron
.
W
ebViewElement
.
W
illNavigateEvent
;
import
WillNavigateEvent
=
Electron
.
WillNavigateEvent
;
interface
SystemConf
{
interface
SystemConf
{
use_d3d
:
string
;
use_d3d
:
string
;
...
@@ -72,7 +72,7 @@ interface Room {
...
@@ -72,7 +72,7 @@ interface Room {
'
private
'
?:
boolean
;
'
private
'
?:
boolean
;
options
:
Options
;
options
:
Options
;
arena
?:
string
;
arena
?:
string
;
users
?:
{
username
:
string
,
position
:
number
}[];
users
?:
{
username
:
string
,
position
:
number
}[];
}
}
interface
Options
{
interface
Options
{
...
@@ -100,7 +100,7 @@ export interface Points {
...
@@ -100,7 +100,7 @@ export interface Points {
}
}
interface
YGOProData
{
interface
YGOProData
{
windbot
:
{
[
locale
:
string
]:
string
[]
};
windbot
:
{
[
locale
:
string
]:
string
[]
};
}
}
...
@@ -155,7 +155,7 @@ export class YGOProComponent implements OnInit, OnDestroy {
...
@@ -155,7 +155,7 @@ export class YGOProComponent implements OnInit, OnDestroy {
time_limit
:
180
time_limit
:
180
};
};
room
:
Room
=
{
title
:
this
.
loginService
.
user
.
username
+
'
的房间
'
,
options
:
Object
.
assign
({},
this
.
default_options
)
};
room
:
Room
=
{
title
:
this
.
loginService
.
user
.
username
+
'
的房间
'
,
options
:
Object
.
assign
({},
this
.
default_options
)
};
rooms
:
Room
[]
=
[];
rooms
:
Room
[]
=
[];
...
@@ -302,11 +302,11 @@ export class YGOProComponent implements OnInit, OnDestroy {
...
@@ -302,11 +302,11 @@ export class YGOProComponent implements OnInit, OnDestroy {
case
'
init
'
:
case
'
init
'
:
this
.
rooms_loading
=
false
;
this
.
rooms_loading
=
false
;
this
.
rooms
=
this
.
rooms
.
filter
(
room
=>
room
.
server
!==
server
).
concat
(
this
.
rooms
=
this
.
rooms
.
filter
(
room
=>
room
.
server
!==
server
).
concat
(
message
.
data
.
map
((
room
:
Room
)
=>
Object
.
assign
({
server
:
server
},
room
))
message
.
data
.
map
((
room
:
Room
)
=>
Object
.
assign
({
server
:
server
},
room
))
);
);
break
;
break
;
case
'
create
'
:
case
'
create
'
:
this
.
rooms
.
push
(
Object
.
assign
({
server
:
server
},
message
.
data
));
this
.
rooms
.
push
(
Object
.
assign
({
server
:
server
},
message
.
data
));
break
;
break
;
case
'
update
'
:
case
'
update
'
:
Object
.
assign
(
this
.
rooms
.
find
(
room
=>
room
.
server
===
server
&&
room
.
id
===
message
.
data
.
id
),
message
.
data
);
Object
.
assign
(
this
.
rooms
.
find
(
room
=>
room
.
server
===
server
&&
room
.
id
===
message
.
data
.
id
),
message
.
data
);
...
@@ -344,11 +344,11 @@ export class YGOProComponent implements OnInit, OnDestroy {
...
@@ -344,11 +344,11 @@ export class YGOProComponent implements OnInit, OnDestroy {
switch
(
message
.
event
)
{
switch
(
message
.
event
)
{
case
'
init
'
:
case
'
init
'
:
this
.
replay_rooms
=
this
.
replay_rooms
.
filter
(
room
=>
room
.
server
!==
server
).
concat
(
this
.
replay_rooms
=
this
.
replay_rooms
.
filter
(
room
=>
room
.
server
!==
server
).
concat
(
message
.
data
.
map
((
room
:
Room
)
=>
Object
.
assign
({
server
:
server
},
room
))
message
.
data
.
map
((
room
:
Room
)
=>
Object
.
assign
({
server
:
server
},
room
))
);
);
break
;
break
;
case
'
create
'
:
case
'
create
'
:
this
.
replay_rooms
.
push
(
Object
.
assign
({
server
:
server
},
message
.
data
));
this
.
replay_rooms
.
push
(
Object
.
assign
({
server
:
server
},
message
.
data
));
break
;
break
;
case
'
delete
'
:
case
'
delete
'
:
this
.
replay_rooms
.
splice
(
this
.
replay_rooms
.
splice
(
...
@@ -388,7 +388,7 @@ export class YGOProComponent implements OnInit, OnDestroy {
...
@@ -388,7 +388,7 @@ export class YGOProComponent implements OnInit, OnDestroy {
let
params
=
new
URLSearchParams
();
let
params
=
new
URLSearchParams
();
params
.
set
(
'
username
'
,
this
.
loginService
.
user
.
username
);
params
.
set
(
'
username
'
,
this
.
loginService
.
user
.
username
);
try
{
try
{
let
points
=
await
this
.
http
.
get
(
'
https://mycard.moe/ygopro/api/user
'
,
{
search
:
params
})
let
points
=
await
this
.
http
.
get
(
'
https://mycard.moe/ygopro/api/user
'
,
{
search
:
params
})
.
map
((
response
)
=>
response
.
json
())
.
map
((
response
)
=>
response
.
json
())
.
toPromise
();
.
toPromise
();
this
.
points
.
emit
(
points
);
this
.
points
.
emit
(
points
);
...
@@ -455,7 +455,7 @@ export class YGOProComponent implements OnInit, OnDestroy {
...
@@ -455,7 +455,7 @@ export class YGOProComponent implements OnInit, OnDestroy {
load_system_conf
():
Promise
<
SystemConf
>
{
load_system_conf
():
Promise
<
SystemConf
>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
fs
.
readFile
(
this
.
system_conf
,
{
encoding
:
'
utf-8
'
},
(
error
,
data
)
=>
{
fs
.
readFile
(
this
.
system_conf
,
{
encoding
:
'
utf-8
'
},
(
error
,
data
)
=>
{
if
(
error
)
{
if
(
error
)
{
return
reject
(
error
);
return
reject
(
error
);
}
}
...
@@ -466,7 +466,7 @@ export class YGOProComponent implements OnInit, OnDestroy {
...
@@ -466,7 +466,7 @@ export class YGOProComponent implements OnInit, OnDestroy {
save_system_conf
(
data
:
SystemConf
)
{
save_system_conf
(
data
:
SystemConf
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
fs
.
writeFile
(
this
.
system_conf
,
ini
.
unsafe
(
ini
.
stringify
(
data
,
<
EncodeOptions
>
{
whitespace
:
true
})),
(
error
)
=>
{
fs
.
writeFile
(
this
.
system_conf
,
ini
.
unsafe
(
ini
.
stringify
(
data
,
<
EncodeOptions
>
{
whitespace
:
true
})),
(
error
)
=>
{
if
(
error
)
{
if
(
error
)
{
return
reject
(
error
);
return
reject
(
error
);
}
}
...
@@ -522,7 +522,7 @@ export class YGOProComponent implements OnInit, OnDestroy {
...
@@ -522,7 +522,7 @@ export class YGOProComponent implements OnInit, OnDestroy {
reject
(
error
);
reject
(
error
);
win
.
restore
();
win
.
restore
();
});
});
child
.
on
(
'
exit
'
,
async
(
code
,
signal
)
=>
{
child
.
on
(
'
exit
'
,
async
(
code
,
signal
)
=>
{
// error 触发之后还可能会触发exit,但是Promise只承认首次状态转移,因此这里无需重复判断是否已经error过。
// error 触发之后还可能会触发exit,但是Promise只承认首次状态转移,因此这里无需重复判断是否已经error过。
await
this
.
refresh
();
await
this
.
refresh
();
resolve
();
resolve
();
...
@@ -596,7 +596,7 @@ export class YGOProComponent implements OnInit, OnDestroy {
...
@@ -596,7 +596,7 @@ export class YGOProComponent implements OnInit, OnDestroy {
search
:
search
search
:
search
}).
map
(
response
=>
response
.
json
())
}).
map
(
response
=>
response
.
json
())
.
subscribe
((
data
)
=>
{
.
subscribe
((
data
)
=>
{
this
.
join
(
data
[
'
password
'
],
{
address
:
data
[
'
address
'
],
port
:
data
[
'
port
'
]
});
this
.
join
(
data
[
'
password
'
],
{
address
:
data
[
'
address
'
],
port
:
data
[
'
port
'
]
});
},
(
error
)
=>
{
},
(
error
)
=>
{
alert
(
`匹配失败`
);
alert
(
`匹配失败`
);
this
.
matching
=
matching
=
undefined
;
this
.
matching
=
matching
=
undefined
;
...
...
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