数据兼容处理

This commit is contained in:
yuexin 2021-02-10 11:26:53 +08:00
parent 329e561771
commit f119263a90

View File

@ -199,10 +199,11 @@ export class GameResultCommand extends Command<CardGameState, {}> {
}catch(e){ }catch(e){
error(e); error(e);
} }
let defSeasonData:Map<string, any> = new Map(); let defSeasonData: any = {};
let defItemData: any = {};
for (let [key, player] of this.state.players) { for (let [key, player] of this.state.players) {
let obj = {}; defSeasonData[key] = {};
defSeasonData.set(key, obj); defItemData[key] = [];
} }
let resultData: any = { let resultData: any = {
@ -211,7 +212,7 @@ export class GameResultCommand extends Command<CardGameState, {}> {
results: [...results.values()], results: [...results.values()],
statics: statics, statics: statics,
seasonData: saveData.seasonData? saveData.seasonData: defSeasonData, seasonData: saveData.seasonData? saveData.seasonData: defSeasonData,
items: saveData.itemData? saveData.itemData: [] items: saveData.itemData? saveData.itemData: defItemData
}; };
this.room.bGameResult(resultData); this.room.bGameResult(resultData);
this.resetAllState(); this.resetAllState();