Commit d6111209 authored by Chunchi Che's avatar Chunchi Che

Merge branch 'feat/callstack' into 'main'

Feat/callstack

See merge request mycard/Neos!146
parents e9d1b91f 2ba135b6
neos-protobuf @ 91892bf3
Subproject commit 3973685c657030b845ef385e8a0610971c8c60b9 Subproject commit 91892bf33e2359f6617c82b0f5f3617ed36f3540
{ {
"version": 4948, "version":4948,
"servers": [ "servers":[
{ {
"ip": "koishi-r.momobako.com", "ip":"koishi-r.momobako.com",
"port": "7211" "port":"7211"
} }
], ],
"assetsPath": "/neos-assets", "assetsPath":"/neos-assets",
"cardImgUrl": "https://cdn02.moecube.com:444/images/ygopro-images-zh-CN", "cardImgUrl":"https://cdn02.moecube.com:444/images/ygopro-images-zh-CN",
"cardsDbUrl": "https://cdn02.moecube.com:444/ygopro-database/zh-CN/cards.cdb", "cardsDbUrl":"https://cdn02.moecube.com:444/ygopro-database/zh-CN/cards.cdb",
"stringsUrl": "https://cdn02.moecube.com:444/ygopro-database/zh-CN/strings.conf", "stringsUrl":"https://cdn02.moecube.com:444/ygopro-database/zh-CN/strings.conf",
"ui": { "ui":{
"ground": { "ground":{
"width": 9.9, "width":9.9,
"height": 8 "height":8
},
"card": {
"transform": {
"x": 0.8,
"y": 1,
"z": 0.05
},
"rotation": {
"x": 1.55,
"y": 0,
"z": 0
},
"reverseRotation": {
"x": 1.55,
"y": 3.1,
"z": 0
},
"defenceRotation": {
"x": 1.55,
"y": 1.55,
"z": 0
},
"handRotation": {
"x": 1,
"y": 0,
"z": 0
},
"handHoverScaling": {
"x": 1.2,
"y": 1.2,
"z": 1
}, },
"floating": 0.02 "card":{
}, "transform":{
"layout": { "x":0.8,
"header": { "y":1,
"height": 80 "z":0.05
},
"rotation":{
"x":1.55,
"y":0,
"z":0
},
"reverseRotation":{
"x":1.55,
"y":3.1,
"z":0
},
"defenceRotation":{
"x":1.55,
"y":1.55,
"z":0
},
"handRotation":{
"x":1,
"y":0,
"z":0
},
"handHoverScaling":{
"x":1.2,
"y":1.2,
"z":1
},
"floating":0.02
}, },
"content": { "layout":{
"height": 800 "header":{
"height":80
},
"content":{
"height":800
},
"sider":{
"width":300
},
"footer":{
"height":80
}
}, },
"sider": { "status":{
"width": 300 "avatarSize":40,
"meAvatarColor":"#0e63e1",
"opAvatarColor":"#e10e68"
}, },
"footer": { "hint":{
"height": 80 "waitingDuration":1.5
} }
}, },
"status": { "unimplementedWhiteList":[
"avatarSize": 40, 1,
"meAvatarColor": "#0e63e1", 6,
"opAvatarColor": "#e10e68" 7,
}, 30,
"hint": { 31,
"waitingDuration": 1.5 32,
} 34,
} 54,
55,
56,
60,
61,
62,
63,
64,
65,
70,
71,
72,
73,
74,
75,
76,
80,
81,
83,
93,
95,
96,
97,
101,
102,
110,
111,
112,
113,
114,
120,
121,
122,
123,
130,
131,
132,
133,
160,
161,
163,
164,
165,
170,
180
]
} }
{ {
"version": 4948, "version":4948,
"servers": [ "servers":[
{ {
"ip": "koishi-r.momobako.com", "ip":"koishi-r.momobako.com",
"port": "7211" "port":"7211"
} }
], ],
"assetsPath": "https://cdn02.moecube.com:444/neos/neos-assets", "assetsPath":"/neos-assets",
"cardImgUrl": "https://cdn02.moecube.com:444/images/ygopro-images-zh-CN", "cardImgUrl":"https://cdn02.moecube.com:444/images/ygopro-images-zh-CN",
"cardsDbUrl": "https://cdn02.moecube.com:444/ygopro-database/zh-CN/cards.cdb", "cardsDbUrl":"https://cdn02.moecube.com:444/ygopro-database/zh-CN/cards.cdb",
"stringsUrl": "https://cdn02.moecube.com:444/ygopro-database/zh-CN/strings.conf", "stringsUrl":"https://cdn02.moecube.com:444/ygopro-database/zh-CN/strings.conf",
"ui": { "ui":{
"ground": { "ground":{
"width": 9.9, "width":9.9,
"height": 8 "height":8
},
"card": {
"transform": {
"x": 0.8,
"y": 1,
"z": 0.05
},
"rotation": {
"x": 1.55,
"y": 0,
"z": 0
},
"reverseRotation": {
"x": 1.55,
"y": 3.1,
"z": 0
},
"defenceRotation": {
"x": 1.55,
"y": 1.55,
"z": 0
},
"handRotation": {
"x": 1,
"y": 0,
"z": 0
},
"handHoverScaling": {
"x": 1.2,
"y": 1.2,
"z": 1
}, },
"floating": 0.02 "card":{
}, "transform":{
"layout": { "x":0.8,
"header": { "y":1,
"height": 80 "z":0.05
},
"rotation":{
"x":1.55,
"y":0,
"z":0
},
"reverseRotation":{
"x":1.55,
"y":3.1,
"z":0
},
"defenceRotation":{
"x":1.55,
"y":1.55,
"z":0
},
"handRotation":{
"x":1,
"y":0,
"z":0
},
"handHoverScaling":{
"x":1.2,
"y":1.2,
"z":1
},
"floating":0.02
}, },
"content": { "layout":{
"height": 800 "header":{
"height":80
},
"content":{
"height":800
},
"sider":{
"width":300
},
"footer":{
"height":80
}
}, },
"sider": { "status":{
"width": 300 "avatarSize":40,
"meAvatarColor":"#0e63e1",
"opAvatarColor":"#e10e68"
}, },
"footer": { "hint":{
"height": 80 "waitingDuration":1.5
} }
}, },
"status": { "unimplementedWhiteList":[
"avatarSize": 40, 1,
"meAvatarColor": "#0e63e1", 6,
"opAvatarColor": "#e10e68" 7,
}, 30,
"hint": { 31,
"waitingDuration": 1.5 32,
} 34,
} 54,
55,
56,
60,
61,
62,
63,
64,
65,
70,
71,
72,
73,
74,
75,
76,
80,
81,
83,
93,
95,
96,
97,
101,
102,
110,
111,
112,
113,
114,
120,
121,
122,
123,
130,
131,
132,
133,
160,
161,
163,
164,
165,
170,
180
]
} }
This diff is collapsed.
...@@ -149,7 +149,9 @@ export default class GameMsgAdapter implements StocAdapter { ...@@ -149,7 +149,9 @@ export default class GameMsgAdapter implements StocAdapter {
break; break;
} }
default: { default: {
console.log("Unhandled GameMessage function=", func); gameMsg.unimplemented = new ygopro.StocGameMessage.MsgUnimplemented({
command: func,
});
break; break;
} }
......
...@@ -144,6 +144,8 @@ export interface DuelState { ...@@ -144,6 +144,8 @@ export interface DuelState {
waiting?: boolean; waiting?: boolean;
unimplemented?: number; // 未处理的`Message`
// UI相关 // UI相关
modalState: ModalState; modalState: ModalState;
} }
...@@ -264,6 +266,11 @@ const duelSlice = createSlice({ ...@@ -264,6 +266,11 @@ const duelSlice = createSlice({
setWaiting: (state, action: PayloadAction<boolean>) => { setWaiting: (state, action: PayloadAction<boolean>) => {
state.waiting = action.payload; state.waiting = action.payload;
}, },
// 未处理状态`Reducer`
setUnimplemented: (state, action: PayloadAction<number>) => {
state.unimplemented = action.payload;
},
}, },
extraReducers(builder) { extraReducers(builder) {
handsCase(builder); handsCase(builder);
...@@ -344,6 +351,7 @@ export const { ...@@ -344,6 +351,7 @@ export const {
clearAllPlaceInteractivities, clearAllPlaceInteractivities,
setResult, setResult,
setWaiting, setWaiting,
setUnimplemented,
} = duelSlice.actions; } = duelSlice.actions;
export const selectDuelHsStart = (state: RootState) => { export const selectDuelHsStart = (state: RootState) => {
return state.duel.meInitInfo != null; return state.duel.meInitInfo != null;
...@@ -354,4 +362,7 @@ export const selectDuelResult = (state: RootState) => { ...@@ -354,4 +362,7 @@ export const selectDuelResult = (state: RootState) => {
export const selectWaiting = (state: RootState) => { export const selectWaiting = (state: RootState) => {
return state.duel.waiting; return state.duel.waiting;
}; };
export const selectUnimplemented = (state: RootState) => {
return state.duel.unimplemented;
};
export default duelSlice.reducer; export default duelSlice.reducer;
...@@ -21,6 +21,7 @@ import onMsgSelectYesNo from "./selectYesNo"; ...@@ -21,6 +21,7 @@ import onMsgSelectYesNo from "./selectYesNo";
import onMsgUpdateHp from "./updateHp"; import onMsgUpdateHp from "./updateHp";
import onMsgWin from "./win"; import onMsgWin from "./win";
import onMsgWait from "./wait"; import onMsgWait from "./wait";
import onUnimplemented from "./unimplemented";
import { setWaiting } from "../../reducers/duel/mod"; import { setWaiting } from "../../reducers/duel/mod";
const ActiveList = [ const ActiveList = [
...@@ -150,6 +151,11 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) { ...@@ -150,6 +151,11 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) {
break; break;
} }
case "unimplemented": {
onUnimplemented(msg.unimplemented, dispatch);
break;
}
default: { default: {
break; 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));
}
};
import React from "react";
export const Button2D = (props: {
text: string;
left: number;
enable: boolean;
onClick: () => void;
}) => (
<adtFullscreenUi name="ui">
<rectangle
name="rect"
height="20px"
width="60px"
isEnabled={props.enable}
left={props.left}
>
<rectangle>
<babylon-button
name="close-icon"
onPointerDownObservable={props.onClick}
>
<textBlock
text={props.text}
fontFamily="FontAwesome"
fontStyle="bold"
fontSize={15}
color={props.enable ? "yellow" : "white"}
/>
</babylon-button>
</rectangle>
</rectangle>
</adtFullscreenUi>
);
import React from "react";
import { useNavigate } from "react-router-dom";
import { sendSurrender } from "../../api/ocgcore/ocgHelper";
import { useAppSelector } from "../../hook";
import { selectUnimplemented } from "../../reducers/duel/mod";
import { Alert } from "antd";
const NeosAlert = () => {
const unimplemented = useAppSelector(selectUnimplemented);
const navigate = useNavigate();
return (
<>
{unimplemented ? (
<Alert
message={`Unimplemented message with code=${unimplemented}`}
description="It seems that there's something unimplemented by Neos. Sincerely apologize for that. Contact use to fix this issue: <linuxgnulover@gmail.com>"
showIcon
type="error"
closable
banner
afterClose={() => {
// 发送投降信号
sendSurrender();
navigate("/");
}}
/>
) : (
<></>
)}
</>
);
};
export default NeosAlert;
...@@ -25,11 +25,13 @@ import DuelTimeLine from "./timeLine"; ...@@ -25,11 +25,13 @@ import DuelTimeLine from "./timeLine";
import { Row } from "antd"; import { Row } from "antd";
import SendBox from "./sendBox"; import SendBox from "./sendBox";
import PlayerStatus from "./status"; import PlayerStatus from "./status";
import Alert from "./alert";
// Ref: https://github.com/brianzinn/react-babylonjs/issues/126 // Ref: https://github.com/brianzinn/react-babylonjs/issues/126
const NeosDuel = () => { const NeosDuel = () => {
return ( return (
<> <>
<Alert />
<NeosLayout <NeosLayout
sider={<NeosSider />} sider={<NeosSider />}
header={<PlayerStatus />} header={<PlayerStatus />}
......
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