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
d6508a0c
Commit
d6508a0c
authored
Apr 26, 2023
by
timel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: valtio logic in fixedslot/singleslot
parent
b4062341
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
45 deletions
+74
-45
src/ui/Duel/PlayMat/FixedSlot.tsx
src/ui/Duel/PlayMat/FixedSlot.tsx
+40
-25
src/ui/Duel/PlayMat/SingleSlot.tsx
src/ui/Duel/PlayMat/SingleSlot.tsx
+34
-20
No files found.
src/ui/Duel/PlayMat/FixedSlot.tsx
View file @
d6508a0c
...
@@ -24,6 +24,7 @@ import {
...
@@ -24,6 +24,7 @@ import {
clearAllIdleInteractivities
,
clearAllIdleInteractivities
,
type
CardState
,
type
CardState
,
clearAllPlaceInteradtivities
,
clearAllPlaceInteradtivities
,
messageStore
,
}
from
"
@/valtioStores
"
;
}
from
"
@/valtioStores
"
;
const
NeosConfig
=
useConfig
();
const
NeosConfig
=
useConfig
();
...
@@ -57,7 +58,7 @@ export const FixedSlot = (props: {
...
@@ -57,7 +58,7 @@ export const FixedSlot = (props: {
:
props
.
rotation
;
:
props
.
rotation
;
const
edgesWidth
=
2.0
;
const
edgesWidth
=
2.0
;
const
edgesColor
=
BABYLON
.
Color4
.
FromColor3
(
BABYLON
.
Color3
.
Yellow
());
const
edgesColor
=
BABYLON
.
Color4
.
FromColor3
(
BABYLON
.
Color3
.
Yellow
());
const
dispatch
=
store
.
dispatch
;
//
const dispatch = store.dispatch;
const
faceDown
=
const
faceDown
=
snapState
.
location
.
position
===
ygopro
.
CardPosition
.
FACEDOWN_DEFENSE
||
snapState
.
location
.
position
===
ygopro
.
CardPosition
.
FACEDOWN_DEFENSE
||
...
@@ -77,36 +78,50 @@ export const FixedSlot = (props: {
...
@@ -77,36 +78,50 @@ export const FixedSlot = (props: {
clearAllPlaceInteradtivities
(
1
);
clearAllPlaceInteradtivities
(
1
);
}
else
if
(
snapState
.
occupant
)
{
}
else
if
(
snapState
.
occupant
)
{
// 中央弹窗展示选中卡牌信息
// 中央弹窗展示选中卡牌信息
dispatch
(
setCardModalMeta
(
snapState
.
occupant
));
// dispatch(setCardModalMeta(snapState.occupant));
dispatch
(
messageStore
.
cardModal
.
meta
=
snapState
.
occupant
;
setCardModalInteractivies
(
// dispatch(
snapState
.
idleInteractivities
.
map
((
interactivity
)
=>
{
// setCardModalInteractivies(
return
{
// snapState.idleInteractivities.map((interactivity) => {
desc
:
interactTypeToString
(
interactivity
.
interactType
),
// return {
response
:
interactivity
.
response
,
// desc: interactTypeToString(interactivity.interactType),
};
// response: interactivity.response,
})
// };
)
// })
);
// )
dispatch
(
setCardModalCounters
(
snapState
.
counters
));
// );
dispatch
(
setCardModalIsOpen
(
true
));
messageStore
.
cardModal
.
interactivies
=
snapState
.
idleInteractivities
.
map
((
interactivity
)
=>
({
desc
:
interactTypeToString
(
interactivity
.
interactType
),
response
:
interactivity
.
response
,
}));
// dispatch(setCardModalCounters(snapState.counters));
messageStore
.
cardModal
.
counters
=
snapState
.
counters
;
// dispatch(setCardModalIsOpen(true));
messageStore
.
cardModal
.
isOpen
=
true
;
// 侧边栏展示超量素材信息
// 侧边栏展示超量素材信息
if
(
if
(
snapState
.
overlay_materials
&&
snapState
.
overlay_materials
&&
snapState
.
overlay_materials
.
length
>
0
snapState
.
overlay_materials
.
length
>
0
)
{
)
{
dispatch
(
// dispatch(
setCardListModalInfo
(
// setCardListModalInfo(
snapState
.
overlay_materials
?.
map
((
overlay
)
=>
{
// snapState.overlay_materials?.map((overlay) => {
return
{
// return {
meta
:
overlay
,
// meta: overlay,
interactivies
:
[],
// interactivies: [],
};
// };
})
||
[]
// }) || []
)
// )
);
// );
dispatch
(
setCardListModalIsOpen
(
true
));
messageStore
.
cardListModal
.
list
=
snapState
.
overlay_materials
?.
map
((
overlay
)
=>
({
meta
:
overlay
,
interactivies
:
[],
}))
||
[];
// dispatch(setCardListModalIsOpen(true));
messageStore
.
cardListModal
.
isOpen
=
true
;
}
}
}
}
},
},
...
...
src/ui/Duel/PlayMat/SingleSlot.tsx
View file @
d6508a0c
...
@@ -13,6 +13,8 @@ import { store } from "@/store";
...
@@ -13,6 +13,8 @@ import { store } from "@/store";
import
{
interactTypeToString
}
from
"
../utils
"
;
import
{
interactTypeToString
}
from
"
../utils
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
import
{
messageStore
}
from
"
@/valtioStores
"
;
const
NeosConfig
=
useConfig
();
const
NeosConfig
=
useConfig
();
const
transform
=
NeosConfig
.
ui
.
card
.
transform
;
const
transform
=
NeosConfig
.
ui
.
card
.
transform
;
export
const
Depth
=
0.005
;
export
const
Depth
=
0.005
;
...
@@ -24,7 +26,7 @@ export const SingleSlot = (props: {
...
@@ -24,7 +26,7 @@ export const SingleSlot = (props: {
})
=>
{
})
=>
{
const
snapState
=
useSnapshot
(
props
.
state
);
const
snapState
=
useSnapshot
(
props
.
state
);
const
boxRef
=
useRef
(
null
);
const
boxRef
=
useRef
(
null
);
const
dispatch
=
store
.
dispatch
;
//
const dispatch = store.dispatch;
const
edgeRender
=
const
edgeRender
=
snapState
.
find
((
item
)
=>
snapState
.
find
((
item
)
=>
item
===
undefined
?
false
:
item
.
idleInteractivities
.
length
>
0
item
===
undefined
?
false
:
item
.
idleInteractivities
.
length
>
0
...
@@ -35,26 +37,38 @@ export const SingleSlot = (props: {
...
@@ -35,26 +37,38 @@ export const SingleSlot = (props: {
useClick
(
useClick
(
(
_event
)
=>
{
(
_event
)
=>
{
if
(
snapState
.
length
!=
0
)
{
if
(
snapState
.
length
!=
0
)
{
dispatch
(
// dispatch(
setCardListModalInfo
(
// setCardListModalInfo(
snapState
// snapState
.
filter
(
// .filter(
(
item
)
=>
item
.
occupant
!==
undefined
&&
item
.
occupant
.
id
!==
0
// (item) => item.occupant !== undefined && item.occupant.id !== 0
)
// )
.
map
((
item
)
=>
{
// .map((item) => {
return
{
// return {
meta
:
item
.
occupant
,
// meta: item.occupant,
interactivies
:
item
.
idleInteractivities
.
map
((
interactivy
)
=>
{
// interactivies: item.idleInteractivities.map((interactivy) => {
return
{
// return {
desc
:
interactTypeToString
(
interactivy
.
interactType
),
// desc: interactTypeToString(interactivy.interactType),
response
:
interactivy
.
response
,
// response: interactivy.response,
};
// };
}),
// }),
};
// };
})
// })
// )
// );
messageStore
.
cardListModal
.
list
=
snapState
.
filter
(
(
item
)
=>
item
.
occupant
!==
undefined
&&
item
.
occupant
.
id
!==
0
)
)
);
.
map
((
item
)
=>
({
dispatch
(
setCardListModalIsOpen
(
true
));
meta
:
item
.
occupant
,
interactivies
:
item
.
idleInteractivities
.
map
((
interactivy
)
=>
({
desc
:
interactTypeToString
(
interactivy
.
interactType
),
response
:
interactivy
.
response
,
})),
}));
// dispatch(setCardListModalIsOpen(true));
messageStore
.
cardListModal
.
isOpen
=
true
;
}
}
},
},
boxRef
,
boxRef
,
...
...
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