Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Mycard Mobile
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
MyCard
Mycard Mobile
Commits
b66f1ff2
Commit
b66f1ff2
authored
Aug 24, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
so far those things
parent
c6b7cce5
Pipeline
#4945
passed with stage
in 5 minutes and 52 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
42 additions
and
41 deletions
+42
-41
src/app/lobby/lobby.component.html
src/app/lobby/lobby.component.html
+6
-6
src/app/room-list/room-list.component.ts
src/app/room-list/room-list.component.ts
+1
-1
src/app/server-select/server-select.component.html
src/app/server-select/server-select.component.html
+2
-2
src/app/server-select/server-select.component.ts
src/app/server-select/server-select.component.ts
+3
-2
src/app/watch/watch.component.ts
src/app/watch/watch.component.ts
+1
-1
src/app/windbot/windbot.component.html
src/app/windbot/windbot.component.html
+1
-1
src/app/ygopro.service.ts
src/app/ygopro.service.ts
+28
-28
No files found.
src/app/lobby/lobby.component.html
View file @
b66f1ff2
...
...
@@ -35,27 +35,27 @@
<!--<a href="https://accounts.moecube.com/profiles" id="avatar" mat-raised-button [style.background-image]="'url(' + login.user.avatar_url + ')'">{{login.user.username}}</a>-->
<!--</mat-grid-tile>-->
<mat-grid-tile>
<button
mat-raised-button
color=
"primary"
(click)=
"ygopro.request_match('athletic')"
>
<button
mat-raised-button
color=
"primary"
[disabled]=
'ygopro.currentServer && ygopro.currentServer.id !== "tiramisu"'
(click)=
"ygopro.request_match('athletic')"
>
<mat-icon
fontSet=
"fa"
fontIcon=
"fa-futbol-o"
></mat-icon>
<br>
竞技匹配
</button>
</mat-grid-tile>
<mat-grid-tile>
<button
mat-raised-button
color=
"primary"
(click)=
"ygopro.request_match('entertain')"
>
<button
mat-raised-button
color=
"primary"
[disabled]=
'ygopro.currentServer && ygopro.currentServer.id !== "tiramisu"'
(click)=
"ygopro.request_match('entertain')"
>
<mat-icon>
toys
</mat-icon>
<br>
娱乐匹配
</button>
</mat-grid-tile>
<mat-grid-tile><a
mat-raised-button
color=
"primary"
routerLink=
"/ygopro/rooms"
>
<mat-grid-tile><a
mat-raised-button
color=
"primary"
[disabled]=
'ygopro.currentServer && !ygopro.currentServer.custom'
routerLink=
"/ygopro/rooms"
>
<mat-icon>
games
</mat-icon>
<br>
房间列表
</a></mat-grid-tile>
<mat-grid-tile><a
mat-raised-button
color=
"primary"
routerLink=
"/ygopro/rooms/new"
>
<mat-grid-tile><a
mat-raised-button
color=
"primary"
[disabled]=
'ygopro.currentServer && !ygopro.currentServer.custom'
routerLink=
"/ygopro/rooms/new"
>
<mat-icon>

</mat-icon>
<!--add_box-->
<br>
创建房间
</a></mat-grid-tile>
<mat-grid-tile><a
mat-raised-button
routerLink=
"/ygopro/windbot"
>
<mat-grid-tile><a
mat-raised-button
[disabled]=
'ygopro.currentServer && !ygopro.currentServer.windbot'
routerLink=
"/ygopro/windbot"
>
<mat-icon>

</mat-icon>
<!-- airplanemode_active -->
<br>
单人模式
</a></mat-grid-tile>
<mat-grid-tile><a
mat-raised-button
routerLink=
"/ygopro/watch"
>
<mat-grid-tile><a
mat-raised-button
[disabled]=
'ygopro.currentServer && !ygopro.currentServer.replay'
routerLink=
"/ygopro/watch"
>
<mat-icon>

</mat-icon>
<!--remove_red_eye-->
<br>
观战
</a></mat-grid-tile>
<!--<mat-grid-tile>-->
...
...
src/app/room-list/room-list.component.ts
View file @
b66f1ff2
...
...
@@ -15,7 +15,7 @@ export class RoomListComponent implements OnInit {
@
HostBinding
(
'
@routerTransition
'
)
animation
;
displayedColumns
=
[
'
title
'
,
'
users
'
,
'
mode
'
,
'
extra
'
];
dataSource
=
new
RoomListDataSource
(
this
.
ygopro
.
servers
.
filter
(
server
=>
server
.
custom
!
)
);
dataSource
=
new
RoomListDataSource
(
this
.
ygopro
);
constructor
(
public
login
:
LoginService
,
public
ygopro
:
YGOProService
,
private
changeDetector
:
ChangeDetectorRef
)
{}
...
...
src/app/server-select/server-select.component.html
View file @
b66f1ff2
环境:
<mat-form-field
appearance=
'standard'
>
<!-- <mat-label>Favorite food</mat-label>-->
<mat-select>
<mat-option
*ngFor=
'let server of
servers'
[value]=
'server.id
'
>
<mat-select
[(ngModel)]=
'ygopro.currentServer'
>
<mat-option
*ngFor=
'let server of
ygopro.selectableServers'
[value]=
'server
'
>
{{server.name}}
</mat-option>
</mat-select>
...
...
src/app/server-select/server-select.component.ts
View file @
b66f1ff2
import
{
Component
,
OnInit
}
from
'
@angular/core
'
;
import
{
YGOProService
}
from
'
../ygopro.service
'
;
@
Component
({
selector
:
'
app-server-select
'
,
...
...
@@ -7,9 +8,9 @@ import { Component, OnInit } from '@angular/core';
})
export
class
ServerSelectComponent
implements
OnInit
{
servers
=
[{
id
:
'
mycard
'
,
name
:
'
标准
'
},
{
id
:
'
test
'
,
name
:
'
测试
'
}];
//
servers = [{ id: 'mycard', name: '标准' }, { id: 'test', name: '测试' }];
constructor
()
{
constructor
(
public
ygopro
:
YGOProService
)
{
}
ngOnInit
()
{
...
...
src/app/watch/watch.component.ts
View file @
b66f1ff2
...
...
@@ -14,7 +14,7 @@ export class WatchComponent implements OnInit {
@
HostBinding
(
'
@routerTransition
'
)
animation
;
displayedColumns
=
[
'
mode
'
,
'
title
'
,
'
users
'
,
'
extra
'
];
dataSource
=
new
RoomListDataSource
(
this
.
ygopro
.
servers
,
'
started
'
);
dataSource
=
new
RoomListDataSource
(
this
.
ygopro
,
'
started
'
);
constructor
(
public
login
:
LoginService
,
public
ygopro
:
YGOProService
,
private
changeDetector
:
ChangeDetectorRef
)
{}
...
...
src/app/windbot/windbot.component.html
View file @
b66f1ff2
...
...
@@ -6,7 +6,7 @@
<mat-icon
mat-list-icon
>

</mat-icon>
<!-- airplanemode_active -->
<h4
mat-line
>
随机
</h4>
</mat-list-item>
<mat-list-item
*ngFor=
"let windbot of
ygopro.windbot | async
"
(click)=
"ygopro.join_windbot(windbot)"
>
<mat-list-item
*ngFor=
"let windbot of
(ygopro.currentServer ? ygopro.currentServer.windbot : [])
"
(click)=
"ygopro.join_windbot(windbot)"
>
<img
mat-list-icon
[src]=
"login.avatar(windbot)"
>
<h4
mat-line
>
{{windbot}}
</h4>
</mat-list-item>
...
...
src/app/ygopro.service.ts
View file @
b66f1ff2
...
...
@@ -119,7 +119,6 @@ export interface Points {
export
class
YGOProService
{
news
:
Promise
<
News
[]
>
;
topics
:
Promise
<
any
[]
>
;
windbot
:
Promise
<
string
[]
>
;
points
=
new
BehaviorSubject
<
Points
|
undefined
>
(
undefined
);
readonly
default_options
:
Options
=
{
...
...
@@ -136,27 +135,28 @@ export class YGOProService {
time_limit
:
180
,
auto_death
:
false
};
readonly
servers
:
Server
[]
=
[
{
id
:
'
tiramisu
'
,
url
:
'
wss://tiramisu.mycard.moe:7923
'
,
address
:
'
tiramisu.mycard.moe
'
,
port
:
7911
,
custom
:
true
,
replay
:
true
},
{
id
:
'
tiramisu-athletic
'
,
url
:
'
wss://tiramisu.mycard.moe:8923
'
,
address
:
'
tiramisu.mycard.moe
'
,
port
:
8911
,
custom
:
false
,
replay
:
true
}
];
serversPromise
:
Promise
<
Server
[]
>
;
servers
:
Server
[]
=
[];
selectableServers
:
Server
[]
=
[];
currentServer
:
Server
;
constructor
(
private
login
:
LoginService
,
private
http
:
HttpClient
,
private
dialog
:
MatDialog
,
private
storage
:
StorageService
)
{
const
app
=
this
.
http
.
get
<
App
[]
>
(
'
https://sapi.moecube.com:444/apps.json
'
).
pipe
(
map
(
apps
=>
apps
.
find
(
_app
=>
_app
.
id
===
'
ygopro
'
)
!
),
publishLast
(),
refCount
());
this
.
serversPromise
=
app
.
pipe
(
map
(
_app
=>
_app
.
data
.
servers
)
)
.
toPromise
();
this
.
serversPromise
.
then
((
servers
)
=>
{
this
.
servers
=
servers
;
this
.
selectableServers
=
servers
.
filter
(
s
=>
!
s
.
hidden
);
this
.
currentServer
=
this
.
selectableServers
[
0
];
})
this
.
news
=
app
.
pipe
(
map
(
_app
=>
...
...
@@ -171,7 +171,7 @@ export class YGOProService {
)
)
.
toPromise
();
this
.
windbot
=
app
.
pipe
(
map
(
_app
=>
(
<
YGOProData
>
_app
.
data
).
windbot
[
'
zh-CN
'
])).
toPromise
();
//
this.windbot = app.pipe(map(_app => (<YGOProData>_app.data).windbot['zh-CN'])).toPromise();
this
.
topics
=
this
.
http
.
get
<
TopResponse
>
(
'
https://ygobbs.com/top/quarterly.json
'
)
...
...
@@ -291,7 +291,7 @@ export class YGOProService {
// body: `房间密码是 ${this.host_password}, 您的对手可在自定义游戏界面输入密码与您对战。`
// });
// }
this
.
join
(
password
,
this
.
servers
[
0
]
);
this
.
join
(
password
,
this
.
currentServer
);
}
join_room
(
room
:
Room
)
{
...
...
@@ -329,14 +329,14 @@ export class YGOProService {
const
name
=
options_buffer
.
toString
(
'
base64
'
)
+
password
.
replace
(
/
\s
/
,
String
.
fromCharCode
(
0xfeff
));
this
.
join
(
name
,
this
.
servers
[
0
]
);
this
.
join
(
name
,
this
.
currentServer
);
}
async
join_windbot
(
name
?:
string
)
{
if
(
!
name
)
{
name
=
sample
(
await
this
.
windbot
);
name
=
sample
(
this
.
currentServer
.
windbot
!
);
}
return
this
.
join
(
'
AI#
'
+
name
,
this
.
servers
[
0
]
);
return
this
.
join
(
'
AI#
'
+
name
,
this
.
currentServer
);
}
join
(
password
:
string
,
server
:
Server
)
{
...
...
@@ -427,7 +427,7 @@ export class RoomListDataSource extends DataSource<Room> {
empty
=
new
EventEmitter
();
error
=
new
EventEmitter
();
constructor
(
private
servers
:
Server
[]
,
private
type
=
'
waiting
'
)
{
constructor
(
private
ygopro
:
YGOProService
,
private
type
=
'
waiting
'
)
{
super
();
}
...
...
@@ -435,7 +435,7 @@ export class RoomListDataSource extends DataSource<Room> {
connect
():
Observable
<
Room
[]
>
{
this
.
loading
.
emit
(
true
);
return
combineLatest
(
this
.
servers
.
map
(
server
=>
{
this
.
ygopro
.
servers
.
filter
(
s
=>
s
.
url
&&
(
s
.
custom
||
s
.
replay
))
.
map
(
server
=>
{
const
url
=
new
URL
(
server
.
url
!
);
url
.
searchParams
.
set
(
'
filter
'
,
this
.
type
);
// 协议处理
...
...
@@ -458,10 +458,10 @@ export class RoomListDataSource extends DataSource<Room> {
).
pipe
(
// 把多个服务器的数据拼接起来
map
((
sources
:
Room
[][])
=>
(
<
Room
[]
>
[]).
concat
(...
sources
)),
// 筛选一下房间,只扔进去当前房间或者竞技匹配的
// 房间排序
map
(
rooms
=>
sortBy
(
rooms
,
room
=>
{
sortBy
(
rooms
.
filter
(
r
=>
r
.
arena
||
r
.
server
===
this
.
ygopro
.
currentServer
)
,
room
=>
{
if
(
room
.
arena
===
'
athletic
'
)
{
return
0
;
}
else
if
(
room
.
arena
===
'
entertain
'
)
{
...
...
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