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
89281266
Commit
89281266
authored
Aug 18, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
7340e81b
Pipeline
#23189
passed with stages
in 10 minutes and 47 seconds
Changes
11
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
134 additions
and
96 deletions
+134
-96
src/service/duel/start.ts
src/service/duel/start.ts
+3
-4
src/service/room/duelStart.ts
src/service/room/duelStart.ts
+5
-5
src/service/side/changeSide.ts
src/service/side/changeSide.ts
+2
-2
src/service/side/waitingSide.ts
src/service/side/waitingSide.ts
+2
-2
src/stores/index.ts
src/stores/index.ts
+8
-0
src/stores/sideStore.ts
src/stores/sideStore.ts
+18
-7
src/ui/Duel/Main.tsx
src/ui/Duel/Main.tsx
+12
-3
src/ui/Duel/Message/EndModal/index.tsx
src/ui/Duel/Message/EndModal/index.tsx
+2
-2
src/ui/Side/ChangeSideModal/index.tsx
src/ui/Side/ChangeSideModal/index.tsx
+75
-0
src/ui/Side/MoraTpModal/index.tsx
src/ui/Side/MoraTpModal/index.tsx
+5
-0
src/ui/Side/index.tsx
src/ui/Side/index.tsx
+2
-71
No files found.
src/service/duel/start.ts
View file @
89281266
...
@@ -12,6 +12,7 @@ import {
...
@@ -12,6 +12,7 @@ import {
matStore
,
matStore
,
RoomStage
,
RoomStage
,
roomStore
,
roomStore
,
SideStage
,
sideStore
,
sideStore
,
}
from
"
@/stores
"
;
}
from
"
@/stores
"
;
import
{
replayStart
}
from
"
@/ui/Match/ReplayModal
"
;
import
{
replayStart
}
from
"
@/ui/Match/ReplayModal
"
;
...
@@ -30,10 +31,8 @@ export default async (start: ygopro.StocGameMessage.MsgStart) => {
...
@@ -30,10 +31,8 @@ export default async (start: ygopro.StocGameMessage.MsgStart) => {
// 这行在该函数中的位置不能随便放,否则可能会block住
// 这行在该函数中的位置不能随便放,否则可能会block住
roomStore
.
stage
=
RoomStage
.
DUEL_START
;
roomStore
.
stage
=
RoomStage
.
DUEL_START
;
// 关闭side
// 更新Side状态
sideStore
.
siding
=
false
;
sideStore
.
stage
=
SideStage
.
DUEL_START
;
sideStore
.
waiting
=
false
;
sideStore
.
ready
=
false
;
matStore
.
initInfo
.
set
(
0
,
{
matStore
.
initInfo
.
set
(
0
,
{
life
:
start
.
life1
,
life
:
start
.
life1
,
...
...
src/service/room/duelStart.ts
View file @
89281266
import
{
ygopro
}
from
"
@/api
"
;
import
{
ygopro
}
from
"
@/api
"
;
import
{
RoomStage
,
roomStore
,
sideStore
}
from
"
@/stores
"
;
import
{
RoomStage
,
roomStore
,
SideStage
,
sideStore
}
from
"
@/stores
"
;
export
default
function
handleDuelStart
(
_pb
:
ygopro
.
YgoStocMsg
)
{
export
default
function
handleDuelStart
(
_pb
:
ygopro
.
YgoStocMsg
)
{
if
(
sideStore
.
stage
!==
SideStage
.
NONE
)
{
sideStore
.
stage
=
SideStage
.
SIDE_CHANGED
;
}
else
{
roomStore
.
stage
=
RoomStage
.
MORA
;
roomStore
.
stage
=
RoomStage
.
MORA
;
if
(
sideStore
.
siding
)
{
// 副卡组更换完毕
sideStore
.
ready
=
true
;
}
}
}
}
src/service/side/changeSide.ts
View file @
89281266
import
{
ygopro
}
from
"
@/api
"
;
import
{
ygopro
}
from
"
@/api
"
;
import
{
sideStore
}
from
"
@/stores
"
;
import
{
SideStage
,
sideStore
}
from
"
@/stores
"
;
export
function
handleChangeSide
(
_
:
ygopro
.
StocChangeSide
)
{
export
function
handleChangeSide
(
_
:
ygopro
.
StocChangeSide
)
{
sideStore
.
s
iding
=
true
;
sideStore
.
s
tage
=
SideStage
.
SIDE_CHANGING
;
}
}
src/service/side/waitingSide.ts
View file @
89281266
import
{
ygopro
}
from
"
@/api
"
;
import
{
ygopro
}
from
"
@/api
"
;
import
{
sideStore
}
from
"
@/stores
"
;
import
{
SideStage
,
sideStore
}
from
"
@/stores
"
;
export
function
handleWaitingSide
(
_
:
ygopro
.
StocWaitingSide
)
{
export
function
handleWaitingSide
(
_
:
ygopro
.
StocWaitingSide
)
{
sideStore
.
waiting
=
true
;
sideStore
.
stage
=
SideStage
.
WAITING
;
}
}
src/stores/index.ts
View file @
89281266
...
@@ -46,4 +46,12 @@ export const resetUniverse = () => {
...
@@ -46,4 +46,12 @@ export const resetUniverse = () => {
placeStore
.
reset
();
placeStore
.
reset
();
replayStore
.
reset
();
replayStore
.
reset
();
roomStore
.
reset
();
roomStore
.
reset
();
sideStore
.
reset
();
};
// 重置决斗相关的`Store`
export
const
resetDuel
=
()
=>
{
cardStore
.
reset
();
matStore
.
reset
();
placeStore
.
reset
();
};
};
src/stores/sideStore.ts
View file @
89281266
...
@@ -3,15 +3,26 @@ import { proxy } from "valtio";
...
@@ -3,15 +3,26 @@ import { proxy } from "valtio";
import
{
IDeck
}
from
"
./deckStore
"
;
import
{
IDeck
}
from
"
./deckStore
"
;
import
{
type
NeosStore
}
from
"
./shared
"
;
import
{
type
NeosStore
}
from
"
./shared
"
;
export
enum
SideStage
{
NONE
=
0
,
// 没有进入SIDE阶段
SIDE_CHANGING
=
1
,
// 正在更换副卡组
SIDE_CHANGED
=
2
,
// 副卡组更换完毕
HAND_SELECTING
=
3
,
// 选择猜拳中
HAND_SELECTED
=
4
,
// 猜拳选择完毕
TP_SELECTING
=
5
,
// 正在选边
TP_SELECTED
=
6
,
// 选边完成
DUEL_START
=
7
,
// 决斗开始
WAITING
=
8
,
// 观战者等待双方玩家
}
const
emptyDeck
:
IDeck
=
{
deckName
:
""
,
main
:
[],
extra
:
[],
side
:
[]
};
class
SideStore
implements
NeosStore
{
class
SideStore
implements
NeosStore
{
siding
:
boolean
=
false
;
stage
:
SideStage
=
SideStage
.
WAITING
;
ready
:
boolean
=
false
;
deck
:
IDeck
=
emptyDeck
;
waiting
:
boolean
=
false
;
// 观战的时候等待双方更换副卡组
deck
?:
IDeck
;
reset
():
void
{
reset
():
void
{
this
.
siding
=
false
;
this
.
stage
=
SideStage
.
NONE
;
this
.
ready
=
false
;
this
.
deck
=
emptyDeck
;
this
.
deck
=
undefined
;
}
}
}
}
...
...
src/ui/Duel/Main.tsx
View file @
89281266
import
React
from
"
react
"
;
import
React
,
{
useEffect
}
from
"
react
"
;
import
{
SideModal
}
from
"
../Side
"
;
import
{
resetUniverse
}
from
"
@/stores
"
;
import
{
ChangeSideModal
}
from
"
../Side
"
;
import
{
import
{
Alert
,
Alert
,
AnnounceModal
,
AnnounceModal
,
...
@@ -19,6 +21,13 @@ import {
...
@@ -19,6 +21,13 @@ import {
import
{
LifeBar
,
Mat
,
Menu
,
Underlying
}
from
"
./PlayMat
"
;
import
{
LifeBar
,
Mat
,
Menu
,
Underlying
}
from
"
./PlayMat
"
;
export
const
Component
:
React
.
FC
=
()
=>
{
export
const
Component
:
React
.
FC
=
()
=>
{
useEffect
(()
=>
{
return
()
=>
{
// Duel组件卸载的时候初始化一些store
resetUniverse
();
};
},
[]);
return
(
return
(
<>
<>
<
Underlying
/>
<
Underlying
/>
...
@@ -38,7 +47,7 @@ export const Component: React.FC = () => {
...
@@ -38,7 +47,7 @@ export const Component: React.FC = () => {
<
AnnounceModal
/>
<
AnnounceModal
/>
<
SimpleSelectCardsModal
/>
<
SimpleSelectCardsModal
/>
<
EndModal
/>
<
EndModal
/>
<
SideModal
/>
<
Change
SideModal
/>
</>
</>
);
);
};
};
...
...
src/ui/Duel/Message/EndModal/index.tsx
View file @
89281266
...
@@ -2,7 +2,7 @@ import React, { CSSProperties } from "react";
...
@@ -2,7 +2,7 @@ import React, { CSSProperties } from "react";
import
{
proxy
,
useSnapshot
}
from
"
valtio
"
;
import
{
proxy
,
useSnapshot
}
from
"
valtio
"
;
import
{
fetchStrings
,
Region
}
from
"
@/api
"
;
import
{
fetchStrings
,
Region
}
from
"
@/api
"
;
import
{
matStore
,
replayStore
,
reset
Universe
}
from
"
@/stores
"
;
import
{
matStore
,
replayStore
,
reset
Duel
}
from
"
@/stores
"
;
import
{
NeosModal
}
from
"
../NeosModal
"
;
import
{
NeosModal
}
from
"
../NeosModal
"
;
import
styles
from
"
./index.module.scss
"
;
import
styles
from
"
./index.module.scss
"
;
...
@@ -25,7 +25,7 @@ export const EndModal: React.FC = () => {
...
@@ -25,7 +25,7 @@ export const EndModal: React.FC = () => {
const
{
isReplay
}
=
useSnapshot
(
matStore
);
const
{
isReplay
}
=
useSnapshot
(
matStore
);
const
onReturn
=
()
=>
{
const
onReturn
=
()
=>
{
reset
Universe
();
reset
Duel
();
rs
();
rs
();
// TODO: 这里暂时不自动跳转,决斗结束后让玩家自己手动选择回到主页
// TODO: 这里暂时不自动跳转,决斗结束后让玩家自己手动选择回到主页
};
};
...
...
src/ui/Side/ChangeSideModal/index.tsx
0 → 100644
View file @
89281266
import
{
App
,
Button
,
Modal
}
from
"
antd
"
;
import
React
,
{
useEffect
}
from
"
react
"
;
import
{
DndProvider
}
from
"
react-dnd
"
;
import
{
HTML5Backend
}
from
"
react-dnd-html5-backend
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
import
{
CardMeta
,
sendUpdateDeck
}
from
"
@/api
"
;
import
{
roomStore
,
SideStage
,
sideStore
}
from
"
@/stores
"
;
import
{
DeckEditor
}
from
"
../../BuildDeck
"
;
import
{
editDeckStore
}
from
"
../../BuildDeck/store
"
;
import
{
iDeckToEditingDeck
}
from
"
../../BuildDeck/utils
"
;
import
{
Background
}
from
"
../../Shared
"
;
export
const
ChangeSideModal
:
React
.
FC
=
()
=>
{
const
{
message
}
=
App
.
useApp
();
const
{
deckName
,
main
,
extra
,
side
}
=
editDeckStore
;
const
{
stage
}
=
useSnapshot
(
sideStore
);
const
{
errorMsg
}
=
useSnapshot
(
roomStore
);
const
cardMeta2Id
=
(
meta
:
CardMeta
)
=>
meta
.
id
;
const
handleSummit
=
()
=>
{
const
newDeck
=
{
deckName
:
deckName
,
main
:
main
.
map
(
cardMeta2Id
),
extra
:
extra
.
map
(
cardMeta2Id
),
side
:
side
.
map
(
cardMeta2Id
),
};
sendUpdateDeck
(
newDeck
);
editDeckStore
.
edited
=
false
;
};
useEffect
(()
=>
{
if
(
stage
===
SideStage
.
SIDE_CHANGED
)
{
message
.
info
(
"
副卡组更换成功,请耐心等待其他玩家更换卡组
"
);
}
},
[
stage
]);
useEffect
(()
=>
{
if
(
errorMsg
!==
undefined
&&
errorMsg
!==
""
)
{
message
.
error
(
errorMsg
);
roomStore
.
errorMsg
=
undefined
;
}
},
[
errorMsg
]);
return
(
<
Modal
title=
"请选择更换副卡组"
open=
{
stage
===
SideStage
.
SIDE_CHANGING
||
stage
===
SideStage
.
SIDE_CHANGED
}
width=
{
700
}
closable=
{
false
}
footer=
{
<
Button
disabled=
{
stage
>
SideStage
.
SIDE_CHANGING
}
onClick=
{
handleSummit
}
>
副卡组更换完毕
</
Button
>
}
>
<
DndProvider
backend=
{
HTML5Backend
}
>
<
Background
/>
<
DeckEditor
deck=
{
sideStore
.
deck
}
onClear=
{
()
=>
message
.
error
(
"
对局中清空卡组不怕找不回来吗?!
"
)
}
onSave=
{
()
=>
message
.
error
(
"
点击右下角按钮确认副卡组更换完毕
"
)
}
onReset=
{
async
()
=>
{
editDeckStore
.
set
(
await
iDeckToEditingDeck
(
sideStore
.
deck
));
}
}
/>
</
DndProvider
>
</
Modal
>
);
};
src/ui/Side/MoraTpModal/index.tsx
0 → 100644
View file @
89281266
import
React
from
"
react
"
;
export
const
MoraTpModal
:
React
.
FC
=
()
=>
{
return
<></>;
};
src/ui/Side/index.tsx
View file @
89281266
import
{
App
,
Button
,
Modal
}
from
"
antd
"
;
export
*
from
"
./ChangeSideModal
"
;
import
React
,
{
useEffect
}
from
"
react
"
;
export
*
from
"
./MoraTpModal
"
;
import
{
DndProvider
}
from
"
react-dnd
"
;
import
{
HTML5Backend
}
from
"
react-dnd-html5-backend
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
import
{
CardMeta
,
sendUpdateDeck
}
from
"
@/api
"
;
import
{
deckStore
,
roomStore
,
sideStore
}
from
"
@/stores
"
;
import
{
DeckEditor
}
from
"
../BuildDeck
"
;
import
{
editDeckStore
}
from
"
../BuildDeck/store
"
;
import
{
iDeckToEditingDeck
}
from
"
../BuildDeck/utils
"
;
import
{
Background
}
from
"
../Shared
"
;
export
const
SideModal
:
React
.
FC
=
()
=>
{
const
deck
=
deckStore
.
decks
[
0
];
const
{
message
}
=
App
.
useApp
();
const
{
deckName
,
main
,
extra
,
side
}
=
editDeckStore
;
const
{
siding
,
ready
}
=
useSnapshot
(
sideStore
);
const
{
errorMsg
}
=
useSnapshot
(
roomStore
);
const
cardMeta2Id
=
(
meta
:
CardMeta
)
=>
meta
.
id
;
const
handleSummit
=
()
=>
{
const
newDeck
=
{
deckName
:
deckName
,
main
:
main
.
map
(
cardMeta2Id
),
extra
:
extra
.
map
(
cardMeta2Id
),
side
:
side
.
map
(
cardMeta2Id
),
};
sendUpdateDeck
(
newDeck
);
editDeckStore
.
edited
=
false
;
};
useEffect
(()
=>
{
if
(
ready
)
{
message
.
info
(
"
副卡组更换成功,请耐心等待其他玩家更换卡组
"
);
}
},
[
ready
]);
useEffect
(()
=>
{
if
(
errorMsg
!==
undefined
&&
errorMsg
!==
""
)
{
message
.
error
(
errorMsg
);
roomStore
.
errorMsg
=
undefined
;
}
},
[
errorMsg
]);
return
(
<
Modal
title=
"请选择更换副卡组"
open=
{
siding
}
width=
{
700
}
closable=
{
false
}
footer=
{
<
Button
disabled=
{
ready
}
onClick=
{
handleSummit
}
>
副卡组更换完毕
</
Button
>
}
>
<
DndProvider
backend=
{
HTML5Backend
}
>
<
Background
/>
<
DeckEditor
deck=
{
deck
}
onClear=
{
()
=>
message
.
error
(
"
对局中清空卡组不怕找不回来吗?!
"
)
}
onSave=
{
()
=>
message
.
error
(
"
点击右下角按钮确认副卡组更换完毕
"
)
}
onReset=
{
async
()
=>
{
editDeckStore
.
set
(
await
iDeckToEditingDeck
(
deck
));
}
}
/>
</
DndProvider
>
</
Modal
>
);
};
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