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
be7512d0
Commit
be7512d0
authored
Nov 19, 2022
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
register handsSelector in simpleDuelPlate
parent
9ed2ceaf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
src/reducers/duel/handsSlice.ts
src/reducers/duel/handsSlice.ts
+6
-0
src/ui/Duel/main.tsx
src/ui/Duel/main.tsx
+16
-1
No files found.
src/reducers/duel/handsSlice.ts
View file @
be7512d0
import
{
PayloadAction
,
CaseReducer
}
from
"
@reduxjs/toolkit
"
;
import
{
PayloadAction
,
CaseReducer
}
from
"
@reduxjs/toolkit
"
;
import
{
DuelState
}
from
"
./mod
"
;
import
{
DuelState
}
from
"
./mod
"
;
import
{
RootState
}
from
"
../../store
"
;
export
interface
Hands
{
export
interface
Hands
{
cards
:
number
[];
// TODO: use Card struct Unitly
cards
:
number
[];
// TODO: use Card struct Unitly
...
@@ -28,3 +29,8 @@ export const opAddHandsImpl: CaseReducer<DuelState, PayloadAction<number[]>> = (
...
@@ -28,3 +29,8 @@ export const opAddHandsImpl: CaseReducer<DuelState, PayloadAction<number[]>> = (
state
.
opHands
=
{
cards
:
action
.
payload
};
state
.
opHands
=
{
cards
:
action
.
payload
};
}
}
};
};
export
const
selectMeHands
=
(
state
:
RootState
)
=>
state
.
duel
.
meHands
||
{
cards
:
[]
};
export
const
selectOpHands
=
(
state
:
RootState
)
=>
state
.
duel
.
opHands
||
{
cards
:
[]
};
src/ui/Duel/main.tsx
View file @
be7512d0
...
@@ -3,8 +3,23 @@
...
@@ -3,8 +3,23 @@
*
*
* */
* */
import
{
RootState
}
from
"
../../store
"
;
import
SimpleDuelPlateImpl
from
"
./simpleDuel/mod
"
;
import
SimpleDuelPlateImpl
from
"
./simpleDuel/mod
"
;
import
{
selectMeHands
}
from
"
../../reducers/duel/handsSlice
"
;
export
default
function
Duel
()
{
export
default
function
Duel
()
{
return
new
SimpleDuelPlateImpl
().
render
();
const
simpleDuelPlate
=
new
SimpleDuelPlateImpl
();
// TODO: opHands
const
handsSelector
=
(
state
:
RootState
)
=>
{
const
cards
=
selectMeHands
(
state
).
cards
;
return
cards
.
map
((
item
)
=>
{
return
{
code
:
item
};
});
};
simpleDuelPlate
.
registerHands
(
handsSelector
);
return
simpleDuelPlate
.
render
();
}
}
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