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() {
socketMiddleWare
({
cmd
:
socketCmd
.
SEND
,
payload
});
}
export
function
sendHsNotReady
()
{
// TODO
}
export
function
sendHsStart
()
{
const
hasStart
=
new
ygopro
.
YgoCtosMsg
({
ctos_hs_start
:
new
ygopro
.
CtosHsStart
({}),
...
...
src/ui/NewWaitRoom/index.tsx
View file @
232502b5
import
{
CheckCircleFilled
}
from
"
@ant-design/icons
"
;
import
{
ygopro
}
from
"
@/api
"
;
import
{
sendHsNotReady
,
sendHsReady
,
sendUpdateDeck
,
ygopro
}
from
"
@/api
"
;
import
PlayerState
=
ygopro
.
StocHsPlayerChange
.
State
;
import
{
Avatar
,
Button
,
ConfigProvider
,
Popover
,
Skeleton
,
Space
}
from
"
antd
"
;
import
classNames
from
"
classnames
"
;
import
{
forwardRef
,
useImperativeHandle
,
useRef
,
useState
}
from
"
react
"
;
import
{
forwardRef
,
useEffect
,
useImperativeHandle
,
useRef
,
useState
,
}
from
"
react
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
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
{
Chat
}
from
"
./Chat
"
;
...
...
@@ -35,10 +41,17 @@ const theme = {
export
const
Component
:
React
.
FC
=
()
=>
{
const
{
user
}
=
useSnapshot
(
accountStore
);
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 ref = useRef<MoraButtonRef>(null);
// ref.current?.getMoraResult(); // 用这个来异步获取猜拳结果
useEffect
(()
=>
{
sendUpdateDeck
(
deck
);
window
.
myExtraDeckCodes
=
[...
deck
.
extra
];
},
[
deck
]);
return
(
<
ConfigProvider
theme=
{
theme
}
>
<
div
...
...
@@ -60,7 +73,17 @@ export const Component: React.FC = () => {
<LoadingOutlined />
对方正在选择先后
</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
"
]
}
>
<
PlayerZone
who=
{
Who
.
Me
}
...
...
@@ -68,8 +91,18 @@ export const Component: React.FC = () => {
avatar=
{
user
?.
avatar_url
}
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
>
{
/* <MoraButton ref={ref} /> */
}
</>
...
...
@@ -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
(
<
Space
>
<
Select
title=
"卡组"
showSearch
defaultValue=
"lucy"
style=
{
{
width
:
300
}
}
options=
{
[
{
value
:
"
jack
"
,
label
:
"
Jack
"
},
{
value
:
"
lucy
"
,
label
:
"
Lucy
"
},
{
value
:
"
Yiminghe
"
,
label
:
"
yiminghe
"
},
{
value
:
"
disabled
"
,
label
:
"
Disabled
"
,
disabled
:
true
},
]
}
defaultValue=
{
snap
.
decks
[
0
].
deckName
}
options=
{
snap
.
decks
.
map
((
deck
)
=>
({
value
:
deck
.
deckName
,
title
:
deck
.
deckName
,
}))
}
onChange=
{
// @ts-ignore
(
value
)
=>
onDeckChange
(
value
)
}
/>
<
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