Commit f788671c authored by Chunchi Che's avatar Chunchi Che

Merge branch 'fix/idle_cmd' into 'main'

Fix/idle cmd

See merge request mycard/Neos!34
parents de2c697f 1b2859f2
...@@ -38,12 +38,17 @@ export const fetchHandsMeta = createAsyncThunk( ...@@ -38,12 +38,17 @@ export const fetchHandsMeta = createAsyncThunk(
); );
export const handsCase = (builder: ActionReducerMapBuilder<DuelState>) => { export const handsCase = (builder: ActionReducerMapBuilder<DuelState>) => {
builder.addCase(fetchHandsMeta.fulfilled, (state, action) => { builder.addCase(fetchHandsMeta.pending, (state, action) => {
const player = action.payload[0]; // Meta结果没返回之前先更新手牌`ID`
const hands = action.payload[1]; const player = action.meta.arg[0];
const ids = action.meta.arg[1];
const cards = hands.map((meta) => {
return { meta, transform: {}, interactivities: [] }; const cards = ids.map((id) => {
return {
meta: { id, data: {}, text: {} },
transform: {},
interactivities: [],
};
}); });
if (judgeSelf(player, state)) { if (judgeSelf(player, state)) {
if (state.meHands) { if (state.meHands) {
...@@ -60,6 +65,22 @@ export const handsCase = (builder: ActionReducerMapBuilder<DuelState>) => { ...@@ -60,6 +65,22 @@ export const handsCase = (builder: ActionReducerMapBuilder<DuelState>) => {
} }
} }
}); });
builder.addCase(fetchHandsMeta.fulfilled, (state, action) => {
// `Meta`结果回来后更新手牌的`Meta`结果
const player = action.payload[0];
const metas = action.payload[1];
const hands = judgeSelf(player, state) ? state.meHands : state.opHands;
if (hands) {
for (let hand of hands.cards) {
for (let meta of metas) {
if (hand.meta.id === meta.id) {
hand.meta = meta;
}
}
}
}
});
}; };
// 更新手牌的位置和旋转信息 // 更新手牌的位置和旋转信息
......
...@@ -48,17 +48,17 @@ interface CardTransform { ...@@ -48,17 +48,17 @@ interface CardTransform {
export enum InteractType { export enum InteractType {
// 可普通召唤 // 可普通召唤
SUMMON, SUMMON = 1,
// 可特殊召唤 // 可特殊召唤
SP_SUMMON, SP_SUMMON = 2,
// 可改变表示形式 // 可改变表示形式
POS_CHANGE, POS_CHANGE = 3,
// 可前场放置 // 可前场放置
MSET, MSET = 4,
// 可后场放置 // 可后场放置
SSET, SSET = 5,
// 可发动效果 // 可发动效果
ACTIVATE, ACTIVATE = 6,
} }
export interface Interactivity { export interface Interactivity {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment