|
@@ -542,6 +542,9 @@ export default class GameData {
|
|
|
let o = arr[i];
|
|
let o = arr[i];
|
|
|
let id = o.id;
|
|
let id = o.id;
|
|
|
let vo: GeneralVO = this.createGeneralVO(id, 0, arr[i]);
|
|
let vo: GeneralVO = this.createGeneralVO(id, 0, arr[i]);
|
|
|
|
|
+ if(!vo){
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
if (vo.pos >= 0 && vo.pos < 5) {
|
|
if (vo.pos >= 0 && vo.pos < 5) {
|
|
|
this.player.generals[vo.pos] = vo;
|
|
this.player.generals[vo.pos] = vo;
|
|
@@ -577,13 +580,14 @@ export default class GameData {
|
|
|
this.player.setProp(PLAYERPROP.TURNTABLE_USECARDTIMES, data.turntableUseCardTimes);
|
|
this.player.setProp(PLAYERPROP.TURNTABLE_USECARDTIMES, data.turntableUseCardTimes);
|
|
|
this.player.setProp(PLAYERPROP.TURNTABLE_TOTAL, data.turntableTotal);
|
|
this.player.setProp(PLAYERPROP.TURNTABLE_TOTAL, data.turntableTotal);
|
|
|
this.player.setProp(PLAYERPROP.USESKILL_TIME, data.skill_coolTime);
|
|
this.player.setProp(PLAYERPROP.USESKILL_TIME, data.skill_coolTime);
|
|
|
-
|
|
|
|
|
- this.player.setProp(PLAYERPROP.GENERAL_TRAIN_TIMES, data.general_train_times);
|
|
|
|
|
- this.player.setProp(PLAYERPROP.INVEST_TIMES, data.invest_times);
|
|
|
|
|
- this.player.setProp(PLAYERPROP.GENERAL_LUCK_TIMES, data.general_luck_times);
|
|
|
|
|
- this.player.setProp(PLAYERPROP.TURNTABLE_LUCK_TIMES, data.turntable_luck_times);
|
|
|
|
|
- this.player.setProp(PLAYERPROP.USE_SKILLS_TIMES, data.use_skills_times);
|
|
|
|
|
- this.player.setProp(PLAYERPROP.LOOK_VIDEO_TIMES, data.look_video_times);
|
|
|
|
|
|
|
+ this.player.setProp(PLAYERPROP.TASK_REDBAG_COUNT, data.taskRedBag);
|
|
|
|
|
+
|
|
|
|
|
+ // this.player.setProp(PLAYERPROP.GENERAL_TRAIN_TIMES, data.general_train_times);
|
|
|
|
|
+ // this.player.setProp(PLAYERPROP.INVEST_TIMES, data.invest_times);
|
|
|
|
|
+ // this.player.setProp(PLAYERPROP.GENERAL_LUCK_TIMES, data.general_luck_times);
|
|
|
|
|
+ // this.player.setProp(PLAYERPROP.TURNTABLE_LUCK_TIMES, data.turntable_luck_times);
|
|
|
|
|
+ // this.player.setProp(PLAYERPROP.USE_SKILLS_TIMES, data.use_skills_times);
|
|
|
|
|
+ // this.player.setProp(PLAYERPROP.LOOK_VIDEO_TIMES, data.look_video_times);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private initPlayerPropsNoCheck(gameUserData) {
|
|
private initPlayerPropsNoCheck(gameUserData) {
|
|
@@ -642,6 +646,9 @@ export default class GameData {
|
|
|
private createGeneralVO(id, type: number, arg = null): GeneralVO {
|
|
private createGeneralVO(id, type: number, arg = null): GeneralVO {
|
|
|
let vo = new GeneralVO();
|
|
let vo = new GeneralVO();
|
|
|
let config = this.getGeneralByID(id);
|
|
let config = this.getGeneralByID(id);
|
|
|
|
|
+ if(!config){
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
//配置
|
|
//配置
|
|
|
vo.id = config.id;
|
|
vo.id = config.id;
|
|
|
vo.camp = config.camp;
|
|
vo.camp = config.camp;
|
|
@@ -765,7 +772,7 @@ export default class GameData {
|
|
|
* 增加武将
|
|
* 增加武将
|
|
|
* @param id 武将id
|
|
* @param id 武将id
|
|
|
* @param type 0服务器数据 1整卡(只有整卡可以无视兵营) 2碎片
|
|
* @param type 0服务器数据 1整卡(只有整卡可以无视兵营) 2碎片
|
|
|
- * @param arg type=0表示服务器数据 type=2表示碎片数量
|
|
|
|
|
|
|
+ * @param arg type=0表示服务器数据 type=2表示碎片数量 type=3在服务器获取武将 type=4表示在服务器获取武将碎片
|
|
|
*/
|
|
*/
|
|
|
addGeneral(id, type: number = 1, arg = null) {
|
|
addGeneral(id, type: number = 1, arg = null) {
|
|
|
if (type == 1) {
|
|
if (type == 1) {
|
|
@@ -774,6 +781,12 @@ export default class GameData {
|
|
|
else if (type == 2) {
|
|
else if (type == 2) {
|
|
|
GameController.http.addItem(this.addItem.bind(this), ITEMTYPE.GENERAL_FRAGMENT, id, arg);
|
|
GameController.http.addItem(this.addItem.bind(this), ITEMTYPE.GENERAL_FRAGMENT, id, arg);
|
|
|
}
|
|
}
|
|
|
|
|
+ else if (type == 3) {
|
|
|
|
|
+ GameController.http.getInitGeneralDemo(this.addItem.bind(this), id, ITEMTYPE.GENERAL, 1);
|
|
|
|
|
+ }
|
|
|
|
|
+ else if (type == 4) {
|
|
|
|
|
+ GameController.http.getInitGeneralDemo(this.addItem.bind(this), id, ITEMTYPE.GENERAL_FRAGMENT, arg);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
addItem(msg: AddItemResponse) {
|
|
addItem(msg: AddItemResponse) {
|
|
|
if (msg.errorcode != 0) {
|
|
if (msg.errorcode != 0) {
|
|
@@ -849,7 +862,7 @@ export default class GameData {
|
|
|
prop.add = add ? 1 : 0;
|
|
prop.add = add ? 1 : 0;
|
|
|
prop.propType = type;
|
|
prop.propType = type;
|
|
|
prop.propValue = value;
|
|
prop.propValue = value;
|
|
|
- this.updateProps([prop],callback);
|
|
|
|
|
|
|
+ this.updateProps([prop], callback);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|