|
@@ -61,7 +61,6 @@ export class FreeUpgradeMediator extends GUIMediator {
|
|
|
|
|
|
private a:WeaponCell;
|
|
|
private b:WeaponCell;
|
|
|
- private weaponID:number;
|
|
|
private nextWeaponId:number;
|
|
|
OnShow(data?:any):void{
|
|
|
super.OnShow(data);
|
|
@@ -70,14 +69,16 @@ export class FreeUpgradeMediator extends GUIMediator {
|
|
|
let currentConfig:any=this.a.weaponConfig;
|
|
|
let level:number=currentConfig.level+1;
|
|
|
currentConfig=GameConfigManager.GetWeaponConfigByLevel(level);
|
|
|
- this.weaponID=currentConfig.id;
|
|
|
for (let index = 0; index < 2; index++) {
|
|
|
- if(GameConfigManager.WeaponIsMaxLevel(level)){
|
|
|
- level++;
|
|
|
+ const element:any=GameConfigManager.GetWeaponConfigByLevel(level);
|
|
|
+ if(element!=null){
|
|
|
+ if(GameConfigManager.WeaponIsMaxLevel(element.id)==false){
|
|
|
+ level++;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
let nextConfig:any=GameConfigManager.GetWeaponConfigByLevel(level);
|
|
|
- this.nextWeaponId=currentConfig.id;
|
|
|
+ this.nextWeaponId=nextConfig.id;
|
|
|
|
|
|
//当前
|
|
|
loader.loadRes(currentConfig.icon+"/spriteFrame",SpriteFrame,(err,res:SpriteFrame)=>{
|
|
@@ -163,12 +164,21 @@ export class FreeUpgradeMediator extends GUIMediator {
|
|
|
NoticeManager.ShowPrompt("武器格子不足!");
|
|
|
return false;
|
|
|
}
|
|
|
+ let select:boolean=false;
|
|
|
+ if(GameModel.single.currentWeaponCell==this.a||GameModel.single.currentWeaponCell==this.b){
|
|
|
+ select=true;
|
|
|
+ }
|
|
|
//删除A
|
|
|
GameModel.single.RemoveWeapon(this.a.cellId);
|
|
|
//删除B
|
|
|
GameModel.single.RemoveWeapon(this.b.cellId);
|
|
|
//添加新武器
|
|
|
GameModel.single.AddWeapon(cell.cellId,weaponId);
|
|
|
+ if(select){
|
|
|
+ GameModel.single.currentWeaponCell=GameModel.single.FindCell(cell.cellId);
|
|
|
+ GameModel.single.DispatchEvent(DataModelEventType.PROPERTY_CHANGED,GamePropertys.currentWeaponId);
|
|
|
+ GameModel.single.DispatchEvent(DataModelEventType.PROPERTY_CHANGED,GamePropertys.WeaponCell);
|
|
|
+ }
|
|
|
return true;
|
|
|
}
|
|
|
|