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