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
deft
Neos
Commits
44c8a183
Commit
44c8a183
authored
Dec 30, 2022
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finish magic select place ui
parent
920559e8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
10 deletions
+52
-10
src/service/duel/selectPlace.ts
src/service/duel/selectPlace.ts
+4
-1
src/service/duel/start.ts
src/service/duel/start.ts
+6
-1
src/ui/Duel/magics.tsx
src/ui/Duel/magics.tsx
+41
-7
src/ui/Duel/monsters.tsx
src/ui/Duel/monsters.tsx
+1
-1
No files found.
src/service/duel/selectPlace.ts
View file @
44c8a183
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
{
AppDispatch
}
from
"
../../store
"
;
import
{
AppDispatch
}
from
"
../../store
"
;
import
MsgSelectPlace
=
ygopro
.
StocGameMessage
.
MsgSelectPlace
;
import
MsgSelectPlace
=
ygopro
.
StocGameMessage
.
MsgSelectPlace
;
import
{
addMonsterPlaceSelectAble
,
addMagicPlaceSelectAble
}
from
"
../../reducers/duel/mod
"
;
import
{
addMonsterPlaceSelectAble
,
addMagicPlaceSelectAble
,
}
from
"
../../reducers/duel/mod
"
;
export
default
(
selectPlace
:
MsgSelectPlace
,
dispatch
:
AppDispatch
)
=>
{
export
default
(
selectPlace
:
MsgSelectPlace
,
dispatch
:
AppDispatch
)
=>
{
if
(
selectPlace
.
count
!=
1
)
{
if
(
selectPlace
.
count
!=
1
)
{
...
...
src/service/duel/start.ts
View file @
44c8a183
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
{
AppDispatch
}
from
"
../../store
"
;
import
{
AppDispatch
}
from
"
../../store
"
;
import
{
infoInit
,
setSelfType
,
initMonsters
,
initMagics
}
from
"
../../reducers/duel/mod
"
;
import
{
infoInit
,
setSelfType
,
initMonsters
,
initMagics
,
}
from
"
../../reducers/duel/mod
"
;
export
default
(
export
default
(
start
:
ygopro
.
StocGameMessage
.
MsgStart
,
start
:
ygopro
.
StocGameMessage
.
MsgStart
,
...
...
src/ui/Duel/magics.tsx
View file @
44c8a183
import
*
as
BABYLON
from
"
@babylonjs/core
"
;
import
*
as
BABYLON
from
"
@babylonjs/core
"
;
import
*
as
CONFIG
from
"
../../config/ui
"
;
import
*
as
CONFIG
from
"
../../config/ui
"
;
import
{
selectMeMagics
}
from
"
../../reducers/duel/magicSlice
"
;
import
{
useClick
}
from
"
./hook
"
;
import
{
Magic
}
from
"
../../reducers/duel/util
"
;
import
{
store
}
from
"
../../store
"
;
import
{
useAppSelector
}
from
"
../../hook
"
;
import
{
useRef
}
from
"
react
"
;
import
{
sendSelectPlaceResponse
}
from
"
../../api/ocgcore/ocgHelper
"
;
import
{
clearMagicSelectInfo
}
from
"
../../reducers/duel/mod
"
;
// TODO: use config
// TODO: use config
const
left
=
-
2.15
;
const
left
=
-
2.15
;
const
gap
=
1.05
;
const
gap
=
1.05
;
const
Magics
=
()
=>
{
const
Magics
=
()
=>
{
const
magics
=
useAppSelector
(
selectMeMagics
).
magics
;
return
(
return
(
<>
<>
{
[
0
,
1
,
2
,
3
,
4
].
map
((
idx
)
=>
{
{
magics
.
map
((
magic
)
=>
{
return
<
Magic
idx=
{
idx
}
/>;
return
<
CMagic
state=
{
magic
}
/>;
})
}
})
}
</>
</>
);
);
};
};
const
Magic
=
(
props
:
{
idx
:
number
})
=>
{
const
CMagic
=
(
props
:
{
state
:
Magic
})
=>
{
const
state
=
props
.
state
;
const
planeRef
=
useRef
(
null
);
const
shape
=
CONFIG
.
CardSlotShape
();
const
shape
=
CONFIG
.
CardSlotShape
();
const
position
=
new
BABYLON
.
Vector3
(
const
position
=
new
BABYLON
.
Vector3
(
left
+
gap
*
props
.
idx
,
left
+
gap
*
state
.
sequence
,
shape
.
depth
/
2
+
CONFIG
.
Floating
,
shape
.
depth
/
2
+
CONFIG
.
Floating
,
-
2.6
-
2.6
);
);
const
rotation
=
CONFIG
.
CardSlotRotation
();
const
rotation
=
CONFIG
.
CardSlotRotation
();
const
edgesWidth
=
2.0
;
const
edgesColor
=
BABYLON
.
Color4
.
FromColor3
(
BABYLON
.
Color3
.
Yellow
());
const
dispatch
=
store
.
dispatch
;
useClick
(
(
_event
)
=>
{
if
(
state
.
selectInfo
)
{
sendSelectPlaceResponse
(
state
.
selectInfo
.
response
);
dispatch
(
clearMagicSelectInfo
(
0
));
dispatch
(
clearMagicSelectInfo
(
1
));
}
},
planeRef
,
[
state
]
);
return
(
return
(
<
plane
<
plane
name=
{
`magic-${props.idx}`
}
name=
{
`magic-${state.sequence}`
}
ref=
{
planeRef
}
width=
{
shape
.
width
}
width=
{
shape
.
width
}
height=
{
shape
.
height
}
height=
{
shape
.
height
}
position=
{
position
}
position=
{
position
}
rotation=
{
rotation
}
rotation=
{
rotation
}
enableEdgesRendering
edgesWidth=
{
state
.
selectInfo
?
edgesWidth
:
0
}
edgesColor=
{
edgesColor
}
>
>
<
standardMaterial
<
standardMaterial
name=
{
`magic-mat-${props.
idx
}`
}
name=
{
`magic-mat-${props.
state.sequence
}`
}
diffuseTexture=
{
diffuseTexture=
{
new
BABYLON
.
Texture
(
`http://localhost:3030/images/card_slot.png`
)
state
.
occupant
?
new
BABYLON
.
Texture
(
`http://localhost:3030/images/card_back.jpg`
)
:
new
BABYLON
.
Texture
(
`http://localhost:3030/images/card_slot.png`
)
}
}
alpha=
{
0.2
}
alpha=
{
0.2
}
></
standardMaterial
>
></
standardMaterial
>
...
...
src/ui/Duel/monsters.tsx
View file @
44c8a183
...
@@ -42,7 +42,7 @@ const CommonMonster = (props: { state: Monster }) => {
...
@@ -42,7 +42,7 @@ const CommonMonster = (props: { state: Monster }) => {
useClick
(
useClick
(
(
_event
)
=>
{
(
_event
)
=>
{
if
(
props
.
state
.
selectInfo
)
{
if
(
props
.
state
.
selectInfo
)
{
sendSelectPlaceResponse
(
props
.
state
.
selectInfo
?
.
response
);
sendSelectPlaceResponse
(
props
.
state
.
selectInfo
.
response
);
dispatch
(
clearMonsterSelectInfo
(
0
));
dispatch
(
clearMonsterSelectInfo
(
0
));
dispatch
(
clearMonsterSelectInfo
(
1
));
dispatch
(
clearMonsterSelectInfo
(
1
));
}
}
...
...
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