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
0896be2d
Commit
0896be2d
authored
Jan 17, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat/pos_change' into 'main'
Feat/pos change See merge request
!83
parents
57e5a7ba
b2bfeb73
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
342 additions
and
4 deletions
+342
-4
neos-protobuf
neos-protobuf
+1
-1
src/api/ocgcore/idl/ocgcore.ts
src/api/ocgcore/idl/ocgcore.ts
+223
-3
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/penetrate.json
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/penetrate.json
+17
-0
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/penetrate.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/penetrate.ts
+4
-0
src/reducers/duel/generic.ts
src/reducers/duel/generic.ts
+11
-0
src/reducers/duel/magicSlice.ts
src/reducers/duel/magicSlice.ts
+18
-0
src/reducers/duel/mod.ts
src/reducers/duel/mod.ts
+6
-0
src/reducers/duel/monstersSlice.ts
src/reducers/duel/monstersSlice.ts
+20
-0
src/service/duel/gameMsg.ts
src/service/duel/gameMsg.ts
+6
-0
src/service/duel/posChange.ts
src/service/duel/posChange.ts
+36
-0
No files found.
neos-protobuf
@
9df2b696
Subproject commit
a6ff791566b10e716210678371d74e62cd128ad9
Subproject commit
9df2b696eb24e89fd760945ef1b218b9d29a6df3
src/api/ocgcore/idl/ocgcore.ts
View file @
0896be2d
This diff is collapsed.
Click to expand it.
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/penetrate.json
View file @
0896be2d
...
...
@@ -33,5 +33,22 @@
"repeatedType"
:
"uint32"
}
]
},
"53"
:
{
"protoType"
:
"pos_change"
,
"fields"
:
[
{
"fieldName"
:
"card_info"
,
"fieldType"
:
"CardInfo"
},
{
"fieldName"
:
"pre_position"
,
"fieldType"
:
"CardPosition"
},
{
"fieldName"
:
"cur_position"
,
"fieldType"
:
"CardPosition"
}
]
}
}
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/penetrate.ts
View file @
0896be2d
...
...
@@ -3,6 +3,7 @@
import
PenetrateData
from
"
./penetrate.json
"
;
import
{
BufferReader
}
from
"
../../bufferIO
"
;
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
{
numberToCardPosition
}
from
"
../../util
"
;
type
Constructor
<
T
=
any
>
=
new
(...
args
:
any
[])
=>
T
;
...
...
@@ -11,10 +12,13 @@ const ReadFieldHandlerMap: Map<string, readFieldHandler> = new Map([
[
"
uint16
"
,
(
reader
)
=>
reader
.
readUint16
()],
[
"
uint32
"
,
(
reader
)
=>
reader
.
readUint32
()],
[
"
CardLocation
"
,
(
reader
)
=>
reader
.
readCardLocation
()],
[
"
CardInfo
"
,
(
reader
)
=>
reader
.
readCardInfo
()],
[
"
CardPosition
"
,
(
reader
)
=>
numberToCardPosition
(
reader
.
readUint8
())],
]);
const
MsgConstructorMap
:
Map
<
string
,
Constructor
>
=
new
Map
([
[
"
move
"
,
ygopro
.
StocGameMessage
.
MsgMove
as
Constructor
],
[
"
shuffle_hand
"
,
ygopro
.
StocGameMessage
.
MsgShuffleHand
],
[
"
pos_change
"
,
ygopro
.
StocGameMessage
.
MsgPosChange
],
]);
export
interface
penetrateType
{
...
...
src/reducers/duel/generic.ts
View file @
0896be2d
...
...
@@ -251,3 +251,14 @@ export function clearIdleInteractivities<T extends DuelFieldState>(
});
}
}
export
function
setPosition
<
T
extends
DuelFieldState
>
(
state
:
T
|
undefined
,
sequence
:
number
,
position
:
ygopro
.
CardPosition
)
{
const
target
=
state
?.
inner
.
find
((
_
,
idx
)
=>
idx
==
sequence
);
if
(
target
&&
target
.
occupant
)
{
target
.
location
.
position
=
position
;
}
}
src/reducers/duel/magicSlice.ts
View file @
0896be2d
...
...
@@ -17,6 +17,7 @@ import {
Interactivity
,
extendIdleInteractivities
,
clearIdleInteractivities
,
setPosition
,
}
from
"
./generic
"
;
export
interface
MagicState
extends
DuelFieldState
{}
...
...
@@ -172,6 +173,23 @@ export const removeMagicImpl: CaseReducer<
removeOccupant
(
magics
,
action
.
payload
.
sequence
);
};
// 改变魔法表示形式
export
const
setMagicPositionImpl
:
CaseReducer
<
DuelState
,
PayloadAction
<
{
controler
:
number
;
sequence
:
number
;
position
:
ygopro
.
CardPosition
;
}
>
>
=
(
state
,
action
)
=>
{
const
controler
=
action
.
payload
.
controler
;
const
sequence
=
action
.
payload
.
sequence
;
const
position
=
action
.
payload
.
position
;
const
magics
=
judgeSelf
(
controler
,
state
)
?
state
.
meMagics
:
state
.
opMagics
;
setPosition
(
magics
,
sequence
,
position
);
};
export
const
selectMeMagics
=
(
state
:
RootState
)
=>
state
.
duel
.
meMagics
||
{
inner
:
[]
};
export
const
selectOpMagics
=
(
state
:
RootState
)
=>
...
...
src/reducers/duel/mod.ts
View file @
0896be2d
...
...
@@ -55,6 +55,7 @@ import {
addMonsterIdleInteractivitiesImpl
,
clearMonsterIdleInteractivitiesImpl
,
removeMonsterImpl
,
setMonsterPositionImpl
,
monsterCase
,
}
from
"
./monstersSlice
"
;
import
{
...
...
@@ -65,6 +66,7 @@ import {
addMagicIdleInteractivitiesImpl
,
clearMagicIdleInteractivitiesImpl
,
removeMagicImpl
,
setMagicPositionImpl
,
magicCase
,
}
from
"
./magicSlice
"
;
import
{
CemeteryState
,
initCemeteryImpl
,
cemeteryCase
}
from
"
./cemeretySlice
"
;
...
...
@@ -156,6 +158,7 @@ const duelSlice = createSlice({
clearMonsterPlaceInteractivities
:
clearMonsterPlaceInteractivitiesImpl
,
addMonsterIdleInteractivities
:
addMonsterIdleInteractivitiesImpl
,
clearMonsterIdleInteractivities
:
clearMonsterIdleInteractivitiesImpl
,
setMonsterPosition
:
setMonsterPositionImpl
,
removeMonster
:
removeMonsterImpl
,
// 魔法陷阱区相关`Reducer`
...
...
@@ -164,6 +167,7 @@ const duelSlice = createSlice({
clearMagicPlaceInteractivities
:
clearMagicPlaceInteractivitiesImpl
,
addMagicIdleInteractivities
:
addMagicIdleInteractivitiesImpl
,
clearMagicIdleInteractivities
:
clearMagicIdleInteractivitiesImpl
,
setMagicPosition
:
setMagicPositionImpl
,
removeMagic
:
removeMagicImpl
,
// 墓地相关`Reducer`
...
...
@@ -241,12 +245,14 @@ export const {
clearMonsterPlaceInteractivities
,
addMonsterIdleInteractivities
,
clearMonsterIdleInteractivities
,
setMonsterPosition
,
removeMonster
,
initMagics
,
addMagicPlaceInteractivities
,
clearMagicPlaceInteractivities
,
addMagicIdleInteractivities
,
clearMagicIdleInteractivities
,
setMagicPosition
,
removeMagic
,
removeHand
,
initCemetery
,
...
...
src/reducers/duel/monstersSlice.ts
View file @
0896be2d
...
...
@@ -17,6 +17,7 @@ import {
removeOccupant
,
extendIdleInteractivities
,
clearIdleInteractivities
,
setPosition
,
}
from
"
./generic
"
;
export
interface
MonsterState
extends
DuelFieldState
{}
...
...
@@ -184,6 +185,25 @@ export const removeMonsterImpl: CaseReducer<
removeOccupant
(
monsters
,
action
.
payload
.
sequence
);
};
// 改变怪兽表示形式
export
const
setMonsterPositionImpl
:
CaseReducer
<
DuelState
,
PayloadAction
<
{
controler
:
number
;
sequence
:
number
;
position
:
ygopro
.
CardPosition
;
}
>
>
=
(
state
,
action
)
=>
{
const
controler
=
action
.
payload
.
controler
;
const
sequence
=
action
.
payload
.
sequence
;
const
position
=
action
.
payload
.
position
;
const
monsters
=
judgeSelf
(
controler
,
state
)
?
state
.
meMonsters
:
state
.
opMonsters
;
setPosition
(
monsters
,
sequence
,
position
);
};
export
const
selectMeMonsters
=
(
state
:
RootState
)
=>
state
.
duel
.
meMonsters
||
{
inner
:
[]
};
export
const
selectOpMonsters
=
(
state
:
RootState
)
=>
...
...
src/service/duel/gameMsg.ts
View file @
0896be2d
...
...
@@ -15,6 +15,7 @@ import onMsgSelectPosition from "./selectPosition";
import
onMsgSelectOption
from
"
./selectOption
"
;
import
onMsgShuffleHand
from
"
./shuffleHand
"
;
import
onMsgSelectBattleCmd
from
"
./selectBattleCmd
"
;
import
onMsgPosChange
from
"
./posChange
"
;
export
default
function
handleGameMsg
(
pb
:
ygopro
.
YgoStocMsg
)
{
const
dispatch
=
store
.
dispatch
;
...
...
@@ -96,6 +97,11 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) {
break
;
}
case
"
pos_change
"
:
{
onMsgPosChange
(
msg
.
pos_change
,
dispatch
);
break
;
}
default
:
{
break
;
}
...
...
src/service/duel/posChange.ts
0 → 100644
View file @
0896be2d
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
{
setMagicPosition
,
setMonsterPosition
}
from
"
../../reducers/duel/mod
"
;
import
{
AppDispatch
}
from
"
../../store
"
;
import
MsgPosChange
=
ygopro
.
StocGameMessage
.
MsgPosChange
;
export
default
(
posChange
:
MsgPosChange
,
dispatch
:
AppDispatch
)
=>
{
const
cardInfo
=
posChange
.
card_info
;
switch
(
cardInfo
.
location
)
{
case
ygopro
.
CardZone
.
MZONE
:
{
dispatch
(
setMonsterPosition
({
controler
:
cardInfo
.
controler
,
sequence
:
cardInfo
.
sequence
,
position
:
posChange
.
cur_position
,
})
);
break
;
}
case
ygopro
.
CardZone
.
SZONE
:
{
dispatch
(
setMagicPosition
({
controler
:
cardInfo
.
controler
,
sequence
:
cardInfo
.
sequence
,
position
:
posChange
.
cur_position
,
})
);
break
;
}
default
:
{
console
.
log
(
`Unhandled zone
${
cardInfo
.
location
}
`
);
}
}
};
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