|
@@ -300,7 +300,7 @@ export class GameModel extends DataModel{
|
|
|
* @param type 0 金币购买 1钻石购买 2视频购买
|
|
|
* @param weaponId
|
|
|
*/
|
|
|
- public BuyWeapon(type:number,weaponId:number):void{
|
|
|
+ public BuyWeapon(type:number,weaponId:number):boolean{
|
|
|
let price:number;
|
|
|
let weaponConfig:any
|
|
|
|
|
@@ -308,14 +308,14 @@ export class GameModel extends DataModel{
|
|
|
let weaponCell:WeaponCell=this.FindWeaponEmptyCell();
|
|
|
if(weaponCell==null){
|
|
|
NoticeManager.ShowPrompt("没有空槽位了!");
|
|
|
- return;
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
if(type==0){
|
|
|
price=this.GetWeaponBuyPrice(weaponId);
|
|
|
if(this.gold<price){
|
|
|
NoticeManager.ShowPrompt("金币不足,不能购买武器!");
|
|
|
- return;
|
|
|
+ return false;
|
|
|
}
|
|
|
//扣钱
|
|
|
let currentGold:number=this.gold;
|
|
@@ -337,7 +337,7 @@ export class GameModel extends DataModel{
|
|
|
price=weaponConfig.consumeDiamond;
|
|
|
if(this.diamond<price){
|
|
|
NoticeManager.ShowPrompt("宝石不足,不能购买武器!");
|
|
|
- return;
|
|
|
+ return false;
|
|
|
}
|
|
|
//扣钱
|
|
|
let currentDiamond:number=this.gold;
|
|
@@ -349,6 +349,7 @@ export class GameModel extends DataModel{
|
|
|
}
|
|
|
//发货
|
|
|
this.AddWeapon(weaponCell.cellId,weaponId);
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -373,6 +374,7 @@ export class GameModel extends DataModel{
|
|
|
}
|
|
|
|
|
|
protected OnReadByLocal(data:any):void{
|
|
|
+ let currentTime:number=director.getCurrentTime();
|
|
|
//当前武器格
|
|
|
this.__currentWeaponCell=new WeaponCell();
|
|
|
for (const key in data.currentWeaponCell) {
|
|
@@ -381,6 +383,7 @@ export class GameModel extends DataModel{
|
|
|
this.__currentWeaponCell[key]=element;
|
|
|
}
|
|
|
}
|
|
|
+ this.__currentWeaponCell.lastOutputTime=currentTime;
|
|
|
//武器格子
|
|
|
let weaponCells:any[]=data.weaponCells;
|
|
|
this.__weaponCells=[];
|
|
@@ -394,6 +397,7 @@ export class GameModel extends DataModel{
|
|
|
weaponCell[key]=item;
|
|
|
}
|
|
|
}
|
|
|
+ weaponCell.lastOutputTime=currentTime;
|
|
|
this.__weaponCells.push(weaponCell);
|
|
|
});
|
|
|
}
|