Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
Neos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
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
Neos
Commits
232502b5
Commit
232502b5
authored
Aug 07, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update NewWaitRoom
parent
3aea11bc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
14 deletions
+56
-14
src/api/ocgcore/ocgHelper.ts
src/api/ocgcore/ocgHelper.ts
+4
-0
src/ui/NewWaitRoom/index.tsx
src/ui/NewWaitRoom/index.tsx
+52
-14
No files found.
src/api/ocgcore/ocgHelper.ts
View file @
232502b5
...
@@ -42,6 +42,10 @@ export function sendHsReady() {
...
@@ -42,6 +42,10 @@ export function sendHsReady() {
socketMiddleWare
({
cmd
:
socketCmd
.
SEND
,
payload
});
socketMiddleWare
({
cmd
:
socketCmd
.
SEND
,
payload
});
}
}
export
function
sendHsNotReady
()
{
// TODO
}
export
function
sendHsStart
()
{
export
function
sendHsStart
()
{
const
hasStart
=
new
ygopro
.
YgoCtosMsg
({
const
hasStart
=
new
ygopro
.
YgoCtosMsg
({
ctos_hs_start
:
new
ygopro
.
CtosHsStart
({}),
ctos_hs_start
:
new
ygopro
.
CtosHsStart
({}),
...
...
src/ui/NewWaitRoom/index.tsx
View file @
232502b5
import
{
CheckCircleFilled
}
from
"
@ant-design/icons
"
;
import
{
CheckCircleFilled
}
from
"
@ant-design/icons
"
;
import
{
ygopro
}
from
"
@/api
"
;
import
{
sendHsNotReady
,
sendHsReady
,
sendUpdateDeck
,
ygopro
}
from
"
@/api
"
;
import
PlayerState
=
ygopro
.
StocHsPlayerChange
.
State
;
import
PlayerState
=
ygopro
.
StocHsPlayerChange
.
State
;
import
{
Avatar
,
Button
,
ConfigProvider
,
Popover
,
Skeleton
,
Space
}
from
"
antd
"
;
import
{
Avatar
,
Button
,
ConfigProvider
,
Popover
,
Skeleton
,
Space
}
from
"
antd
"
;
import
classNames
from
"
classnames
"
;
import
classNames
from
"
classnames
"
;
import
{
forwardRef
,
useImperativeHandle
,
useRef
,
useState
}
from
"
react
"
;
import
{
forwardRef
,
useEffect
,
useImperativeHandle
,
useRef
,
useState
,
}
from
"
react
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
import
{
useConfig
}
from
"
@/config
"
;
import
{
useConfig
}
from
"
@/config
"
;
import
{
accountStore
,
Player
,
roomStore
}
from
"
@/stores
"
;
import
{
accountStore
,
deckStore
,
IDeck
,
Player
,
roomStore
}
from
"
@/stores
"
;
import
{
Background
,
IconFont
,
Select
}
from
"
@/ui/Shared
"
;
import
{
Background
,
IconFont
,
Select
}
from
"
@/ui/Shared
"
;
import
{
Chat
}
from
"
./Chat
"
;
import
{
Chat
}
from
"
./Chat
"
;
...
@@ -35,10 +41,17 @@ const theme = {
...
@@ -35,10 +41,17 @@ const theme = {
export
const
Component
:
React
.
FC
=
()
=>
{
export
const
Component
:
React
.
FC
=
()
=>
{
const
{
user
}
=
useSnapshot
(
accountStore
);
const
{
user
}
=
useSnapshot
(
accountStore
);
const
[
collapsed
,
setCollapsed
]
=
useState
(
false
);
const
[
collapsed
,
setCollapsed
]
=
useState
(
false
);
const
{
decks
}
=
useSnapshot
(
deckStore
);
const
[
deck
,
setDeck
]
=
useState
<
IDeck
>
(
JSON
.
parse
(
JSON
.
stringify
(
decks
[
0
])));
const
room
=
useSnapshot
(
roomStore
);
const
room
=
useSnapshot
(
roomStore
);
// const ref = useRef<MoraButtonRef>(null);
// const ref = useRef<MoraButtonRef>(null);
// ref.current?.getMoraResult(); // 用这个来异步获取猜拳结果
// ref.current?.getMoraResult(); // 用这个来异步获取猜拳结果
useEffect
(()
=>
{
sendUpdateDeck
(
deck
);
window
.
myExtraDeckCodes
=
[...
deck
.
extra
];
},
[
deck
]);
return
(
return
(
<
ConfigProvider
theme=
{
theme
}
>
<
ConfigProvider
theme=
{
theme
}
>
<
div
<
div
...
@@ -60,7 +73,17 @@ export const Component: React.FC = () => {
...
@@ -60,7 +73,17 @@ export const Component: React.FC = () => {
<LoadingOutlined />
<LoadingOutlined />
对方正在选择先后
对方正在选择先后
</div> */
}
</div> */
}
<
Controller
/>
<
Controller
onDeckChange=
{
(
deckName
:
string
)
=>
{
const
deck
=
deckStore
.
get
(
deckName
);
// 同步后端
if
(
deck
)
{
setDeck
(
deck
);
}
else
{
alert
(
`Deck ${deckName} not found`
);
}
}
}
/>
<
div
className=
{
styles
[
"
both-side-container
"
]
}
>
<
div
className=
{
styles
[
"
both-side-container
"
]
}
>
<
PlayerZone
<
PlayerZone
who=
{
Who
.
Me
}
who=
{
Who
.
Me
}
...
@@ -68,8 +91,18 @@ export const Component: React.FC = () => {
...
@@ -68,8 +91,18 @@ export const Component: React.FC = () => {
avatar=
{
user
?.
avatar_url
}
avatar=
{
user
?.
avatar_url
}
btn=
{
btn=
{
<>
<>
<
Button
size=
"large"
className=
{
styles
[
"
btn-join
"
]
}
>
<
Button
决斗准备
size=
"large"
className=
{
styles
[
"
btn-join
"
]
}
onClick=
{
()
=>
{
room
.
getMePlayer
().
state
==
PlayerState
.
NO_READY
?
sendHsReady
()
:
sendHsNotReady
();
}
}
>
{
room
.
getMePlayer
().
state
==
PlayerState
.
NO_READY
?
"
决斗准备
"
:
"
取消准备
"
}
</
Button
>
</
Button
>
{
/* <MoraButton ref={ref} /> */
}
{
/* <MoraButton ref={ref} /> */
}
</>
</>
...
@@ -218,20 +251,25 @@ const PlayerZone: React.FC<{
...
@@ -218,20 +251,25 @@ const PlayerZone: React.FC<{
);
);
};
};
const
Controller
:
React
.
FC
=
()
=>
{
const
Controller
:
React
.
FC
<
{
onDeckChange
:
(
deckName
:
string
)
=>
void
}
>
=
({
onDeckChange
,
})
=>
{
const
snap
=
useSnapshot
(
deckStore
);
return
(
return
(
<
Space
>
<
Space
>
<
Select
<
Select
title=
"卡组"
title=
"卡组"
showSearch
showSearch
defaultValue=
"lucy"
style=
{
{
width
:
300
}
}
style=
{
{
width
:
300
}
}
options=
{
[
defaultValue=
{
snap
.
decks
[
0
].
deckName
}
{
value
:
"
jack
"
,
label
:
"
Jack
"
},
options=
{
snap
.
decks
.
map
((
deck
)
=>
({
{
value
:
"
lucy
"
,
label
:
"
Lucy
"
},
value
:
deck
.
deckName
,
{
value
:
"
Yiminghe
"
,
label
:
"
yiminghe
"
},
title
:
deck
.
deckName
,
{
value
:
"
disabled
"
,
label
:
"
Disabled
"
,
disabled
:
true
},
}))
}
]
}
onChange=
{
// @ts-ignore
(
value
)
=>
onDeckChange
(
value
)
}
/>
/>
<
Button
size=
"large"
icon=
{
<
IconFont
type=
"icon-record"
size=
{
18
}
/>
}
>
<
Button
size=
"large"
icon=
{
<
IconFont
type=
"icon-record"
size=
{
18
}
/>
}
>
加入观战
加入观战
...
...
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