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
c7647f21
Commit
c7647f21
authored
May 20, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix small in chaining
parent
d38980b4
Pipeline
#21744
failed with stages
in 13 minutes and 20 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
21 deletions
+16
-21
src/api/cards.ts
src/api/cards.ts
+6
-14
src/service/duel/chaining.ts
src/service/duel/chaining.ts
+2
-2
src/stores/matStore/store.ts
src/stores/matStore/store.ts
+5
-3
src/stores/matStore/types.ts
src/stores/matStore/types.ts
+3
-2
No files found.
src/api/cards.ts
View file @
c7647f21
...
...
@@ -49,20 +49,12 @@ export interface CardText {
* @returns 卡片数据
*
* */
export
async
function
fetchCard
(
id
:
number
,
local
:
boolean
=
true
):
Promise
<
CardMeta
>
{
if
(
local
)
{
const
res
=
await
sqliteMiddleWare
({
cmd
:
sqliteCmd
.
SELECT
,
payload
:
{
id
},
});
return
res
.
selectResult
?
res
.
selectResult
:
{
id
,
data
:
{},
text
:
{}
};
}
const
res
=
await
axios
.
get
<
CardMeta
>
(
"
http://localhost:3030/cards/
"
+
id
);
return
res
.
data
;
export
async
function
fetchCard
(
id
:
number
):
Promise
<
CardMeta
>
{
const
res
=
await
sqliteMiddleWare
({
cmd
:
sqliteCmd
.
SELECT
,
payload
:
{
id
},
});
return
res
.
selectResult
?
res
.
selectResult
:
{
id
,
data
:
{},
text
:
{}
};
}
export
function
getCardStr
(
meta
:
CardMeta
,
idx
:
number
):
string
|
undefined
{
...
...
src/service/duel/chaining.ts
View file @
c7647f21
...
...
@@ -9,13 +9,13 @@ export default async (chaining: ygopro.StocGameMessage.MsgChaining) => {
cardID
:
chaining
.
code
,
});
matStore
.
setChaining
(
chaining
.
location
,
chaining
.
code
,
true
);
await
matStore
.
setChaining
(
chaining
.
location
,
chaining
.
code
,
true
);
await
sleep
(
useConfig
().
ui
.
chainingDelay
);
const
location
=
chaining
.
location
;
// 恢复成非`chaining`状态
matStore
.
setChaining
(
location
,
chaining
.
code
,
false
);
await
matStore
.
setChaining
(
location
,
chaining
.
code
,
false
);
// 将`location`添加到连锁栈
matStore
.
chains
.
push
(
location
);
// 设置被连锁状态
...
...
src/stores/matStore/store.ts
View file @
c7647f21
...
...
@@ -267,15 +267,17 @@ export const matStore: MatState = proxy<MatState>({
// methods
in
:
getZone
,
isMe
,
setChaining
(
location
,
code
,
isChaining
)
{
async
setChaining
(
location
,
code
,
isChaining
)
{
const
target
=
this
.
in
(
location
.
location
)
.
of
(
location
.
controler
)
.
at
(
location
.
sequence
);
if
(
target
)
{
target
.
chaining
=
isChaining
;
if
(
target
.
occupant
&&
isChaining
)
{
// 目前需要判断`isChaining`为ture才设置id,因为有些手坑发效果后会move到墓地,运行到这里的时候已经和原来的位置对不上了,这时候不设置id
target
.
occupant
.
id
=
code
;
// 目前需要判断`isChaining`为ture才设置meta,因为有些手坑发效果后会move到墓地,
// 运行到这里的时候已经和原来的位置对不上了,这时候不设置meta
const
meta
=
await
fetchCard
(
code
);
target
.
occupant
=
meta
;
}
if
(
target
.
location
.
zone
==
ygopro
.
CardZone
.
HAND
)
{
target
.
location
.
position
=
isChaining
...
...
src/stores/matStore/types.ts
View file @
c7647f21
...
...
@@ -111,7 +111,7 @@ export interface MatState {
location
:
ygopro
.
CardLocation
,
code
:
number
,
isChaining
:
boolean
)
=>
void
;
)
=>
Promise
<
void
>
;
// 添加被连锁状态
setChained
:
(
location
:
ygopro
.
CardLocation
,
chainIndex
?:
number
)
=>
void
;
}
...
...
@@ -137,7 +137,8 @@ export interface CardState {
};
// 位置信息,叫location的原因是为了和ygo对齐
focus
:
boolean
;
// 用于实现动画效果,当这个字段为true时,该张卡片会被放大并在屏幕中央展示
chaining
:
boolean
;
// 是否在连锁中
chainIndex
?:
number
;
// 连锁的序号,如果为空表示不在连锁
chainIndex
?:
number
/*连锁的序号,如果为空表示不在连锁
TODO: 目前是妥协的设计,因为其实一张卡是可以在同一个连锁链中被连锁多次的,这里为了避免太过复杂只保存最后的连锁序号*/
;
directAttack
:
boolean
;
// 是否正在直接攻击为玩家
attackTarget
?:
CardState
&
{
sequence
:
number
;
opponent
:
boolean
};
// 攻击目标。(嵌套结构可行么?)
idleInteractivities
:
Interactivity
<
number
>
[];
// IDLE状态下的互动信息
...
...
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