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
love_飞影
Neos
Commits
4565d966
Commit
4565d966
authored
Jan 15, 2023
by
chechunchi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add phase slice and io
parent
0536f9ab
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
144 additions
and
5 deletions
+144
-5
src/reducers/duel/mod.ts
src/reducers/duel/mod.ts
+15
-3
src/reducers/duel/phaseSlice.ts
src/reducers/duel/phaseSlice.ts
+38
-2
src/service/duel/selectIdleCmd.ts
src/service/duel/selectIdleCmd.ts
+5
-0
src/ui/Duel/2d.tsx
src/ui/Duel/2d.tsx
+33
-0
src/ui/Duel/main.tsx
src/ui/Duel/main.tsx
+2
-0
src/ui/Duel/monsters.tsx
src/ui/Duel/monsters.tsx
+13
-0
src/ui/Duel/phase.tsx
src/ui/Duel/phase.tsx
+38
-0
No files found.
src/reducers/duel/mod.ts
View file @
4565d966
...
@@ -14,7 +14,12 @@ import {
...
@@ -14,7 +14,12 @@ import {
removeHandImpl
,
removeHandImpl
,
}
from
"
./handsSlice
"
;
}
from
"
./handsSlice
"
;
import
{
newTurnImpl
}
from
"
./turnSlice
"
;
import
{
newTurnImpl
}
from
"
./turnSlice
"
;
import
{
newPhaseImpl
}
from
"
./phaseSlice
"
;
import
{
newPhaseImpl
,
PhaseState
,
setEnableBpImpl
,
setEnableEpImpl
,
}
from
"
./phaseSlice
"
;
import
{
RootState
}
from
"
../../store
"
;
import
{
RootState
}
from
"
../../store
"
;
import
{
HintState
,
hintCase
}
from
"
./hintSlice
"
;
import
{
HintState
,
hintCase
}
from
"
./hintSlice
"
;
import
{
import
{
...
@@ -110,7 +115,8 @@ export interface DuelState {
...
@@ -110,7 +115,8 @@ export interface DuelState {
opHint
?:
HintState
;
// 对手的提示
opHint
?:
HintState
;
// 对手的提示
currentPlayer
?:
number
;
// 当前的操作方
currentPlayer
?:
number
;
// 当前的操作方
currentPhase
?:
string
;
// 当前的阶段
phase
?:
PhaseState
;
// UI相关
// UI相关
modalState
:
ModalState
;
modalState
:
ModalState
;
...
@@ -136,7 +142,6 @@ const duelSlice = createSlice({
...
@@ -136,7 +142,6 @@ const duelSlice = createSlice({
},
},
infoInit
:
infoInitImpl
,
infoInit
:
infoInitImpl
,
updateTurn
:
newTurnImpl
,
updateTurn
:
newTurnImpl
,
updatePhase
:
newPhaseImpl
,
updateTimeLimit
:
updateTimeLimitImpl
,
updateTimeLimit
:
updateTimeLimitImpl
,
// 手牌相关`Reducer`
// 手牌相关`Reducer`
...
@@ -176,6 +181,11 @@ const duelSlice = createSlice({
...
@@ -176,6 +181,11 @@ const duelSlice = createSlice({
addFieldIdleInteractivities
:
addFieldIdleInteractivitiesImpl
,
addFieldIdleInteractivities
:
addFieldIdleInteractivitiesImpl
,
clearFieldIdleInteractivities
:
clearFieldIdleInteractivitiesImpl
,
clearFieldIdleInteractivities
:
clearFieldIdleInteractivitiesImpl
,
// 阶段相关
updatePhase
:
newPhaseImpl
,
setEnableBp
:
setEnableBpImpl
,
setEnableEp
:
setEnableEpImpl
,
// UI相关`Reducer`
// UI相关`Reducer`
setCardModalIsOpen
:
setCardModalIsOpenImpl
,
setCardModalIsOpen
:
setCardModalIsOpenImpl
,
setCardModalText
:
setCardModalTextImpl
,
setCardModalText
:
setCardModalTextImpl
,
...
@@ -214,6 +224,8 @@ export const {
...
@@ -214,6 +224,8 @@ export const {
infoInit
,
infoInit
,
updateTurn
,
updateTurn
,
updatePhase
,
updatePhase
,
setEnableBp
,
setEnableEp
,
clearHandsIdleInteractivity
,
clearHandsIdleInteractivity
,
addHandsIdleInteractivity
,
addHandsIdleInteractivity
,
updateTimeLimit
,
updateTimeLimit
,
...
...
src/reducers/duel/phaseSlice.ts
View file @
4565d966
...
@@ -2,11 +2,47 @@ import { PayloadAction, CaseReducer } from "@reduxjs/toolkit";
...
@@ -2,11 +2,47 @@ import { PayloadAction, CaseReducer } from "@reduxjs/toolkit";
import
{
RootState
}
from
"
../../store
"
;
import
{
RootState
}
from
"
../../store
"
;
import
{
DuelState
}
from
"
./mod
"
;
import
{
DuelState
}
from
"
./mod
"
;
export
interface
PhaseState
{
currentPhase
:
string
;
// 当前的阶段
enableBp
:
boolean
;
// 允许进入战斗阶段
enableEp
:
boolean
;
// 允许回合结束
}
export
const
newPhaseImpl
:
CaseReducer
<
DuelState
,
PayloadAction
<
string
>>
=
(
export
const
newPhaseImpl
:
CaseReducer
<
DuelState
,
PayloadAction
<
string
>>
=
(
state
,
state
,
action
action
)
=>
{
)
=>
{
state
.
currentPhase
=
action
.
payload
;
if
(
state
.
phase
)
{
state
.
phase
.
currentPhase
=
action
.
payload
;
}
else
{
state
.
phase
=
{
currentPhase
:
action
.
payload
,
enableBp
:
false
,
enableEp
:
false
,
};
}
};
};
export
const
selectCurrentPhase
=
(
state
:
RootState
)
=>
state
.
duel
.
currentPhase
;
export
const
setEnableBpImpl
:
CaseReducer
<
DuelState
,
PayloadAction
<
boolean
>>
=
(
state
,
action
)
=>
{
if
(
state
.
phase
)
{
state
.
phase
.
enableBp
=
action
.
payload
;
}
};
export
const
setEnableEpImpl
:
CaseReducer
<
DuelState
,
PayloadAction
<
boolean
>>
=
(
state
,
action
)
=>
{
if
(
state
.
phase
)
{
state
.
phase
.
enableEp
=
action
.
payload
;
}
};
export
const
selectCurrentPhase
=
(
state
:
RootState
)
=>
state
.
duel
.
phase
?.
currentPhase
;
export
const
selectEnableBp
=
(
state
:
RootState
)
=>
state
.
duel
.
phase
?.
enableBp
||
false
;
export
const
selectEnableEp
=
(
state
:
RootState
)
=>
state
.
duel
.
phase
?.
enableEp
||
false
;
src/service/duel/selectIdleCmd.ts
View file @
4565d966
...
@@ -10,6 +10,8 @@ import {
...
@@ -10,6 +10,8 @@ import {
clearMagicIdleInteractivities
,
clearMagicIdleInteractivities
,
clearFieldIdleInteractivities
,
clearFieldIdleInteractivities
,
addFieldIdleInteractivities
,
addFieldIdleInteractivities
,
setEnableBp
,
setEnableEp
,
}
from
"
../../reducers/duel/mod
"
;
}
from
"
../../reducers/duel/mod
"
;
import
MsgSelectIdleCmd
=
ygopro
.
StocGameMessage
.
MsgSelectIdleCmd
;
import
MsgSelectIdleCmd
=
ygopro
.
StocGameMessage
.
MsgSelectIdleCmd
;
import
{
ActionCreatorWithPayload
}
from
"
@reduxjs/toolkit
"
;
import
{
ActionCreatorWithPayload
}
from
"
@reduxjs/toolkit
"
;
...
@@ -94,6 +96,9 @@ export default (selectIdleCmd: MsgSelectIdleCmd, dispatch: AppDispatch) => {
...
@@ -94,6 +96,9 @@ export default (selectIdleCmd: MsgSelectIdleCmd, dispatch: AppDispatch) => {
}
}
});
});
});
});
dispatch
(
setEnableBp
(
selectIdleCmd
.
enable_bp
));
dispatch
(
setEnableEp
(
selectIdleCmd
.
enable_ep
));
};
};
function
idleTypeToInteractType
(
function
idleTypeToInteractType
(
...
...
src/ui/Duel/2d.tsx
0 → 100644
View file @
4565d966
import
React
from
"
react
"
;
export
const
Button2D
=
(
props
:
{
text
:
string
;
left
:
number
;
enable
:
boolean
;
onClick
:
()
=>
void
;
})
=>
(
<
adtFullscreenUi
name=
"ui"
>
<
rectangle
name=
"rect"
height=
"20px"
width=
"60px"
isEnabled=
{
props
.
enable
}
left=
{
props
.
left
}
>
<
rectangle
>
<
babylon
-
button
name=
"close-icon"
onPointerDownObservable=
{
props
.
onClick
}
>
<
textBlock
text=
{
props
.
text
}
fontFamily=
"FontAwesome"
fontStyle=
"bold"
fontSize=
{
15
}
color=
{
props
.
enable
?
"
yellow
"
:
"
white
"
}
/>
</
babylon
-
button
>
</
rectangle
>
</
rectangle
>
</
adtFullscreenUi
>
);
src/ui/Duel/main.tsx
View file @
4565d966
...
@@ -17,6 +17,7 @@ import CheckCardModal from "./checkCardModal";
...
@@ -17,6 +17,7 @@ import CheckCardModal from "./checkCardModal";
import
YesNoModal
from
"
./yesNoModal
"
;
import
YesNoModal
from
"
./yesNoModal
"
;
import
PositionModal
from
"
./positionModal
"
;
import
PositionModal
from
"
./positionModal
"
;
import
OptionModal
from
"
./optionModal
"
;
import
OptionModal
from
"
./optionModal
"
;
import
Phase
from
"
./phase
"
;
// Ref: https://github.com/brianzinn/react-babylonjs/issues/126
// Ref: https://github.com/brianzinn/react-babylonjs/issues/126
const
NeosDuel
=
()
=>
(
const
NeosDuel
=
()
=>
(
...
@@ -36,6 +37,7 @@ const NeosDuel = () => (
...
@@ -36,6 +37,7 @@ const NeosDuel = () => (
<
Cemeteries
/>
<
Cemeteries
/>
<
Exclusion
/>
<
Exclusion
/>
<
Field
/>
<
Field
/>
<
Phase
/>
<
Ground
/>
<
Ground
/>
</
Provider
>
</
Provider
>
</
Scene
>
</
Scene
>
...
...
src/ui/Duel/monsters.tsx
View file @
4565d966
...
@@ -54,6 +54,19 @@ const Monsters = () => {
...
@@ -54,6 +54,19 @@ const Monsters = () => {
}
}
)
}
)
}
<
ExtraMonsters
/>
<
ExtraMonsters
/>
<
adtFullscreenUi
name=
"ui"
>
<
rectangle
name=
"rect"
height=
"20px"
width=
"60px"
>
<
babylon
-
button
name=
"close-icon"
>
<
textBlock
text=
"bp"
fontFamily=
"FontAwesome"
fontStyle=
"bold"
fontSize=
{
15
}
color=
"white"
/>
</
babylon
-
button
>
</
rectangle
>
</
adtFullscreenUi
>
<
ExtraMonsters
/>
<
ExtraMonsters
/>
</>
</>
);
);
...
...
src/ui/Duel/phase.tsx
0 → 100644
View file @
4565d966
import
React
from
"
react
"
;
import
{
store
}
from
"
../../store
"
;
import
{
useAppSelector
}
from
"
../../hook
"
;
import
{
selectEnableBp
,
selectEnableEp
}
from
"
../../reducers/duel/phaseSlice
"
;
import
{
sendSelectIdleCmdResponse
}
from
"
../../api/ocgcore/ocgHelper
"
;
import
{
setEnableBp
,
setEnableEp
}
from
"
../../reducers/duel/mod
"
;
import
{
Button2D
}
from
"
./2d
"
;
const
Bp
=
()
=>
{
const
dispatch
=
store
.
dispatch
;
const
enable
=
useAppSelector
(
selectEnableBp
);
const
onClick
=
()
=>
{
sendSelectIdleCmdResponse
(
6
);
dispatch
(
setEnableBp
(
false
));
};
return
<
Button2D
text=
"bp"
left=
{
0
}
enable=
{
enable
}
onClick=
{
onClick
}
/>;
};
const
Ep
=
()
=>
{
const
dispatch
=
store
.
dispatch
;
const
enable
=
useAppSelector
(
selectEnableEp
);
const
onClick
=
()
=>
{
sendSelectIdleCmdResponse
(
7
);
dispatch
(
setEnableEp
(
false
));
};
return
<
Button2D
text=
"ep"
left=
{
140
}
enable=
{
enable
}
onClick=
{
onClick
}
/>;
};
const
Phase
=
()
=>
(
<>
<
Bp
/>
<
Ep
/>
</>
);
export
default
Phase
;
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