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
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
BBeretta
Neos
Commits
79611cf5
Commit
79611cf5
authored
May 08, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'opt/hint/phase' into 'main'
Opt/hint/phase See merge request
!183
parents
2d11321c
bd4e2d66
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
34 deletions
+38
-34
src/common.ts
src/common.ts
+15
-0
src/service/duel/newPhase.ts
src/service/duel/newPhase.ts
+2
-5
src/stores/matStore/store.ts
src/stores/matStore/store.ts
+1
-1
src/stores/matStore/types.ts
src/stores/matStore/types.ts
+1
-4
src/ui/Duel/Message/HintNotification.tsx
src/ui/Duel/Message/HintNotification.tsx
+7
-3
src/ui/Duel/PlayMat/Menu.tsx
src/ui/Duel/PlayMat/Menu.tsx
+12
-21
No files found.
src/common.ts
View file @
79611cf5
import
{
ygopro
}
from
"
@/api
"
;
import
PhaseType
=
ygopro
.
StocGameMessage
.
MsgNewPhase
.
PhaseType
;
//! 一些Neos中基础的数据结构
// 类型
...
...
@@ -220,3 +222,16 @@ export const QUERY_STATUS = 0x80000;
export
const
QUERY_LSCALE
=
0x200000
;
export
const
QUERY_RSCALE
=
0x400000
;
export
const
QUERY_LINK
=
0x800000
;
export
const
Phase2StringCodeMap
:
Map
<
number
,
number
>
=
new
Map
([
[
PhaseType
.
DRAW
,
20
],
[
PhaseType
.
STANDBY
,
21
],
[
PhaseType
.
MAIN1
,
22
],
[
PhaseType
.
BATTLE_START
,
28
],
[
PhaseType
.
BATTLE_STEP
,
29
],
[
PhaseType
.
DAMAGE
,
40
],
[
PhaseType
.
DAMAGE_GAL
,
42
],
[
PhaseType
.
BATTLE
,
24
],
[
PhaseType
.
MAIN2
,
22
],
[
PhaseType
.
END
,
26
],
]);
src/service/duel/newPhase.ts
View file @
79611cf5
import
{
ygopro
}
from
"
@/api
"
;
import
{
matStore
,
type
PhaseName
}
from
"
@/stores
"
;
import
{
matStore
}
from
"
@/stores
"
;
export
default
(
newPhase
:
ygopro
.
StocGameMessage
.
MsgNewPhase
)
=>
{
// ts本身还没有这么智能,所以需要手动指定类型
const
currentPhase
=
ygopro
.
StocGameMessage
.
MsgNewPhase
.
PhaseType
[
newPhase
.
phase_type
]
as
PhaseName
;
matStore
.
phase
.
currentPhase
=
currentPhase
;
matStore
.
phase
.
currentPhase
=
newPhase
.
phase_type
;
};
src/stores/matStore/store.ts
View file @
79611cf5
...
...
@@ -232,7 +232,7 @@ export const matStore: MatState = proxy<MatState>({
hint
,
currentPlayer
:
-
1
,
phase
:
{
currentPhase
:
"
UNKNOWN
"
,
// TODO 当前的阶段 应该改成enum
currentPhase
:
ygopro
.
StocGameMessage
.
MsgNewPhase
.
PhaseType
.
UNKNOWN
,
// TODO 当前的阶段 应该改成enum
enableBp
:
false
,
// 允许进入战斗阶段
enableM2
:
false
,
// 允许进入M2阶段
enableEp
:
false
,
// 允许回合结束
...
...
src/stores/matStore/types.ts
View file @
79611cf5
...
...
@@ -189,11 +189,8 @@ export interface HintState {
esSelectHint
?:
string
;
}
export
type
PhaseName
=
keyof
typeof
ygopro
.
StocGameMessage
.
MsgNewPhase
.
PhaseType
;
export
interface
PhaseState
{
currentPhase
:
PhaseNam
e
;
// TODO 当前的阶段 应该改成enum
currentPhase
:
ygopro
.
StocGameMessage
.
MsgNewPhase
.
PhaseTyp
e
;
// TODO 当前的阶段 应该改成enum
enableBp
:
boolean
;
// 允许进入战斗阶段
enableM2
:
boolean
;
// 允许进入M2阶段
enableEp
:
boolean
;
// 允许回合结束
...
...
src/ui/Duel/Message/HintNotification.tsx
View file @
79611cf5
...
...
@@ -3,7 +3,8 @@ import React, { useEffect } from "react";
import
{
useNavigate
}
from
"
react-router-dom
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
import
{
ygopro
}
from
"
@/api
"
;
import
{
fetchStrings
,
ygopro
}
from
"
@/api
"
;
import
{
Phase2StringCodeMap
}
from
"
@/common
"
;
import
{
useConfig
}
from
"
@/config
"
;
import
{
matStore
}
from
"
@/stores
"
;
...
...
@@ -41,7 +42,10 @@ export const HintNotification = () => {
useEffect
(()
=>
{
if
(
currentPhase
)
{
api
.
open
({
message
:
`<当前阶段>
${
currentPhase
}
`
,
message
:
fetchStrings
(
"
!system
"
,
Phase2StringCodeMap
.
get
(
currentPhase
)
??
0
),
placement
:
"
topRight
"
,
style
:
style
,
});
...
...
@@ -51,7 +55,7 @@ export const HintNotification = () => {
useEffect
(()
=>
{
if
(
waiting
)
{
api
.
open
({
message
:
"
...等待对方行动中...
"
,
message
:
fetchStrings
(
"
!system
"
,
1390
)
,
placement
:
"
top
"
,
duration
:
NeosConfig
.
ui
.
hint
.
waitingDuration
,
style
:
style
,
...
...
src/ui/Duel/PlayMat/Menu.tsx
View file @
79611cf5
...
...
@@ -5,26 +5,17 @@ import React, { useState } from "react";
import
{
useSnapshot
}
from
"
valtio
"
;
import
{
fetchStrings
,
sendSelectBattleCmdResponse
,
sendSelectIdleCmdResponse
,
sendSurrender
,
ygopro
,
}
from
"
@/api
"
;
import
{
clearAllIdleInteractivities
as
clearAllIdleInteractivities
,
matStore
,
}
from
"
@/stores
"
;
const
PhaseButton
=
(
props
:
{
text
:
string
;
enable
:
boolean
;
onClick
:
()
=>
void
;
})
=>
{
return
(
<
button
disabled=
{
!
props
.
enable
}
onClick=
{
props
.
onClick
}
>
{
props
.
text
}
</
button
>
);
};
import
PhaseType
=
ygopro
.
StocGameMessage
.
MsgNewPhase
.
PhaseType
;
const
{
phase
}
=
matStore
;
...
...
@@ -38,11 +29,11 @@ export const Menu = () => {
const
[
modalOpen
,
setModalOpen
]
=
useState
(
false
);
const
response
=
currentPhase
===
"
BATTLE_START
"
||
currentPhase
===
"
BATTLE_STEP
"
||
currentPhase
===
"
DAMAGE
"
||
currentPhase
===
"
DAMAGE_GAL
"
||
currentPhase
===
"
BATTLE
"
currentPhase
===
PhaseType
.
BATTLE_START
||
currentPhase
===
PhaseType
.
BATTLE_STEP
||
currentPhase
===
PhaseType
.
DAMAGE
||
currentPhase
===
PhaseType
.
DAMAGE_GAL
||
currentPhase
===
PhaseType
.
BATTLE
?
3
:
7
;
...
...
@@ -71,15 +62,15 @@ export const Menu = () => {
return
(
<
div
id=
"controller"
>
<
button
disabled=
{
!
enableBp
}
onClick=
{
onBp
}
>
战斗阶段
{
fetchStrings
(
"
!system
"
,
80
)
}
</
button
>
<
button
disabled=
{
!
enableM2
}
onClick=
{
onM2
}
>
主要阶段2
进入
主要阶段2
</
button
>
<
button
disabled=
{
!
enableEp
}
onClick=
{
onEp
}
>
结束回合
{
fetchStrings
(
"
!system
"
,
81
)
}
</
button
>
<
button
onClick=
{
onSurrender
}
>
投降
</
button
>
<
button
onClick=
{
onSurrender
}
>
{
fetchStrings
(
"
!system
"
,
1351
)
}
</
button
>
<
Modal
title=
"是否确认要投降?"
open=
{
modalOpen
}
...
...
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