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
20a0a738
Commit
20a0a738
authored
Jan 15, 2023
by
chechunchi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update selectIdleCmd service
parent
bb439879
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
30 deletions
+53
-30
src/api/ocgcore/ocgAdapter/bufferIO.ts
src/api/ocgcore/ocgAdapter/bufferIO.ts
+10
-7
src/service/duel/selectIdleCmd.ts
src/service/duel/selectIdleCmd.ts
+43
-23
No files found.
src/api/ocgcore/ocgAdapter/bufferIO.ts
View file @
20a0a738
...
@@ -54,14 +54,17 @@ export class BufferReader {
...
@@ -54,14 +54,17 @@ export class BufferReader {
}
}
readCardInfo
():
ygopro
.
CardInfo
{
readCardInfo
():
ygopro
.
CardInfo
{
const
cardInfo
=
new
ygopro
.
CardInfo
({});
const
code
=
this
.
readUint32
();
const
controler
=
this
.
readUint8
();
cardInfo
.
code
=
this
.
readUint32
();
const
location
=
numberToCardZone
(
this
.
readUint8
());
cardInfo
.
controler
=
this
.
readUint8
();
const
sequence
=
this
.
readUint8
();
cardInfo
.
location
=
this
.
readUint8
();
cardInfo
.
sequence
=
this
.
readUint8
();
return
cardInfo
;
return
new
ygopro
.
CardInfo
({
code
,
controler
,
location
,
sequence
,
});
}
}
readCardLocation
(
overlay
?:
boolean
):
ygopro
.
CardLocation
{
readCardLocation
(
overlay
?:
boolean
):
ygopro
.
CardLocation
{
...
...
src/service/duel/selectIdleCmd.ts
View file @
20a0a738
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
{
AppDispatch
}
from
"
../../store
"
;
import
{
AppDispatch
}
from
"
../../store
"
;
import
{
InteractType
}
from
"
../../reducers/duel/generic
"
;
import
{
Interact
ivity
,
Interact
Type
}
from
"
../../reducers/duel/generic
"
;
import
{
import
{
clearHandsIdleInteractivity
,
clearHandsIdleInteractivity
,
addHandsIdleInteractivity
,
addHandsIdleInteractivity
,
}
from
"
../../reducers/duel/mod
"
;
}
from
"
../../reducers/duel/mod
"
;
import
MsgSelectIdleCmd
=
ygopro
.
StocGameMessage
.
MsgSelectIdleCmd
;
import
MsgSelectIdleCmd
=
ygopro
.
StocGameMessage
.
MsgSelectIdleCmd
;
import
{
ActionCreatorWithPayload
}
from
"
@reduxjs/toolkit
"
;
export
default
(
selectIdleCmd
:
MsgSelectIdleCmd
,
dispatch
:
AppDispatch
)
=>
{
export
default
(
selectIdleCmd
:
MsgSelectIdleCmd
,
dispatch
:
AppDispatch
)
=>
{
const
player
=
selectIdleCmd
.
player
;
const
player
=
selectIdleCmd
.
player
;
...
@@ -14,6 +15,45 @@ export default (selectIdleCmd: MsgSelectIdleCmd, dispatch: AppDispatch) => {
...
@@ -14,6 +15,45 @@ export default (selectIdleCmd: MsgSelectIdleCmd, dispatch: AppDispatch) => {
// 先清掉之前的手牌互动性
// 先清掉之前的手牌互动性
dispatch
(
clearHandsIdleInteractivity
(
player
));
dispatch
(
clearHandsIdleInteractivity
(
player
));
const
dispatcher
=
(
idleData
:
MsgSelectIdleCmd
.
IdleCmd
.
IdleData
,
interactType
:
InteractType
|
undefined
,
actionCreator
:
ActionCreatorWithPayload
<
{
player
:
number
;
sequence
:
number
;
interactivity
:
Interactivity
<
number
>
;
},
string
>
)
=>
{
const
cardInfo
=
idleData
.
card_info
;
if
(
interactType
===
InteractType
.
ACTIVATE
)
{
// 发动效果会多一个字段
dispatch
(
actionCreator
({
player
,
sequence
:
cardInfo
.
sequence
,
interactivity
:
{
interactType
,
activateIndex
:
idleData
.
effect_description
,
response
:
idleData
.
response
,
},
})
);
}
else
if
(
interactType
)
{
dispatch
(
actionCreator
({
player
,
sequence
:
cardInfo
.
sequence
,
interactivity
:
{
interactType
,
response
:
idleData
.
response
},
})
);
}
else
{
console
.
log
(
`InteractType undefined`
);
}
};
cmds
.
forEach
((
cmd
)
=>
{
cmds
.
forEach
((
cmd
)
=>
{
const
interactType
=
idleTypeToInteractType
(
cmd
.
idle_type
);
const
interactType
=
idleTypeToInteractType
(
cmd
.
idle_type
);
...
@@ -21,31 +61,11 @@ export default (selectIdleCmd: MsgSelectIdleCmd, dispatch: AppDispatch) => {
...
@@ -21,31 +61,11 @@ export default (selectIdleCmd: MsgSelectIdleCmd, dispatch: AppDispatch) => {
const
cardInfo
=
data
.
card_info
;
const
cardInfo
=
data
.
card_info
;
switch
(
cardInfo
.
location
)
{
switch
(
cardInfo
.
location
)
{
case
ygopro
.
CardZone
.
HAND
:
{
case
ygopro
.
CardZone
.
HAND
:
{
if
(
interactType
===
InteractType
.
ACTIVATE
)
{
dispatcher
(
data
,
interactType
,
addHandsIdleInteractivity
);
// 发动效果会多一个字段
dispatch
(
addHandsIdleInteractivity
({
player
,
sequence
:
cardInfo
.
sequence
,
interactivity
:
{
interactType
,
activateIndex
:
data
.
effect_description
,
response
:
data
.
response
,
},
})
);
}
else
if
(
interactType
)
{
dispatch
(
addHandsIdleInteractivity
({
player
,
sequence
:
cardInfo
.
sequence
,
interactivity
:
{
interactType
,
response
:
data
.
response
},
})
);
}
break
;
break
;
}
}
default
:
{
default
:
{
}
}
}
}
...
...
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