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
68184e77
Commit
68184e77
authored
Apr 02, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
d8c00bb9
Pipeline
#21066
passed with stages
in 19 minutes and 25 seconds
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
29 deletions
+56
-29
src/reducers/duel/modal/checkCardModalSlice.ts
src/reducers/duel/modal/checkCardModalSlice.ts
+27
-19
src/reducers/duel/modal/mod.ts
src/reducers/duel/modal/mod.ts
+4
-3
src/reducers/duel/util.ts
src/reducers/duel/util.ts
+21
-3
src/ui/Duel/checkCardModal.tsx
src/ui/Duel/checkCardModal.tsx
+4
-4
No files found.
src/reducers/duel/modal/checkCardModalSlice.ts
View file @
68184e77
...
...
@@ -6,7 +6,7 @@ import {
}
from
"
@reduxjs/toolkit
"
;
import
{
RootState
}
from
"
../../../store
"
;
import
{
DuelState
}
from
"
../mod
"
;
import
{
findCardByLocation
,
judgeSelf
}
from
"
../util
"
;
import
{
cmpCardLocation
,
findCardByLocation
,
judgeSelf
}
from
"
../util
"
;
import
{
fetchCard
,
getCardStr
}
from
"
../../../api/cards
"
;
import
{
ygopro
}
from
"
../../../api/ocgcore/idl/ocgcore
"
;
...
...
@@ -65,17 +65,11 @@ export const fetchCheckCardMeta = createAsyncThunk(
})
=>
{
// FIXME: 这里如果传的`controler`如果是对手,对应的`code`会为零,这时候就无法更新对应的`Meta`信息了,后续需要修复。`fetchCheckCardMetaV2`和`fetchCheckCardMetaV3`同理
const
meta
=
await
fetchCard
(
param
.
option
.
code
,
true
);
const
effectDesc
=
param
.
option
.
effectDescCode
?
getCardStr
(
meta
,
param
.
option
.
effectDescCode
&
0xf
)
:
undefined
;
const
response
=
{
controler
:
param
.
option
.
location
.
controler
,
tagName
:
param
.
tagName
,
meta
:
{
code
:
meta
.
id
,
name
:
meta
.
text
.
name
,
desc
:
meta
.
text
.
desc
,
effectDesc
,
option
:
{
meta
,
location
:
param
.
option
.
location
.
toObject
(),
},
};
...
...
@@ -91,6 +85,7 @@ export const checkCardModalCase = (
const
code
=
action
.
meta
.
arg
.
option
.
code
;
const
location
=
action
.
meta
.
arg
.
option
.
location
;
const
controler
=
location
.
controler
;
const
effectDescCode
=
action
.
meta
.
arg
.
option
.
effectDescCode
;
const
response
=
action
.
meta
.
arg
.
option
.
response
;
const
combinedTagName
=
judgeSelf
(
controler
,
state
)
...
...
@@ -101,23 +96,29 @@ export const checkCardModalCase = (
code
!=
0
?
code
:
findCardByLocation
(
state
,
location
)?.
occupant
?.
id
||
0
;
if
(
newID
)
{
const
newOption
=
{
meta
:
{
id
:
code
,
data
:
{},
text
:
{}
},
location
:
location
.
toObject
(),
effectDescCode
,
response
,
};
for
(
const
tag
of
state
.
modalState
.
checkCardModal
.
tags
)
{
if
(
tag
.
tagName
===
combinedTagName
)
{
tag
.
options
.
push
(
{
code
:
newID
,
response
}
);
tag
.
options
.
push
(
newOption
);
return
;
}
}
state
.
modalState
.
checkCardModal
.
tags
.
push
({
tagName
:
combinedTagName
,
options
:
[
{
code
:
newID
,
response
}
],
options
:
[
newOption
],
});
}
});
builder
.
addCase
(
fetchCheckCardMeta
.
fulfilled
,
(
state
,
action
)
=>
{
const
controler
=
action
.
payload
.
controler
;
const
tagName
=
action
.
payload
.
tagName
;
const
meta
=
action
.
payload
.
meta
;
const
option
=
action
.
payload
.
option
;
const
controler
=
option
.
location
.
controler
!
;
const
combinedTagName
=
judgeSelf
(
controler
,
state
)
?
`我方的
${
tagName
}
`
...
...
@@ -125,11 +126,18 @@ export const checkCardModalCase = (
for
(
const
tag
of
state
.
modalState
.
checkCardModal
.
tags
)
{
if
(
tag
.
tagName
===
combinedTagName
)
{
for
(
const
option
of
tag
.
options
)
{
if
(
option
.
code
==
meta
.
code
)
{
option
.
name
=
meta
.
name
;
option
.
desc
=
meta
.
desc
;
option
.
effectDesc
=
meta
.
effectDesc
;
for
(
const
old
of
tag
.
options
)
{
if
(
option
.
meta
.
id
==
old
.
meta
.
id
&&
cmpCardLocation
(
option
.
location
,
old
.
location
)
)
{
old
.
meta
=
option
.
meta
;
const
effectDescCode
=
old
.
effectDescCode
;
const
effectDesc
=
effectDescCode
?
getCardStr
(
old
.
meta
,
effectDescCode
&
0xf
)
:
undefined
;
old
.
effectDesc
=
effectDesc
;
}
}
}
...
...
src/reducers/duel/modal/mod.ts
View file @
68184e77
import
{
CardMeta
}
from
"
../../../api/cards
"
;
import
{
ygopro
}
from
"
../../../api/ocgcore/idl/ocgcore
"
;
type
CardLocation
=
ReturnType
<
typeof
ygopro
.
CardLocation
.
prototype
.
toObject
>
;
export
interface
ModalState
{
// 卡牌弹窗
...
...
@@ -28,9 +29,9 @@ export interface ModalState {
tags
:
{
tagName
:
string
;
options
:
{
code
:
number
;
name
?:
string
;
desc
?:
string
;
meta
:
CardMeta
;
location
?:
CardLocation
;
effectDescCode
?:
number
;
effectDesc
?:
string
;
response
:
number
;
}[];
...
...
src/reducers/duel/util.ts
View file @
68184e77
...
...
@@ -8,6 +8,10 @@ import { Draft } from "@reduxjs/toolkit";
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
{
CardState
}
from
"
./generic
"
;
type
Location
=
|
ygopro
.
CardLocation
|
ReturnType
<
typeof
ygopro
.
CardLocation
.
prototype
.
toObject
>
;
/*
* 通过`player`和`selfType`判断是应该处理自己还是对手
* */
...
...
@@ -29,9 +33,7 @@ export function judgeSelf(player: number, state: Draft<DuelState>): boolean {
* 通过`controler`,`zone`和`sequence`获取卡牌状态*/
export
function
findCardByLocation
(
state
:
Draft
<
DuelState
>
,
location
:
|
ygopro
.
CardLocation
|
ReturnType
<
typeof
ygopro
.
CardLocation
.
prototype
.
toObject
>
location
:
Location
):
CardState
|
undefined
{
const
controler
=
location
.
controler
!
;
const
zone
=
location
.
location
;
...
...
@@ -73,3 +75,19 @@ export function findCardByLocation(
}
}
}
export
function
cmpCardLocation
(
left
:
Location
,
right
?:
Location
,
strict
?:
boolean
):
boolean
{
if
(
strict
)
{
return
JSON
.
stringify
(
left
)
===
JSON
.
stringify
(
right
);
}
else
{
return
(
left
.
controler
===
right
?.
controler
&&
left
.
location
===
right
?.
location
&&
left
.
sequence
===
right
?.
sequence
);
}
}
src/ui/Duel/checkCardModal.tsx
View file @
68184e77
...
...
@@ -111,13 +111,13 @@ const CheckCardModal = () => {
<
Col
span=
{
4
}
key=
{
idx
}
>
<
HoverCheckCard
hoverContent=
{
option
.
effectDesc
}
title=
{
option
.
name
}
description=
{
option
.
desc
}
title=
{
option
.
meta
.
text
.
name
}
description=
{
option
.
meta
.
text
.
desc
}
style=
{
{
width
:
120
}
}
cover=
{
<
img
alt=
{
option
.
code
.
toString
()
}
src=
{
`${NeosConfig.cardImgUrl}/${option.
code
}.jpg`
}
alt=
{
option
.
meta
.
id
.
toString
()
}
src=
{
`${NeosConfig.cardImgUrl}/${option.
meta.id
}.jpg`
}
style=
{
{
width
:
100
}
}
/>
}
...
...
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