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
62cb412a
Commit
62cb412a
authored
Feb 22, 2017
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
房间列表现在loading/空列表
parent
42c9d68c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
app/ygopro.component.html
app/ygopro.component.html
+3
-1
app/ygopro.component.ts
app/ygopro.component.ts
+8
-1
No files found.
app/ygopro.component.html
View file @
62cb412a
...
...
@@ -55,7 +55,9 @@
<div
class=
"modal-content flex-row"
>
<div
id=
"game-list"
>
<table
class=
"table table-striped table-hover"
>
<div
i18n
class=
"p-2"
*ngIf=
"rooms_loading"
>
正在读取游戏列表...
</div>
<div
i18n
class=
"p-2"
*ngIf=
"!rooms_loading && this.rooms.length === 0"
>
现在没有等待中的游戏,可以自行创建一个房间或者去匹配
</div>
<table
*ngIf=
"!this.rooms_loading && this.rooms.length > 0"
class=
"table table-striped table-hover"
>
<thead>
<tr>
<th
i18n
class=
"title"
>
游戏标题
</th>
...
...
app/ygopro.component.ts
View file @
62cb412a
...
...
@@ -140,6 +140,7 @@ export class YGOProComponent implements OnInit, OnDestroy {
servers
:
Server
[]
=
[];
rooms_loading
=
true
;
default_options
:
Options
=
{
mode
:
1
,
...
...
@@ -283,17 +284,23 @@ export class YGOProComponent implements OnInit, OnDestroy {
let
modal
=
$
(
'
#game-list-modal
'
);
modal
.
on
(
'
show.bs.modal
'
,
()
=>
{
this
.
rooms_loading
=
true
;
this
.
connections
=
this
.
servers
.
filter
(
server
=>
server
.
custom
).
map
((
server
)
=>
{
let
url
=
new
URL
(
server
.
url
!
);
url
[
'
searchParams
'
].
set
(
'
filter
'
,
'
waiting
'
);
let
connection
=
new
WebSocket
(
url
.
toString
());
connection
.
onclose
=
()
=>
{
connection
.
onclose
=
(
event
:
CloseEvent
)
=>
{
this
.
rooms
=
this
.
rooms
.
filter
(
room
=>
room
.
server
!==
server
);
};
connection
.
onerror
=
(
event
:
ErrorEvent
)
=>
{
console
.
log
(
'
error
'
,
server
.
id
,
event
);
this
.
rooms
=
this
.
rooms
.
filter
(
room
=>
room
.
server
!==
server
);
};
connection
.
onmessage
=
(
event
)
=>
{
let
message
=
JSON
.
parse
(
event
.
data
);
switch
(
message
.
event
)
{
case
'
init
'
:
this
.
rooms_loading
=
false
;
this
.
rooms
=
this
.
rooms
.
filter
(
room
=>
room
.
server
!==
server
).
concat
(
message
.
data
.
map
((
room
:
Room
)
=>
Object
.
assign
({
server
:
server
},
room
))
);
...
...
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