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
11a974ad
Commit
11a974ad
authored
Jul 27, 2024
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add auto return to single mode
parent
102cf9fc
Pipeline
#28717
passed with stages
in 19 minutes and 53 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
4 deletions
+31
-4
src/common.ts
src/common.ts
+5
-0
src/service/room/duelEnd.ts
src/service/room/duelEnd.ts
+0
-1
src/service/room/joinGame.ts
src/service/room/joinGame.ts
+7
-2
src/stores/roomStore.ts
src/stores/roomStore.ts
+11
-0
src/ui/Duel/Message/EndModal/index.tsx
src/ui/Duel/Message/EndModal/index.tsx
+8
-1
No files found.
src/common.ts
View file @
11a974ad
...
...
@@ -3,6 +3,11 @@ import PhaseType = ygopro.StocGameMessage.MsgNewPhase.PhaseType;
import
{
CardMeta
}
from
"
@/api
"
;
//! 一些Neos中基础的数据结构
// Mode
export
const
MODE_SINGLE
=
0x0
;
export
const
MODE_MATCH
=
0x1
;
export
const
MODE_TAG
=
0x2
;
// Position
export
const
FACEUP_ATTACK
=
0x1
;
...
...
src/service/room/duelEnd.ts
View file @
11a974ad
...
...
@@ -5,6 +5,5 @@ export default function handleDuelEnd(
container
:
Container
,
_pb
:
ygopro
.
YgoStocMsg
,
)
{
console
.
log
(
"
duel end
"
);
container
.
context
.
matStore
.
duelEnd
=
true
;
}
src/service/room/joinGame.ts
View file @
11a974ad
...
...
@@ -5,6 +5,11 @@ export default function handleJoinGame(
container
:
Container
,
pb
:
ygopro
.
YgoStocMsg
,
)
{
const
_msg
=
pb
.
stoc_join_game
;
container
.
context
.
roomStore
.
joined
=
true
;
const
context
=
container
.
context
;
const
msg
=
pb
.
stoc_join_game
;
console
.
log
(
msg
.
mode
);
context
.
roomStore
.
joined
=
true
;
context
.
roomStore
.
mode
=
msg
.
mode
;
}
src/stores/roomStore.ts
View file @
11a974ad
...
...
@@ -5,6 +5,8 @@ import { ygopro } from "@/api";
import
StocHsPlayerChange
=
ygopro
.
StocHsPlayerChange
;
import
SelfType
=
ygopro
.
StocTypeChange
.
SelfType
;
import
HandType
=
ygopro
.
HandType
;
import
{
MODE_MATCH
,
MODE_SINGLE
,
MODE_TAG
}
from
"
@/common
"
;
import
{
type
NeosStore
}
from
"
./shared
"
;
export
interface
Player
{
...
...
@@ -33,6 +35,13 @@ export enum RoomStage {
DUEL_START
=
6
,
// 决斗开始
}
// Duel Mode
export
enum
DuelMode
{
SINGLE
=
MODE_SINGLE
,
MATCH
=
MODE_MATCH
,
TAG
=
MODE_TAG
,
}
export
class
RoomStore
implements
NeosStore
{
joined
:
boolean
=
false
;
// 是否已经加入房间
players
:
(
Player
|
undefined
)[]
=
Array
.
from
({
length
:
4
}).
map
(
...
...
@@ -43,6 +52,7 @@ export class RoomStore implements NeosStore {
selfType
:
SelfType
=
0
;
// 当前玩家的类型
stage
:
RoomStage
=
RoomStage
.
WAITING
;
errorMsg
?:
string
=
undefined
;
// 错误信息
mode
?:
DuelMode
=
undefined
;
// 当前对局模式
getMePlayer
()
{
return
this
.
players
.
find
((
player
)
=>
player
?.
isMe
);
...
...
@@ -58,6 +68,7 @@ export class RoomStore implements NeosStore {
this
.
isHost
=
false
;
this
.
stage
=
RoomStage
.
WAITING
;
this
.
errorMsg
=
undefined
;
this
.
mode
=
undefined
;
}
}
...
...
src/ui/Duel/Message/EndModal/index.tsx
View file @
11a974ad
import
React
,
{
CSSProperties
}
from
"
react
"
;
import
{
useNavigate
}
from
"
react-router-dom
"
;
import
{
proxy
,
useSnapshot
}
from
"
valtio
"
;
import
{
fetchStrings
,
Region
}
from
"
@/api
"
;
import
{
replayStore
,
resetDuel
}
from
"
@/stores
"
;
import
{
DuelMode
,
replayStore
,
resetDuel
,
roomStore
}
from
"
@/stores
"
;
import
{
NeosModal
}
from
"
../NeosModal
"
;
import
styles
from
"
./index.module.scss
"
;
...
...
@@ -23,10 +24,16 @@ const localStore = proxy(defaultProps);
export
const
EndModal
:
React
.
FC
=
()
=>
{
const
{
isOpen
,
isWin
,
reason
}
=
useSnapshot
(
localStore
);
const
{
isReplay
}
=
useSnapshot
(
replayStore
);
const
navigate
=
useNavigate
();
const
onReturn
=
()
=>
{
resetDuel
();
rs
();
if
(
roomStore
.
mode
===
DuelMode
.
SINGLE
)
{
// duel end in single mode, return to match page
navigate
(
"
/match
"
);
}
};
return
(
...
...
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