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
c52620c7
Commit
c52620c7
authored
Jul 28, 2024
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Feat/card disabled
parent
1a685aa3
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
82 additions
and
5 deletions
+82
-5
neos-assets/disabled.png
neos-assets/disabled.png
+0
-0
src/common.ts
src/common.ts
+33
-0
src/service/duel/reloadField.ts
src/service/duel/reloadField.ts
+1
-0
src/service/duel/start.ts
src/service/duel/start.ts
+1
-0
src/service/duel/updateData.ts
src/service/duel/updateData.ts
+3
-0
src/service/utils/fetchCheckCardMeta.ts
src/service/utils/fetchCheckCardMeta.ts
+2
-0
src/stores/cardStore.ts
src/stores/cardStore.ts
+10
-1
src/ui/Duel/Message/PositionModal/index.tsx
src/ui/Duel/Message/PositionModal/index.tsx
+2
-2
src/ui/Duel/Message/SelectCardsModal/index.tsx
src/ui/Duel/Message/SelectCardsModal/index.tsx
+2
-0
src/ui/Duel/PlayMat/Card/index.tsx
src/ui/Duel/PlayMat/Card/index.tsx
+8
-1
src/ui/Shared/YgoCard/index.module.scss
src/ui/Shared/YgoCard/index.module.scss
+9
-0
src/ui/Shared/YgoCard/index.tsx
src/ui/Shared/YgoCard/index.tsx
+11
-1
No files found.
neos-assets/disabled.png
0 → 100644
View file @
c52620c7
1.22 KB
src/common.ts
View file @
c52620c7
...
@@ -453,3 +453,36 @@ function ifSetCard(setCodeToAnalyse: number, setCodeFromCard: number): boolean {
...
@@ -453,3 +453,36 @@ function ifSetCard(setCodeToAnalyse: number, setCodeFromCard: number): boolean {
return
res
;
return
res
;
}
}
export
const
STATUS_DISABLED
=
0x0001
;
// const STATUS_TO_ENABLE = 0x0002
// const STATUS_TO_DISABLE = 0x0004
// const STATUS_PROC_COMPLETE = 0x0008
// const STATUS_SET_TURN = 0x0010
// const STATUS_NO_LEVEL = 0x0020
// const STATUS_BATTLE_RESULT = 0x0040
// const STATUS_SPSUMMON_STEP = 0x0080
// const STATUS_FORM_CHANGED = 0x0100
// const STATUS_SUMMONING = 0x0200
// const STATUS_EFFECT_ENABLED = 0x0400
// const STATUS_SUMMON_TURN = 0x0800
// const STATUS_DESTROY_CONFIRMED = 0x1000
// const STATUS_LEAVE_CONFIRMED = 0x2000
// const STATUS_BATTLE_DESTROYED = 0x4000
// const STATUS_COPYING_EFFECT = 0x8000
// const STATUS_CHAINING = 0x10000
// const STATUS_SUMMON_DISABLED = 0x20000
// const STATUS_ACTIVATE_DISABLED = 0x40000
// const STATUS_EFFECT_REPLACED = 0x80000
// const STATUS_FLIP_SUMMONING = 0x100000
// const STATUS_ATTACK_CANCELED = 0x200000
// const STATUS_INITIALIZING = 0x400000
// const STATUS_TO_HAND_WITHOUT_CONFIRM = 0x800000
// const STATUS_JUST_POS = 0x1000000
// const STATUS_CONTINUOUS_POS = 0x2000000
export
const
STATUS_FORBIDDEN
=
0x4000000
;
// const STATUS_ACT_FROM_HAND = 0x8000000
// const STATUS_OPPO_BATTLE = 0x10000000
// const STATUS_FLIP_SUMMON_TURN = 0x20000000
// const STATUS_SPSUMMON_TURN = 0x40000000
// const STATUS_FLIP_SUMMON_DISABLED = 0x80000000
src/service/duel/reloadField.ts
View file @
c52620c7
...
@@ -41,6 +41,7 @@ export default (container: Container, field: MsgReloadField) => {
...
@@ -41,6 +41,7 @@ export default (container: Container, field: MsgReloadField) => {
selectable
:
false
,
selectable
:
false
,
selected
:
false
,
selected
:
false
,
},
},
status
:
0
,
}),
}),
),
),
)
)
...
...
src/service/duel/start.ts
View file @
c52620c7
...
@@ -77,6 +77,7 @@ export default async (
...
@@ -77,6 +77,7 @@ export default async (
selectable
:
false
,
selectable
:
false
,
selected
:
false
,
selected
:
false
,
},
},
status
:
0
,
}),
}),
),
),
),
),
...
...
src/service/duel/updateData.ts
View file @
c52620c7
...
@@ -53,6 +53,9 @@ export default async (container: Container, updateData: MsgUpdateData) => {
...
@@ -53,6 +53,9 @@ export default async (container: Container, updateData: MsgUpdateData) => {
if
(
action
?.
defense
>=
0
)
{
if
(
action
?.
defense
>=
0
)
{
meta
.
data
.
def
=
action
.
defense
;
meta
.
data
.
def
=
action
.
defense
;
}
}
if
(
action
?.
status
>=
0
)
{
target
.
status
=
action
.
status
;
}
// TODO: counters
// TODO: counters
}
else
{
}
else
{
console
.
warn
(
console
.
warn
(
...
...
src/service/utils/fetchCheckCardMeta.ts
View file @
c52620c7
import
type
{
ygopro
}
from
"
@/api
"
;
import
type
{
ygopro
}
from
"
@/api
"
;
import
{
fetchCard
,
getCardStr
}
from
"
@/api/cards
"
;
import
{
fetchCard
,
getCardStr
}
from
"
@/api/cards
"
;
import
{
Context
}
from
"
@/container
"
;
import
{
Context
}
from
"
@/container
"
;
import
{
isCardDisabled
}
from
"
@/stores
"
;
import
type
{
Option
}
from
"
@/ui/Duel/Message
"
;
import
type
{
Option
}
from
"
@/ui/Duel/Message
"
;
const
helper
=
async
(
const
helper
=
async
(
...
@@ -52,6 +53,7 @@ const helper = async (
...
@@ -52,6 +53,7 @@ const helper = async (
effectDesc
,
effectDesc
,
response
,
response
,
targeted
:
target
?.
targeted
,
targeted
:
target
?.
targeted
,
disabled
:
target
?
isCardDisabled
(
target
)
:
false
,
};
};
if
(
selected
)
{
if
(
selected
)
{
...
...
src/stores/cardStore.ts
View file @
c52620c7
import
{
proxy
}
from
"
valtio
"
;
import
{
proxy
}
from
"
valtio
"
;
import
{
CardMeta
,
ygopro
}
from
"
@/api
"
;
import
{
CardMeta
,
ygopro
}
from
"
@/api
"
;
import
{
STATUS_DISABLED
,
STATUS_FORBIDDEN
}
from
"
@/common
"
;
import
type
{
Interactivity
}
from
"
./matStore/types
"
;
import
type
{
Interactivity
}
from
"
./matStore/types
"
;
import
{
type
NeosStore
}
from
"
./shared
"
;
import
{
type
NeosStore
}
from
"
./shared
"
;
/**
/**
* 场上某位置的状态
* Status of card on field
*
* TODO: use class
*/
*/
export
interface
CardType
{
export
interface
CardType
{
uuid
:
string
;
// 一张卡的唯一标识
uuid
:
string
;
// 一张卡的唯一标识
...
@@ -22,6 +25,7 @@ export interface CardType {
...
@@ -22,6 +25,7 @@ export interface CardType {
selected
:
boolean
;
// 是否已经被选择
selected
:
boolean
;
// 是否已经被选择
response
?:
number
;
// 被选择时发送给服务器的值
response
?:
number
;
// 被选择时发送给服务器的值
};
};
status
:
number
;
// Current status, STATUS_DISABLED, etc.
}
}
export
class
CardStore
implements
NeosStore
{
export
class
CardStore
implements
NeosStore
{
...
@@ -93,4 +97,9 @@ export class CardStore implements NeosStore {
...
@@ -93,4 +97,9 @@ export class CardStore implements NeosStore {
}
}
}
}
// TODO: provided in class
export
function
isCardDisabled
(
card
:
CardType
):
boolean
{
return
(
card
.
status
&
(
STATUS_DISABLED
|
STATUS_FORBIDDEN
))
>
0
;
}
export
const
cardStore
=
proxy
(
new
CardStore
());
export
const
cardStore
=
proxy
(
new
CardStore
());
src/ui/Duel/Message/PositionModal/index.tsx
View file @
c52620c7
...
@@ -108,8 +108,8 @@ export const PositionModal = () => {
...
@@ -108,8 +108,8 @@ export const PositionModal = () => {
footer=
{
<></>
}
footer=
{
<></>
}
>
>
<
div
className=
{
styles
.
container
}
>
<
div
className=
{
styles
.
container
}
>
{
positions
.
map
((
position
)
=>
(
{
positions
.
map
((
position
,
idx
)
=>
(
<
Button
onClick=
{
()
=>
onSummit
(
position
)
}
>
<
Button
key=
{
idx
}
onClick=
{
()
=>
onSummit
(
position
)
}
>
{
cardPosition
(
position
)
}
{
cardPosition
(
position
)
}
</
Button
>
</
Button
>
))
}
))
}
...
...
src/ui/Duel/Message/SelectCardsModal/index.tsx
View file @
c52620c7
...
@@ -197,6 +197,7 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({
...
@@ -197,6 +197,7 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({
<
YgoCard
<
YgoCard
code=
{
card
.
meta
.
id
}
code=
{
card
.
meta
.
id
}
targeted=
{
card
.
targeted
}
targeted=
{
card
.
targeted
}
disabled=
{
card
.
disabled
}
className=
{
styles
.
card
}
className=
{
styles
.
card
}
/>
/>
}
}
...
@@ -286,6 +287,7 @@ export interface Option {
...
@@ -286,6 +287,7 @@ export interface Option {
level2
?:
number
;
level2
?:
number
;
response
?:
number
;
response
?:
number
;
targeted
?:
boolean
;
targeted
?:
boolean
;
disabled
?:
boolean
;
// 便于直接返回这个信息
// 便于直接返回这个信息
//
//
// 尽量不要用这个字段
// 尽量不要用这个字段
...
...
src/ui/Duel/PlayMat/Card/index.tsx
View file @
c52620c7
...
@@ -14,7 +14,13 @@ import {
...
@@ -14,7 +14,13 @@ import {
import
{
Container
}
from
"
@/container
"
;
import
{
Container
}
from
"
@/container
"
;
import
{
getUIContainer
}
from
"
@/container/compat
"
;
import
{
getUIContainer
}
from
"
@/container/compat
"
;
import
{
eventbus
,
Task
}
from
"
@/infra
"
;
import
{
eventbus
,
Task
}
from
"
@/infra
"
;
import
{
cardStore
,
CardType
,
Interactivity
,
InteractType
}
from
"
@/stores
"
;
import
{
cardStore
,
CardType
,
Interactivity
,
InteractType
,
isCardDisabled
,
}
from
"
@/stores
"
;
import
{
showCardModal
as
displayCardModal
}
from
"
@/ui/Duel/Message/CardModal
"
;
import
{
showCardModal
as
displayCardModal
}
from
"
@/ui/Duel/Message/CardModal
"
;
import
{
YgoCard
}
from
"
@/ui/Shared
"
;
import
{
YgoCard
}
from
"
@/ui/Shared
"
;
...
@@ -344,6 +350,7 @@ export const Card: React.FC<{ idx: number }> = React.memo(({ idx }) => {
...
@@ -344,6 +350,7 @@ export const Card: React.FC<{ idx: number }> = React.memo(({ idx }) => {
<
YgoCard
<
YgoCard
className=
{
styles
.
cover
}
className=
{
styles
.
cover
}
code=
{
snap
.
code
===
0
?
snap
.
meta
.
id
:
snap
.
code
}
code=
{
snap
.
code
===
0
?
snap
.
meta
.
id
:
snap
.
code
}
disabled=
{
isCardDisabled
(
snap
as
CardType
)
}
/>
/>
<
YgoCard
className=
{
styles
.
back
}
isBack
/>
<
YgoCard
className=
{
styles
.
back
}
isBack
/>
</
div
>
</
div
>
...
...
src/ui/Shared/YgoCard/index.module.scss
View file @
c52620c7
...
@@ -22,3 +22,12 @@
...
@@ -22,3 +22,12 @@
z-index
:
2
;
z-index
:
2
;
pointer-events
:
none
;
pointer-events
:
none
;
}
}
.disabled
{
position
:
relative
;
display
:
flex
;
width
:
50%
;
justify-content
:
center
;
z-index
:
2
;
pointer-events
:
none
;
}
src/ui/Shared/YgoCard/index.tsx
View file @
c52620c7
...
@@ -13,6 +13,7 @@ interface Props {
...
@@ -13,6 +13,7 @@ interface Props {
isBack
?:
boolean
;
isBack
?:
boolean
;
code
?:
number
;
code
?:
number
;
targeted
?:
boolean
;
targeted
?:
boolean
;
disabled
?:
boolean
;
// cardName?: string;
// cardName?: string;
style
?:
CSSProperties
;
style
?:
CSSProperties
;
width
?:
number
|
string
;
width
?:
number
|
string
;
...
@@ -27,11 +28,13 @@ export const YgoCard: React.FC<Props> = (props) => {
...
@@ -27,11 +28,13 @@ export const YgoCard: React.FC<Props> = (props) => {
// cardName,
// cardName,
isBack
=
false
,
isBack
=
false
,
targeted
=
false
,
targeted
=
false
,
disabled
=
false
,
width
,
width
,
style
,
style
,
onClick
,
onClick
,
onLoad
,
onLoad
,
}
=
props
;
}
=
props
;
return
useMemo
(
return
useMemo
(
()
=>
(
()
=>
(
<
div
<
div
...
@@ -56,8 +59,15 @@ export const YgoCard: React.FC<Props> = (props) => {
...
@@ -56,8 +59,15 @@ export const YgoCard: React.FC<Props> = (props) => {
)
:
(
)
:
(
<></>
<></>
)
}
)
}
{
disabled
?
(
<
div
className=
{
styles
.
disabled
}
>
<
img
src=
{
`${assetsPath}/disabled.png`
}
/>
</
div
>
)
:
(
<></>
)
}
</
div
>
</
div
>
),
),
[
code
],
[
code
,
targeted
,
disabled
],
);
);
};
};
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