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
e7bbc317
Commit
e7bbc317
authored
Dec 01, 2022
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finish new_turn
parent
b2f71ef0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
src/reducers/duel/turnSlice.ts
src/reducers/duel/turnSlice.ts
+4
-0
src/ui/Duel/simpleDuel/mod.tsx
src/ui/Duel/simpleDuel/mod.tsx
+8
-1
No files found.
src/reducers/duel/turnSlice.ts
View file @
e7bbc317
import
{
PayloadAction
,
CaseReducer
}
from
"
@reduxjs/toolkit
"
;
import
{
RootState
}
from
"
../../store
"
;
import
{
DuelState
}
from
"
./mod
"
;
export
const
newTurnImpl
:
CaseReducer
<
DuelState
,
PayloadAction
<
number
>>
=
(
...
...
@@ -7,3 +8,6 @@ export const newTurnImpl: CaseReducer<DuelState, PayloadAction<number>> = (
)
=>
{
state
.
currentPlayer
=
action
.
payload
;
};
export
const
selectCurrentPlayer
=
(
state
:
RootState
)
=>
state
.
duel
.
currentPlayer
;
src/ui/Duel/simpleDuel/mod.tsx
View file @
e7bbc317
...
...
@@ -18,6 +18,7 @@ import renderExclusion from "./exclusion";
import
renderField
from
"
./field
"
;
import
*
as
CONFIG
from
"
../../../config/ui
"
;
import
{
Card
}
from
"
../../../api/cards
"
;
import
{
selectCurrentPlayer
}
from
"
../../../reducers/duel/turnSlice
"
;
// CONFIG
...
...
@@ -34,6 +35,7 @@ export default class SimpleDuelPlateImpl implements IDuelPlate {
return
new
Array
(
5
).
fill
({
id
:
10000
,
data
:
{},
text
:
{}
});
};
const
hands
=
useAppSelector
(
this
.
handsSelector
||
defaultHandsSelector
);
const
currentPlayer
=
useAppSelector
(
selectCurrentPlayer
);
// ----- WebGL渲染 -----
const
canvasRef
=
useRef
<
HTMLCanvasElement
>
(
null
);
...
...
@@ -101,11 +103,16 @@ export default class SimpleDuelPlateImpl implements IDuelPlate {
groundMaterial
.
diffuseTexture
.
hasAlpha
=
true
;
ground
.
material
=
groundMaterial
;
/* 一些未处理的逻辑,在这里用日志打印出来 */
// 当前操作玩家
console
.
log
(
`currentPlayer:`
+
currentPlayer
);
// 渲染循环
engine
.
runRenderLoop
(()
=>
{
scene
.
render
();
});
},
[
canvasRef
,
hands
]);
},
[
canvasRef
,
hands
,
currentPlayer
]);
useEffect
(()
=>
{
// 监听状态变化,并实现动画
...
...
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