Commit 823793b9 authored by Chunchi Che's avatar Chunchi Che

handle unimplemented

parent 4b49e6d1
Pipeline #20787 passed with stages
in 13 minutes and 51 seconds
......@@ -70,5 +70,6 @@
"hint": {
"waitingDuration": 1.5
}
}
},
"unimplementedWhiteList": [1, 6]
}
......@@ -70,5 +70,6 @@
"hint": {
"waitingDuration": 1.5
}
}
},
"unimplementedWhiteList": [1, 6]
}
......@@ -149,7 +149,11 @@ export default class GameMsgAdapter implements StocAdapter {
break;
}
default: {
console.log("Unhandled GameMessage function=", func);
gameMsg.unimplemented = new ygopro.StocGameMessage({
unimplemented: new ygopro.StocGameMessage.MsgUnimplemented({
command: func,
}),
});
break;
}
......
......@@ -144,6 +144,8 @@ export interface DuelState {
waiting?: boolean;
unimplemented?: number; // 未处理的`Message`
// UI相关
modalState: ModalState;
}
......@@ -264,6 +266,11 @@ const duelSlice = createSlice({
setWaiting: (state, action: PayloadAction<boolean>) => {
state.waiting = action.payload;
},
// 未处理状态`Reducer`
setUnimplemented: (state, action: PayloadAction<number>) => {
state.unimplemented = action.payload;
},
},
extraReducers(builder) {
handsCase(builder);
......@@ -344,6 +351,7 @@ export const {
clearAllPlaceInteractivities,
setResult,
setWaiting,
setUnimplemented,
} = duelSlice.actions;
export const selectDuelHsStart = (state: RootState) => {
return state.duel.meInitInfo != null;
......@@ -354,4 +362,7 @@ export const selectDuelResult = (state: RootState) => {
export const selectWaiting = (state: RootState) => {
return state.duel.waiting;
};
export const selectUnimplemented = (state: RootState) => {
return state.duel.unimplemented;
};
export default duelSlice.reducer;
......@@ -21,6 +21,7 @@ import onMsgSelectYesNo from "./selectYesNo";
import onMsgUpdateHp from "./updateHp";
import onMsgWin from "./win";
import onMsgWait from "./wait";
import onUnimplemented from "./unimplemented";
import { setWaiting } from "../../reducers/duel/mod";
const ActiveList = [
......@@ -150,6 +151,11 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) {
break;
}
case "unimplemented": {
onUnimplemented(msg.unimplemented, dispatch);
break;
}
default: {
break;
}
......
import { ygopro } from "../../api/ocgcore/idl/ocgcore";
import { setUnimplemented } from "../../reducers/duel/mod";
import { AppDispatch } from "../../store";
import NeosConfig from "../../../neos.config.json";
export default (
unimplemented: ygopro.StocGameMessage.MsgUnimplemented,
dispatch: AppDispatch
) => {
if (!NeosConfig.unimplementedWhiteList.includes(unimplemented.command)) {
dispatch(setUnimplemented(unimplemented.command));
}
};
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