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
3d388d93
Commit
3d388d93
authored
Sep 02, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
impl reloadField
parent
b5ea98a8
Pipeline
#23324
passed with stages
in 13 minutes and 11 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
3 deletions
+47
-3
src/service/duel/reloadField.ts
src/service/duel/reloadField.ts
+41
-1
src/service/duel/start.ts
src/service/duel/start.ts
+0
-1
src/service/duel/updateData.ts
src/service/duel/updateData.ts
+4
-0
src/service/utils/genCard.ts
src/service/utils/genCard.ts
+2
-0
src/stores/cardStore.ts
src/stores/cardStore.ts
+0
-1
No files found.
src/service/duel/reloadField.ts
View file @
3d388d93
import
{
v4
as
v4uuid
}
from
"
uuid
"
;
import
{
ygopro
}
from
"
@/api
"
;
import
{
ygopro
}
from
"
@/api
"
;
import
{
cardStore
,
matStore
}
from
"
@/stores
"
;
import
{
genCard
}
from
"
../utils
"
;
type
MsgReloadField
=
ygopro
.
StocGameMessage
.
MsgReloadField
;
type
MsgReloadField
=
ygopro
.
StocGameMessage
.
MsgReloadField
;
export
default
(
_field
:
MsgReloadField
)
=>
{};
export
default
(
field
:
MsgReloadField
)
=>
{
// 重置
cardStore
.
reset
();
const
actions
=
field
.
actions
;
actions
.
forEach
((
action
)
=>
{
const
controller
=
action
.
player
;
// 更新生命值
matStore
.
initInfo
.
of
(
controller
).
life
=
action
.
lp
;
// 更新卡片集合
const
cards
=
action
.
zone_actions
.
map
((
zoneAction
)
=>
Array
.
from
({
length
:
zoneAction
.
overlay_count
+
1
}).
map
(
(
_
,
overlaySequence
)
=>
genCard
({
uuid
:
v4uuid
(),
code
:
0
,
location
:
new
ygopro
.
CardLocation
({
controller
,
zone
:
zoneAction
.
zone
,
sequence
:
zoneAction
.
sequence
,
is_overlay
:
overlaySequence
>
0
,
overlay_sequence
:
Math
.
min
(
overlaySequence
-
1
,
0
),
}),
counters
:
{},
idleInteractivities
:
[],
meta
:
{
id
:
0
,
data
:
{},
text
:
{}
},
isToken
:
false
,
selected
:
false
,
}),
),
)
.
flat
();
cardStore
.
inner
.
push
(...
cards
);
});
};
src/service/duel/start.ts
View file @
3d388d93
...
@@ -71,7 +71,6 @@ export default async (start: ygopro.StocGameMessage.MsgStart) => {
...
@@ -71,7 +71,6 @@ export default async (start: ygopro.StocGameMessage.MsgStart) => {
sequence
,
sequence
,
position
:
ygopro
.
CardPosition
.
FACEDOWN
,
position
:
ygopro
.
CardPosition
.
FACEDOWN
,
}),
}),
originController
:
i
<
3
?
0
:
1
,
counters
:
{},
counters
:
{},
idleInteractivities
:
[],
idleInteractivities
:
[],
meta
:
{
meta
:
{
...
...
src/service/duel/updateData.ts
View file @
3d388d93
...
@@ -3,6 +3,7 @@ import { cardStore } from "@/stores";
...
@@ -3,6 +3,7 @@ import { cardStore } from "@/stores";
import
{
callCardMove
}
from
"
@/ui/Duel/PlayMat/Card
"
;
import
{
callCardMove
}
from
"
@/ui/Duel/PlayMat/Card
"
;
import
MsgUpdateData
=
ygopro
.
StocGameMessage
.
MsgUpdateData
;
import
MsgUpdateData
=
ygopro
.
StocGameMessage
.
MsgUpdateData
;
import
{
TYPE_TOKEN
}
from
"
@/common
"
;
export
default
async
(
updateData
:
MsgUpdateData
)
=>
{
export
default
async
(
updateData
:
MsgUpdateData
)
=>
{
const
{
player
:
controller
,
zone
,
actions
}
=
updateData
;
const
{
player
:
controller
,
zone
,
actions
}
=
updateData
;
if
(
controller
!==
undefined
&&
zone
!==
undefined
&&
actions
!==
undefined
)
{
if
(
controller
!==
undefined
&&
zone
!==
undefined
&&
actions
!==
undefined
)
{
...
@@ -35,6 +36,9 @@ export default async (updateData: MsgUpdateData) => {
...
@@ -35,6 +36,9 @@ export default async (updateData: MsgUpdateData) => {
}
}
if
(
action
?.
type_
>=
0
)
{
if
(
action
?.
type_
>=
0
)
{
meta
.
data
.
type
=
action
.
type_
;
meta
.
data
.
type
=
action
.
type_
;
if
(
action
.
type_
&
TYPE_TOKEN
)
{
target
.
isToken
=
true
;
}
}
}
if
(
action
?.
level
>=
0
)
{
if
(
action
?.
level
>=
0
)
{
meta
.
data
.
level
=
action
.
level
;
meta
.
data
.
level
=
action
.
level
;
...
...
src/service/utils/genCard.ts
View file @
3d388d93
...
@@ -5,6 +5,8 @@ import { fetchCard } from "@/api";
...
@@ -5,6 +5,8 @@ import { fetchCard } from "@/api";
import
{
CardType
}
from
"
@/stores
"
;
import
{
CardType
}
from
"
@/stores
"
;
// 自动从code推断出meta
// 自动从code推断出meta
//
// TODO: 其实不是很推荐这样做,因为随着项目复杂度增加,这样可能会带来meta更新的时序问题
export
const
genCard
=
(
card
:
CardType
)
=>
{
export
const
genCard
=
(
card
:
CardType
)
=>
{
const
t
=
proxy
(
card
);
const
t
=
proxy
(
card
);
subscribeKey
(
t
,
"
code
"
,
(
code
)
=>
{
subscribeKey
(
t
,
"
code
"
,
(
code
)
=>
{
...
...
src/stores/cardStore.ts
View file @
3d388d93
...
@@ -13,7 +13,6 @@ export interface CardType {
...
@@ -13,7 +13,6 @@ export interface CardType {
code
:
number
;
// 卡号
code
:
number
;
// 卡号
meta
:
CardMeta
;
// 卡片元数据
meta
:
CardMeta
;
// 卡片元数据
location
:
ygopro
.
CardLocation
;
location
:
ygopro
.
CardLocation
;
originController
:
number
;
// 在卡组构建之中持有这张卡的玩家,方便reloadField的使用
idleInteractivities
:
Interactivity
<
number
>
[];
// IDLE状态下的互动信息
idleInteractivities
:
Interactivity
<
number
>
[];
// IDLE状态下的互动信息
placeInteractivity
?:
Interactivity
<
{
placeInteractivity
?:
Interactivity
<
{
controller
:
number
;
controller
:
number
;
...
...
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