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
b013068f
Commit
b013068f
authored
May 28, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix confirmCards
parent
87cc4ada
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
20 deletions
+22
-20
src/service/duel/confirmCards.ts
src/service/duel/confirmCards.ts
+5
-7
src/service/duel/start.ts
src/service/duel/start.ts
+7
-5
src/stores/cardStore.ts
src/stores/cardStore.ts
+8
-6
src/stores/matStore/methods/fetchHint.ts
src/stores/matStore/methods/fetchHint.ts
+2
-2
No files found.
src/service/duel/confirmCards.ts
View file @
b013068f
import
{
fetchCard
,
ygopro
}
from
"
@/api
"
;
import
{
sleep
}
from
"
@/infra
"
;
import
{
matStore
}
from
"
@/stores
"
;
import
{
cardStore
,
matStore
}
from
"
@/stores
"
;
export
default
async
(
confirmCards
:
ygopro
.
StocGameMessage
.
MsgConfirmCards
)
=>
{
const
cards
=
confirmCards
.
cards
;
for
(
const
card
of
cards
)
{
const
target
=
matStore
.
in
(
card
.
location
)
.
of
(
card
.
controler
)
.
at
(
card
.
sequence
);
const
target
=
cardStore
.
at
(
card
.
location
,
card
.
controler
,
card
.
sequence
);
if
(
target
)
{
// 设置`occupant`
const
meta
=
await
fetchCard
(
card
.
code
);
target
.
occupant
=
meta
;
target
.
meta
=
meta
;
// 设置`position`,否则会横放
target
.
location
.
position
=
ygopro
.
CardPosition
.
ATTACK
;
target
.
position
=
ygopro
.
CardPosition
.
ATTACK
;
// 聚焦1s
target
.
focus
=
true
;
...
...
src/service/duel/start.ts
View file @
b013068f
...
...
@@ -93,8 +93,11 @@ export default (start: ygopro.StocGameMessage.MsgStart) => {
counters
:
{},
idleInteractivities
:
[],
sequence
,
data
:
{},
text
:
{},
meta
:
{
id
:
0
,
data
:
{},
text
:
{},
},
isToken
:
!
((
i
+
1
)
%
3
),
overlayMaterials
:
[],
position
:
ygopro
.
CardPosition
.
FACEDOWN
,
...
...
@@ -117,9 +120,8 @@ export default (start: ygopro.StocGameMessage.MsgStart) => {
const
genCard
=
(
o
:
CardType
)
=>
{
const
t
=
proxy
(
o
);
subscribeKey
(
t
,
"
code
"
,
async
(
code
)
=>
{
const
{
text
,
data
}
=
await
fetchCard
(
code
??
0
);
t
.
text
=
text
;
t
.
data
=
data
;
const
meta
=
await
fetchCard
(
code
??
0
);
t
.
meta
=
meta
;
});
return
t
;
};
src/stores/cardStore.ts
View file @
b013068f
import
{
proxy
}
from
"
valtio
"
;
import
{
Card
Data
,
CardText
,
fetchCard
,
ygopro
}
from
"
@/api
"
;
import
{
Card
Meta
,
fetchCard
,
ygopro
}
from
"
@/api
"
;
import
type
{
Interactivity
}
from
"
./matStore/types
"
;
...
...
@@ -10,8 +10,7 @@ import type { Interactivity } from "./matStore/types";
export
interface
CardType
{
uuid
:
string
;
// 一张卡的唯一标识
code
:
number
;
// 卡号
data
:
CardData
;
text
:
CardText
;
meta
:
CardMeta
;
// 卡片元数据
controller
:
number
;
// 控制这个位置的玩家,0或1
originController
:
number
;
// 在卡组构建之中持有这张卡的玩家,方便reloadField的使用
zone
:
ygopro
.
CardZone
;
// 怪兽区/魔法陷阱区/手牌/卡组/墓地/除外区
...
...
@@ -65,7 +64,11 @@ class CardStore {
find
(
location
:
ygopro
.
CardLocation
):
CardType
|
undefined
{
return
this
.
at
(
location
.
location
,
location
.
controler
,
location
.
sequence
);
}
async
setChaining
(
location
:
ygopro
.
CardLocation
,
code
:
number
,
isChaining
:
boolean
):
Promise
<
void
>
{
async
setChaining
(
location
:
ygopro
.
CardLocation
,
code
:
number
,
isChaining
:
boolean
):
Promise
<
void
>
{
const
target
=
this
.
find
(
location
);
if
(
target
)
{
target
.
chaining
=
isChaining
;
...
...
@@ -74,8 +77,7 @@ class CardStore {
// 运行到这里的时候已经和原来的位置对不上了,这时候不设置meta
const
meta
=
await
fetchCard
(
code
);
target
.
code
=
meta
.
id
;
target
.
data
=
meta
.
data
;
target
.
text
=
meta
.
text
;
target
.
meta
=
meta
;
}
if
(
target
.
zone
==
ygopro
.
CardZone
.
HAND
)
{
target
.
position
=
isChaining
...
...
src/stores/matStore/methods/fetchHint.ts
View file @
b013068f
...
...
@@ -69,8 +69,8 @@ export const fetchEsHintMeta = async ({
location
.
controler
,
location
.
sequence
);
if
(
fieldMeta
?.
text
.
name
)
{
esHint
=
esHint
.
replace
(
"
[?]
"
,
fieldMeta
.
text
.
name
);
if
(
fieldMeta
?.
meta
.
text
.
name
)
{
esHint
=
esHint
.
replace
(
"
[?]
"
,
fieldMeta
.
meta
.
text
.
name
);
}
}
...
...
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