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
654155bd
Commit
654155bd
authored
Jan 22, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove field
parent
7c0401ad
Pipeline
#19757
passed with stages
in 4 minutes and 9 seconds
Changes
11
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
30 additions
and
256 deletions
+30
-256
src/reducers/duel/fieldSlice.ts
src/reducers/duel/fieldSlice.ts
+0
-155
src/reducers/duel/magicSlice.ts
src/reducers/duel/magicSlice.ts
+9
-0
src/reducers/duel/mod.ts
src/reducers/duel/mod.ts
+0
-28
src/reducers/duel/util.ts
src/reducers/duel/util.ts
+0
-8
src/service/duel/move.ts
src/service/duel/move.ts
+11
-27
src/service/duel/selectBattleCmd.ts
src/service/duel/selectBattleCmd.ts
+0
-8
src/service/duel/selectIdleCmd.ts
src/service/duel/selectIdleCmd.ts
+0
-8
src/service/duel/selectPlace.ts
src/service/duel/selectPlace.ts
+0
-6
src/service/duel/start.ts
src/service/duel/start.ts
+0
-3
src/ui/Duel/field.tsx
src/ui/Duel/field.tsx
+10
-6
src/ui/Duel/phase.tsx
src/ui/Duel/phase.tsx
+0
-7
No files found.
src/reducers/duel/fieldSlice.ts
deleted
100644 → 0
View file @
7c0401ad
import
{
judgeSelf
}
from
"
./util
"
;
import
{
DuelState
}
from
"
./mod
"
;
import
{
RootState
}
from
"
../../store
"
;
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
{
PayloadAction
,
CaseReducer
,
ActionReducerMapBuilder
,
}
from
"
@reduxjs/toolkit
"
;
import
{
CardState
,
createAsyncMetaThunk
,
DuelReducer
,
Interactivity
,
InteractType
,
}
from
"
./generic
"
;
export
interface
FieldState
{
inner
:
CardState
;
}
// 初始化场地区状态
export
const
initFieldImpl
:
CaseReducer
<
DuelState
,
PayloadAction
<
number
>>
=
(
state
,
action
)
=>
{
const
player
=
action
.
payload
;
if
(
judgeSelf
(
player
,
state
))
{
state
.
meField
=
{
inner
:
{
location
:
{
controler
:
player
,
location
:
ygopro
.
CardZone
.
ONFIELD
,
},
idleInteractivities
:
[],
},
};
}
else
{
state
.
opField
=
{
inner
:
{
location
:
{
controler
:
player
,
location
:
ygopro
.
CardZone
.
ONFIELD
,
},
idleInteractivities
:
[],
},
};
}
};
export
const
addFieldPlaceInteractivitiesImpl
:
CaseReducer
<
DuelState
,
PayloadAction
<
number
>
>
=
(
state
,
action
)
=>
{
const
controler
=
action
.
payload
;
const
field
=
judgeSelf
(
controler
,
state
)
?
state
.
meField
:
state
.
opField
;
if
(
field
&&
field
.
inner
)
{
field
.
inner
.
placeInteractivities
=
{
interactType
:
InteractType
.
PLACE_SELECTABLE
,
response
:
{
controler
,
zone
:
ygopro
.
CardZone
.
ONFIELD
,
sequence
:
0
,
},
};
}
};
export
const
clearFieldPlaceInteractivitiesImpl
:
CaseReducer
<
DuelState
,
PayloadAction
<
number
>
>
=
(
state
,
action
)
=>
{
const
player
=
action
.
payload
;
const
field
=
judgeSelf
(
player
,
state
)
?
state
.
meField
:
state
.
opField
;
if
(
field
)
{
field
.
inner
.
placeInteractivities
=
undefined
;
}
};
export
const
addFieldIdleInteractivitiesImpl
:
CaseReducer
<
DuelState
,
PayloadAction
<
{
player
:
number
;
sequence
:
number
;
interactivity
:
Interactivity
<
number
>
;
}
>
>
=
(
state
,
action
)
=>
{
const
field
=
judgeSelf
(
action
.
payload
.
player
,
state
)
?
state
.
meField
:
state
.
opField
;
if
(
field
)
{
field
.
inner
.
idleInteractivities
.
push
(
action
.
payload
.
interactivity
);
}
};
export
const
clearFieldIdleInteractivitiesImpl
:
CaseReducer
<
DuelState
,
PayloadAction
<
number
>
>
=
(
state
,
action
)
=>
{
const
field
=
judgeSelf
(
action
.
payload
,
state
)
?
state
.
meField
:
state
.
opField
;
if
(
field
)
{
field
.
inner
.
idleInteractivities
=
[];
}
};
// 增加场地区
export
const
fetchFieldMeta
=
createAsyncMetaThunk
(
"
duel/fetchFieldMeta
"
);
export
const
fieldCase
=
(
builder
:
ActionReducerMapBuilder
<
DuelState
>
)
=>
{
builder
.
addCase
(
fetchFieldMeta
.
pending
,
(
state
,
action
)
=>
{
const
controler
=
action
.
meta
.
arg
.
controler
;
const
sequence
=
action
.
meta
.
arg
.
sequence
;
const
code
=
action
.
meta
.
arg
.
code
;
if
(
sequence
==
0
)
{
const
meta
=
{
id
:
code
,
data
:
{},
text
:
{}
};
const
field
=
judgeSelf
(
controler
,
state
)
?
state
.
meField
:
state
.
opField
;
if
(
field
)
{
field
.
inner
.
occupant
=
meta
;
}
}
});
builder
.
addCase
(
fetchFieldMeta
.
fulfilled
,
(
state
,
action
)
=>
{
const
controler
=
action
.
payload
.
controler
;
const
meta
=
action
.
payload
.
meta
;
const
field
=
judgeSelf
(
controler
,
state
)
?
state
.
meField
:
state
.
opField
;
if
(
field
)
{
field
.
inner
.
occupant
=
meta
;
}
});
};
// 删除场地区
export
const
removeFieldImpl
:
DuelReducer
<
{
controler
:
number
}
>
=
(
state
,
action
)
=>
{
const
controler
=
action
.
payload
.
controler
;
const
field
=
judgeSelf
(
controler
,
state
)
?
state
.
meField
:
state
.
opField
;
if
(
field
)
{
field
.
inner
.
occupant
=
undefined
;
}
};
export
const
selectMeField
=
(
state
:
RootState
)
=>
state
.
duel
.
meField
;
export
const
selectOpField
=
(
state
:
RootState
)
=>
state
.
duel
.
opField
;
src/reducers/duel/magicSlice.ts
View file @
654155bd
...
...
@@ -70,6 +70,15 @@ export const initMagicsImpl: CaseReducer<DuelState, PayloadAction<number>> = (
},
idleInteractivities
:
[],
},
{
// 场地区
location
:
{
controler
:
player
,
location
:
ygopro
.
CardZone
.
SZONE
,
sequence
:
5
,
},
idleInteractivities
:
[],
},
],
};
...
...
src/reducers/duel/mod.ts
View file @
654155bd
...
...
@@ -89,16 +89,6 @@ import {
exclusionCase
,
}
from
"
./exclusionSlice
"
;
import
{
DeckState
,
initDeckImpl
}
from
"
./deckSlice
"
;
import
{
FieldState
,
initFieldImpl
,
clearFieldPlaceInteractivitiesImpl
,
addFieldPlaceInteractivitiesImpl
,
addFieldIdleInteractivitiesImpl
,
clearFieldIdleInteractivitiesImpl
,
removeFieldImpl
,
fieldCase
,
}
from
"
./fieldSlice
"
;
export
interface
DuelState
{
selfType
?:
number
;
...
...
@@ -123,9 +113,6 @@ export interface DuelState {
meDeck
?:
DeckState
;
// 自己的卡组状态
opDeck
?:
DeckState
;
// 对手的卡组状态
meField
?:
FieldState
;
// 自己的场地区状态
opField
?:
FieldState
;
// 对手的场地区状态
meTimeLimit
?:
TimeLimit
;
// 自己的计时
opTimeLimit
?:
TimeLimit
;
// 对手的计时
...
...
@@ -204,14 +191,6 @@ const duelSlice = createSlice({
// 卡组相关`Reducer`
initDeck
:
initDeckImpl
,
// 场地区相关`Reducer`
initField
:
initFieldImpl
,
clearFieldPlaceInteractivities
:
clearFieldPlaceInteractivitiesImpl
,
addFieldPlaceInteractivities
:
addFieldPlaceInteractivitiesImpl
,
addFieldIdleInteractivities
:
addFieldIdleInteractivitiesImpl
,
clearFieldIdleInteractivities
:
clearFieldIdleInteractivitiesImpl
,
removeField
:
removeFieldImpl
,
// 阶段相关
updatePhase
:
newPhaseImpl
,
setEnableBp
:
setEnableBpImpl
,
...
...
@@ -255,7 +234,6 @@ const duelSlice = createSlice({
YesNoModalCase
(
builder
);
optionModalCase
(
builder
);
checkCardModalV2Case
(
builder
);
fieldCase
(
builder
);
},
});
...
...
@@ -308,12 +286,6 @@ export const {
initDeck
,
initExclusion
,
removeExclusion
,
initField
,
removeField
,
clearFieldPlaceInteractivities
,
addFieldPlaceInteractivities
,
addFieldIdleInteractivities
,
clearFieldIdleInteractivities
,
setCheckCardModalV2IsOpen
,
setCheckCardModalV2MinMax
,
setCheckCardModalV2CancelAble
,
...
...
src/reducers/duel/util.ts
View file @
654155bd
...
...
@@ -64,14 +64,6 @@ export function findCardByLocation(
:
state
.
opCemetery
;
return
cemerety
?.
inner
.
find
(
finder
);
}
case
ygopro
.
CardZone
.
ONFIELD
:
{
const
field
=
judgeSelf
(
controler
,
state
)
?
state
.
meField
:
state
.
opField
;
if
(
sequence
==
0
)
{
return
field
?.
inner
;
}
else
{
return
undefined
;
}
}
default
:
{
return
undefined
;
}
...
...
src/service/duel/move.ts
View file @
654155bd
...
...
@@ -5,7 +5,6 @@ import { fetchMonsterMeta } from "../../reducers/duel/monstersSlice";
import
{
removeCemetery
,
removeExclusion
,
removeField
,
removeHand
,
removeMagic
,
removeMonster
,
...
...
@@ -14,7 +13,6 @@ import { fetchMagicMeta } from "../../reducers/duel/magicSlice";
import
{
fetchCemeteryMeta
}
from
"
../../reducers/duel/cemeretySlice
"
;
import
{
insertHandMeta
}
from
"
../../reducers/duel/handsSlice
"
;
import
{
fetchExclusionMeta
}
from
"
../../reducers/duel/exclusionSlice
"
;
import
{
fetchFieldMeta
}
from
"
../../reducers/duel/fieldSlice
"
;
export
default
(
move
:
MsgMove
,
dispatch
:
AppDispatch
)
=>
{
const
code
=
move
.
code
;
...
...
@@ -36,13 +34,9 @@ export default (move: MsgMove, dispatch: AppDispatch) => {
break
;
}
case
ygopro
.
CardZone
.
SZONE
:
{
if
(
from
.
sequence
<
5
)
{
dispatch
(
removeMagic
({
controler
:
from
.
controler
,
sequence
:
from
.
sequence
})
);
}
else
{
dispatch
(
removeField
({
controler
:
from
.
controler
}));
}
dispatch
(
removeMagic
({
controler
:
from
.
controler
,
sequence
:
from
.
sequence
})
);
break
;
}
...
...
@@ -80,24 +74,14 @@ export default (move: MsgMove, dispatch: AppDispatch) => {
break
;
}
case
ygopro
.
CardZone
.
SZONE
:
{
if
(
to
.
sequence
<
5
)
{
dispatch
(
fetchMagicMeta
({
controler
:
to
.
controler
,
sequence
:
to
.
sequence
,
position
:
to
.
position
,
code
,
})
);
}
else
{
dispatch
(
fetchFieldMeta
({
controler
:
to
.
controler
,
sequence
:
to
.
sequence
,
code
,
})
);
}
dispatch
(
fetchMagicMeta
({
controler
:
to
.
controler
,
sequence
:
to
.
sequence
,
position
:
to
.
position
,
code
,
})
);
break
;
}
...
...
src/service/duel/selectBattleCmd.ts
View file @
654155bd
...
...
@@ -2,11 +2,9 @@ import { ActionCreatorWithPayload } from "@reduxjs/toolkit";
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
{
Interactivity
,
InteractType
}
from
"
../../reducers/duel/generic
"
;
import
{
addFieldIdleInteractivities
,
addHandsIdleInteractivity
,
addMagicIdleInteractivities
,
addMonsterIdleInteractivities
,
clearFieldIdleInteractivities
,
clearHandsIdleInteractivity
,
clearMagicIdleInteractivities
,
clearMonsterIdleInteractivities
,
...
...
@@ -24,7 +22,6 @@ export default (selectBattleCmd: MsgSelectBattleCmd, dispatch: AppDispatch) => {
dispatch
(
clearHandsIdleInteractivity
(
player
));
dispatch
(
clearMonsterIdleInteractivities
(
player
));
dispatch
(
clearMagicIdleInteractivities
(
player
));
dispatch
(
clearFieldIdleInteractivities
(
player
));
const
dispatcher
=
(
battleData
:
MsgSelectBattleCmd
.
BattleCmd
.
BattleData
,
...
...
@@ -89,11 +86,6 @@ export default (selectBattleCmd: MsgSelectBattleCmd, dispatch: AppDispatch) => {
break
;
}
case
ygopro
.
CardZone
.
ONFIELD
:
{
dispatcher
(
data
,
interactType
,
addFieldIdleInteractivities
);
break
;
}
default
:
{
}
}
...
...
src/service/duel/selectIdleCmd.ts
View file @
654155bd
...
...
@@ -8,8 +8,6 @@ import {
addMagicIdleInteractivities
,
clearMonsterIdleInteractivities
,
clearMagicIdleInteractivities
,
clearFieldIdleInteractivities
,
addFieldIdleInteractivities
,
setEnableBp
,
setEnableEp
,
}
from
"
../../reducers/duel/mod
"
;
...
...
@@ -24,7 +22,6 @@ export default (selectIdleCmd: MsgSelectIdleCmd, dispatch: AppDispatch) => {
dispatch
(
clearHandsIdleInteractivity
(
player
));
dispatch
(
clearMonsterIdleInteractivities
(
player
));
dispatch
(
clearMagicIdleInteractivities
(
player
));
dispatch
(
clearFieldIdleInteractivities
(
player
));
const
dispatcher
=
(
idleData
:
MsgSelectIdleCmd
.
IdleCmd
.
IdleData
,
...
...
@@ -86,11 +83,6 @@ export default (selectIdleCmd: MsgSelectIdleCmd, dispatch: AppDispatch) => {
break
;
}
case
ygopro
.
CardZone
.
ONFIELD
:
{
dispatcher
(
data
,
interactType
,
addFieldIdleInteractivities
);
break
;
}
default
:
{
}
}
...
...
src/service/duel/selectPlace.ts
View file @
654155bd
...
...
@@ -4,7 +4,6 @@ import MsgSelectPlace = ygopro.StocGameMessage.MsgSelectPlace;
import
{
addMonsterPlaceInteractivities
,
addMagicPlaceInteractivities
,
addFieldPlaceInteractivities
,
}
from
"
../../reducers/duel/mod
"
;
export
default
(
selectPlace
:
MsgSelectPlace
,
dispatch
:
AppDispatch
)
=>
{
...
...
@@ -30,11 +29,6 @@ export default (selectPlace: MsgSelectPlace, dispatch: AppDispatch) => {
break
;
}
case
ygopro
.
CardZone
.
ONFIELD
:
{
dispatch
(
addFieldPlaceInteractivities
(
place
.
controler
));
break
;
}
default
:
{
console
.
warn
(
`Unhandled zoneType:
${
place
.
zone
}
`
);
}
...
...
src/service/duel/start.ts
View file @
654155bd
...
...
@@ -8,7 +8,6 @@ import {
initCemetery
,
initDeck
,
initExclusion
,
initField
,
}
from
"
../../reducers/duel/mod
"
;
export
default
(
...
...
@@ -46,6 +45,4 @@ export default (
dispatch
(
initDeck
({
player
:
1
,
deskSize
:
start
.
deckSize2
}));
dispatch
(
initExclusion
(
0
));
dispatch
(
initExclusion
(
1
));
dispatch
(
initField
(
0
));
dispatch
(
initField
(
1
));
};
src/ui/Duel/field.tsx
View file @
654155bd
import
*
as
BABYLON
from
"
@babylonjs/core
"
;
import
*
as
CONFIG
from
"
../../config/ui
"
;
import
{
useAppSelector
}
from
"
../../hook
"
;
import
{
selectMe
Field
,
selectOpField
}
from
"
../../reducers/duel/field
Slice
"
;
import
{
clear
Field
PlaceInteractivities
}
from
"
../../reducers/duel/mod
"
;
import
{
selectMe
Magics
,
selectOpMagics
}
from
"
../../reducers/duel/magic
Slice
"
;
import
{
clear
Magic
PlaceInteractivities
}
from
"
../../reducers/duel/mod
"
;
import
FixedSlot
from
"
./fixedSlot
"
;
import
{
Depth
}
from
"
./singleSlot
"
;
const
Field
=
()
=>
{
const
meField
=
useAppSelector
(
selectMeField
)?.
inner
;
const
opField
=
useAppSelector
(
selectOpField
)?.
inner
;
const
meField
=
useAppSelector
(
selectMeMagics
).
inner
.
find
(
(
_
,
sequence
)
=>
sequence
==
5
);
const
opField
=
useAppSelector
(
selectOpMagics
).
inner
.
find
(
(
_
,
sequence
)
=>
sequence
==
5
);
return
(
<>
...
...
@@ -18,7 +22,7 @@ const Field = () => {
sequence=
{
0
}
position=
{
fieldPosition
(
0
)
}
rotation=
{
CONFIG
.
CardSlotRotation
(
false
)
}
clearPlaceInteractivitiesAction=
{
clear
Field
PlaceInteractivities
}
clearPlaceInteractivitiesAction=
{
clear
Magic
PlaceInteractivities
}
/>
)
:
(
<></>
...
...
@@ -29,7 +33,7 @@ const Field = () => {
sequence=
{
0
}
position=
{
fieldPosition
(
1
)
}
rotation=
{
CONFIG
.
CardSlotRotation
(
true
)
}
clearPlaceInteractivitiesAction=
{
clear
Field
PlaceInteractivities
}
clearPlaceInteractivitiesAction=
{
clear
Magic
PlaceInteractivities
}
/>
)
:
(
<></>
...
...
src/ui/Duel/phase.tsx
View file @
654155bd
...
...
@@ -12,7 +12,6 @@ import {
sendSelectIdleCmdResponse
,
}
from
"
../../api/ocgcore/ocgHelper
"
;
import
{
clearFieldIdleInteractivities
,
clearHandsIdleInteractivity
,
clearMagicIdleInteractivities
,
clearMonsterIdleInteractivities
,
...
...
@@ -33,8 +32,6 @@ const Bp = () => {
dispatch
(
clearMonsterIdleInteractivities
(
1
));
dispatch
(
clearMagicIdleInteractivities
(
0
));
dispatch
(
clearMagicIdleInteractivities
(
1
));
dispatch
(
clearFieldIdleInteractivities
(
0
));
dispatch
(
clearFieldIdleInteractivities
(
1
));
sendSelectIdleCmdResponse
(
6
);
dispatch
(
setEnableBp
(
false
));
...
...
@@ -54,8 +51,6 @@ const M2 = () => {
dispatch
(
clearMonsterIdleInteractivities
(
1
));
dispatch
(
clearMagicIdleInteractivities
(
0
));
dispatch
(
clearMagicIdleInteractivities
(
1
));
dispatch
(
clearFieldIdleInteractivities
(
0
));
dispatch
(
clearFieldIdleInteractivities
(
1
));
sendSelectBattleCmdResponse
(
2
);
dispatch
(
setEnableM2
(
false
));
...
...
@@ -86,8 +81,6 @@ const Ep = () => {
dispatch
(
clearMonsterIdleInteractivities
(
1
));
dispatch
(
clearMagicIdleInteractivities
(
0
));
dispatch
(
clearMagicIdleInteractivities
(
1
));
dispatch
(
clearFieldIdleInteractivities
(
0
));
dispatch
(
clearFieldIdleInteractivities
(
1
));
sendSelectIdleCmdResponse
(
response
);
dispatch
(
setEnableEp
(
false
));
...
...
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