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
79d58872
Commit
79d58872
authored
Jan 23, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init extraDeck
parent
390c9585
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
16 deletions
+12
-16
src/reducers/duel/extraDeckSlice.ts
src/reducers/duel/extraDeckSlice.ts
+7
-15
src/reducers/duel/generic.ts
src/reducers/duel/generic.ts
+1
-1
src/ui/WaitRoom.tsx
src/ui/WaitRoom.tsx
+4
-0
No files found.
src/reducers/duel/extraDeckSlice.ts
View file @
79d58872
...
@@ -19,7 +19,7 @@ import { judgeSelf } from "./util";
...
@@ -19,7 +19,7 @@ import { judgeSelf } from "./util";
export
interface
ExtraDeckState
extends
DuelFieldState
{}
export
interface
ExtraDeckState
extends
DuelFieldState
{}
// 初始化额外卡组
// 初始化额外卡组
export
const
initExtraDeckMeta
=
createAsyncRepeatedMetaThunk
(
export
const
init
Me
ExtraDeckMeta
=
createAsyncRepeatedMetaThunk
(
"
duel/initExtraDeckMeta
"
"
duel/initExtraDeckMeta
"
);
);
...
@@ -29,34 +29,26 @@ export const fetchExtraDeckMeta = createAsyncMetaThunk(
...
@@ -29,34 +29,26 @@ export const fetchExtraDeckMeta = createAsyncMetaThunk(
);
);
export
const
extraDeckCase
=
(
builder
:
ActionReducerMapBuilder
<
DuelState
>
)
=>
{
export
const
extraDeckCase
=
(
builder
:
ActionReducerMapBuilder
<
DuelState
>
)
=>
{
builder
.
addCase
(
initExtraDeckMeta
.
pending
,
(
state
,
action
)
=>
{
builder
.
addCase
(
init
Me
ExtraDeckMeta
.
pending
,
(
state
,
action
)
=>
{
const
player
=
action
.
meta
.
arg
.
controler
;
const
_
=
action
.
meta
.
arg
.
controler
;
const
ids
=
action
.
meta
.
arg
.
codes
;
const
ids
=
action
.
meta
.
arg
.
codes
;
const
cards
=
ids
.
map
((
id
)
=>
{
const
cards
=
ids
.
map
((
id
)
=>
{
return
{
return
{
occupant
:
{
id
,
data
:
{},
text
:
{}
},
occupant
:
{
id
,
data
:
{},
text
:
{}
},
location
:
{
location
:
{
controler
:
player
,
location
:
ygopro
.
CardZone
.
EXTRA
,
location
:
ygopro
.
CardZone
.
EXTRA
,
},
},
idleInteractivities
:
[],
idleInteractivities
:
[],
};
};
});
});
if
(
judgeSelf
(
player
,
state
))
{
state
.
meExtraDeck
=
{
inner
:
cards
};
state
.
meExtraDeck
=
{
inner
:
cards
};
}
else
{
state
.
opExtraDeck
=
{
inner
:
cards
};
}
});
});
builder
.
addCase
(
initExtraDeckMeta
.
fulfilled
,
(
state
,
action
)
=>
{
builder
.
addCase
(
init
Me
ExtraDeckMeta
.
fulfilled
,
(
state
,
action
)
=>
{
const
player
=
action
.
payload
.
controler
;
const
_
=
action
.
payload
.
controler
;
const
metas
=
action
.
payload
.
metas
;
const
metas
=
action
.
payload
.
metas
;
const
extraDeck
=
judgeSelf
(
player
,
state
)
updateCardMeta
(
state
.
meExtraDeck
,
metas
);
?
state
.
meExtraDeck
:
state
.
opExtraDeck
;
updateCardMeta
(
extraDeck
,
metas
);
});
});
builder
.
addCase
(
fetchExtraDeckMeta
.
pending
,
(
state
,
action
)
=>
{
builder
.
addCase
(
fetchExtraDeckMeta
.
pending
,
(
state
,
action
)
=>
{
...
...
src/reducers/duel/generic.ts
View file @
79d58872
...
@@ -18,7 +18,7 @@ export interface DuelFieldState {
...
@@ -18,7 +18,7 @@ export interface DuelFieldState {
export
interface
CardState
{
export
interface
CardState
{
occupant
?:
CardMeta
;
// 占据此位置的卡牌元信息
occupant
?:
CardMeta
;
// 占据此位置的卡牌元信息
location
:
{
location
:
{
controler
:
number
;
controler
?
:
number
;
location
?:
number
;
location
?:
number
;
position
?:
ygopro
.
CardPosition
;
position
?:
ygopro
.
CardPosition
;
overlay_sequence
?:
number
;
overlay_sequence
?:
number
;
...
...
src/ui/WaitRoom.tsx
View file @
79d58872
...
@@ -23,6 +23,8 @@ import {
...
@@ -23,6 +23,8 @@ import {
import
socketMiddleWare
,
{
socketCmd
}
from
"
../middleware/socket
"
;
import
socketMiddleWare
,
{
socketCmd
}
from
"
../middleware/socket
"
;
import
sqliteMiddleWare
,
{
sqliteCmd
}
from
"
../middleware/sqlite
"
;
import
sqliteMiddleWare
,
{
sqliteCmd
}
from
"
../middleware/sqlite
"
;
import
{
Button
}
from
"
antd
"
;
import
{
Button
}
from
"
antd
"
;
import
{
store
}
from
"
../store
"
;
import
{
initMeExtraDeckMeta
}
from
"
../reducers/duel/extraDeckSlice
"
;
const
READY_STATE
=
"
ready
"
;
const
READY_STATE
=
"
ready
"
;
...
@@ -56,6 +58,7 @@ export default function WaitRoom() {
...
@@ -56,6 +58,7 @@ export default function WaitRoom() {
});
});
},
[]);
},
[]);
const
dispatch
=
store
.
dispatch
;
const
joined
=
useAppSelector
(
selectJoined
);
const
joined
=
useAppSelector
(
selectJoined
);
const
chat
=
useAppSelector
(
selectChat
);
const
chat
=
useAppSelector
(
selectChat
);
const
isHost
=
useAppSelector
(
selectIsHost
);
const
isHost
=
useAppSelector
(
selectIsHost
);
...
@@ -67,6 +70,7 @@ export default function WaitRoom() {
...
@@ -67,6 +70,7 @@ export default function WaitRoom() {
const
deck
=
await
fetchDeck
(
"
hero.ydk
"
);
const
deck
=
await
fetchDeck
(
"
hero.ydk
"
);
sendUpdateDeck
(
deck
);
sendUpdateDeck
(
deck
);
dispatch
(
initMeExtraDeckMeta
({
controler
:
0
,
codes
:
deck
.
extra
||
[]
}));
setChoseDeck
(
true
);
setChoseDeck
(
true
);
};
};
...
...
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