wujia 6 månader sedan
förälder
incheckning
8c63c1cead

+ 1 - 0
assets/script/game/common/InterfaceAddEnum.ts

@@ -81,4 +81,5 @@ export const AttrEnum = {
     dedamage: { type: AttrAddTypeEnum.percent, name: "伤害减免", desc: "伤害减免", url: "dedamage_ico" },
     suck: { type: AttrAddTypeEnum.percent, name: "吸血", desc: "吸血", url: "suck_ico" },
     thorns: { type: AttrAddTypeEnum.percent, name: "反伤", desc: "反伤", url: "thorns_ico" },
+    block: { type: AttrAddTypeEnum.percent, name: "反伤", desc: "反伤", url: "thorns_ico" },
 }

+ 32 - 32
assets/script/game/config/EquipConf.ts

@@ -63,7 +63,7 @@ export namespace EquipConf {
                 "Slot": 1,
                 "Race": 1,
                 "Stat1": "attack:31",
-                "Stat2": "attack_p:0.2",
+                "Stat2": 0,
                 "EatExp": 48,
                 "Score": 320,
                 "Url": "equip1_15",
@@ -77,7 +77,7 @@ export namespace EquipConf {
                 "Slot": 1,
                 "Race": 1,
                 "Stat1": "attack:40",
-                "Stat2": "attack_p:0.2",
+                "Stat2": 0,
                 "EatExp": 58,
                 "Score": 400,
                 "Url": "equip1_15",
@@ -147,7 +147,7 @@ export namespace EquipConf {
                 "Slot": 2,
                 "Race": 1,
                 "Stat1": "attack:47",
-                "Stat2": "block:0.02",
+                "Stat2": 0,
                 "EatExp": 48,
                 "Score": 320,
                 "Url": "equip1_25",
@@ -161,7 +161,7 @@ export namespace EquipConf {
                 "Slot": 2,
                 "Race": 1,
                 "Stat1": "attack:47",
-                "Stat2": "block:0.02",
+                "Stat2": 0,
                 "EatExp": 48,
                 "Score": 320,
                 "Url": "equip1_25",
@@ -231,7 +231,7 @@ export namespace EquipConf {
                 "Slot": 3,
                 "Race": 1,
                 "Stat1": "attack:63",
-                "Stat2": "hp_p:0.2",
+                "Stat2": 0,
                 "EatExp": 48,
                 "Score": 320,
                 "Url": "equip1_35",
@@ -245,7 +245,7 @@ export namespace EquipConf {
                 "Slot": 3,
                 "Race": 1,
                 "Stat1": "attack:63",
-                "Stat2": "hp_p:0.2",
+                "Stat2": 0,
                 "EatExp": 48,
                 "Score": 320,
                 "Url": "equip1_35",
@@ -315,7 +315,7 @@ export namespace EquipConf {
                 "Slot": 4,
                 "Race": 1,
                 "Stat1": "attack:94",
-                "Stat2": "dedamage:0.02",
+                "Stat2": 0,
                 "EatExp": 48,
                 "Score": 320,
                 "Url": "equip1_45",
@@ -329,7 +329,7 @@ export namespace EquipConf {
                 "Slot": 4,
                 "Race": 1,
                 "Stat1": "attack:94",
-                "Stat2": "dedamage:0.02",
+                "Stat2": 0,
                 "EatExp": 48,
                 "Score": 320,
                 "Url": "equip1_45",
@@ -399,7 +399,7 @@ export namespace EquipConf {
                 "Slot": 1,
                 "Race": 2,
                 "Stat1": "attack:36",
-                "Stat2": "attack_p:0.2",
+                "Stat2": 0,
                 "EatExp": 48,
                 "Score": 320,
                 "Url": "equip2_15",
@@ -413,7 +413,7 @@ export namespace EquipConf {
                 "Slot": 1,
                 "Race": 2,
                 "Stat1": "attack:36",
-                "Stat2": "attack_p:0.2",
+                "Stat2": 0,
                 "EatExp": 48,
                 "Score": 320,
                 "Url": "equip2_15",
@@ -483,7 +483,7 @@ export namespace EquipConf {
                 "Slot": 2,
                 "Race": 2,
                 "Stat1": "attack:52",
-                "Stat2": "crite:0.02",
+                "Stat2": 0,
                 "EatExp": 48,
                 "Score": 320,
                 "Url": "equip2_25",
@@ -497,7 +497,7 @@ export namespace EquipConf {
                 "Slot": 2,
                 "Race": 2,
                 "Stat1": "attack:52",
-                "Stat2": "crite:0.02",
+                "Stat2": 0,
                 "EatExp": 48,
                 "Score": 320,
                 "Url": "equip2_25",
@@ -567,7 +567,7 @@ export namespace EquipConf {
                 "Slot": 3,
                 "Race": 2,
                 "Stat1": "attack:68",
-                "Stat2": "hp_p:0.2",
+                "Stat2": 0,
                 "EatExp": 48,
                 "Score": 320,
                 "Url": "equip2_35",
@@ -581,7 +581,7 @@ export namespace EquipConf {
                 "Slot": 3,
                 "Race": 2,
                 "Stat1": "attack:68",
-                "Stat2": "hp_p:0.2",
+                "Stat2": 0,
                 "EatExp": 48,
                 "Score": 320,
                 "Url": "equip2_35",
@@ -651,7 +651,7 @@ export namespace EquipConf {
                 "Slot": 4,
                 "Race": 2,
                 "Stat1": "attack:99",
-                "Stat2": "adddamage:0.02",
+                "Stat2": 0,
                 "EatExp": 48,
                 "Score": 320,
                 "Url": "equip2_45",
@@ -665,7 +665,7 @@ export namespace EquipConf {
                 "Slot": 4,
                 "Race": 2,
                 "Stat1": "attack:99",
-                "Stat2": "adddamage:0.02",
+                "Stat2": 0,
                 "EatExp": 48,
                 "Score": 320,
                 "Url": "equip2_45",
@@ -735,7 +735,7 @@ export namespace EquipConf {
                 "Slot": 1,
                 "Race": 3,
                 "Stat1": "attack:41",
-                "Stat2": "attack_p:0.2",
+                "Stat2": 0,
                 "EatExp": 48,
                 "Score": 320,
                 "Url": "equip3_15",
@@ -749,7 +749,7 @@ export namespace EquipConf {
                 "Slot": 1,
                 "Race": 3,
                 "Stat1": "attack:41",
-                "Stat2": "attack_p:0.2",
+                "Stat2": 0,
                 "EatExp": 48,
                 "Score": 320,
                 "Url": "equip3_15",
@@ -819,7 +819,7 @@ export namespace EquipConf {
                 "Slot": 2,
                 "Race": 3,
                 "Stat1": "attack:57",
-                "Stat2": "speed:50",
+                "Stat2": 0,
                 "EatExp": 48,
                 "Score": 320,
                 "Url": "equip3_25",
@@ -833,7 +833,7 @@ export namespace EquipConf {
                 "Slot": 2,
                 "Race": 3,
                 "Stat1": "attack:57",
-                "Stat2": "speed:50",
+                "Stat2": 0,
                 "EatExp": 48,
                 "Score": 320,
                 "Url": "equip3_25",
@@ -903,7 +903,7 @@ export namespace EquipConf {
                 "Slot": 3,
                 "Race": 3,
                 "Stat1": "attack:73",
-                "Stat2": "hp_p:0.2",
+                "Stat2": 0,
                 "EatExp": 48,
                 "Score": 320,
                 "Url": "equip3_35",
@@ -917,7 +917,7 @@ export namespace EquipConf {
                 "Slot": 3,
                 "Race": 3,
                 "Stat1": "attack:73",
-                "Stat2": "hp_p:0.2",
+                "Stat2": 0,
                 "EatExp": 48,
                 "Score": 320,
                 "Url": "equip3_35",
@@ -987,7 +987,7 @@ export namespace EquipConf {
                 "Slot": 4,
                 "Race": 3,
                 "Stat1": "attack:104",
-                "Stat2": "dedamage:0.02",
+                "Stat2": 0,
                 "EatExp": 48,
                 "Score": 320,
                 "Url": "equip3_45",
@@ -1001,7 +1001,7 @@ export namespace EquipConf {
                 "Slot": 4,
                 "Race": 3,
                 "Stat1": "attack:104",
-                "Stat2": "dedamage:0.02",
+                "Stat2": 0,
                 "EatExp": 48,
                 "Score": 320,
                 "Url": "equip3_45",
@@ -1071,7 +1071,7 @@ export namespace EquipConf {
                 "Slot": 1,
                 "Race": 4,
                 "Stat1": "attack:41",
-                "Stat2": "attack_p:0.2",
+                "Stat2": 0,
                 "EatExp": 48,
                 "Score": 320,
                 "Url": "equip3_15",
@@ -1085,7 +1085,7 @@ export namespace EquipConf {
                 "Slot": 1,
                 "Race": 4,
                 "Stat1": "attack:41",
-                "Stat2": "attack_p:0.2",
+                "Stat2": 0,
                 "EatExp": 48,
                 "Score": 320,
                 "Url": "equip3_15",
@@ -1155,7 +1155,7 @@ export namespace EquipConf {
                 "Slot": 2,
                 "Race": 4,
                 "Stat1": "attack:57",
-                "Stat2": "speed:50",
+                "Stat2": 0,
                 "EatExp": 48,
                 "Score": 320,
                 "Url": "equip3_25",
@@ -1169,7 +1169,7 @@ export namespace EquipConf {
                 "Slot": 2,
                 "Race": 4,
                 "Stat1": "attack:57",
-                "Stat2": "speed:50",
+                "Stat2": 0,
                 "EatExp": 48,
                 "Score": 320,
                 "Url": "equip3_25",
@@ -1239,7 +1239,7 @@ export namespace EquipConf {
                 "Slot": 3,
                 "Race": 4,
                 "Stat1": "attack:73",
-                "Stat2": "hp_p:0.2",
+                "Stat2": 0,
                 "EatExp": 48,
                 "Score": 320,
                 "Url": "equip3_35",
@@ -1253,7 +1253,7 @@ export namespace EquipConf {
                 "Slot": 3,
                 "Race": 4,
                 "Stat1": "attack:73",
-                "Stat2": "hp_p:0.2",
+                "Stat2": 0,
                 "EatExp": 48,
                 "Score": 320,
                 "Url": "equip3_35",
@@ -1323,7 +1323,7 @@ export namespace EquipConf {
                 "Slot": 4,
                 "Race": 4,
                 "Stat1": "attack:104",
-                "Stat2": "dedamage:0.02",
+                "Stat2": 0,
                 "EatExp": 48,
                 "Score": 320,
                 "Url": "equip3_45",
@@ -1337,7 +1337,7 @@ export namespace EquipConf {
                 "Slot": 4,
                 "Race": 4,
                 "Stat1": "attack:104",
-                "Stat2": "dedamage:0.02",
+                "Stat2": 0,
                 "EatExp": 48,
                 "Score": 320,
                 "Url": "equip3_45",

+ 32 - 2
assets/script/game/data/EquipData.ts

@@ -62,13 +62,43 @@ class Data {
                 }
             }
         }
-
-        console.log('=========_bagData========',this._bagData);
     }
 
     getData() {
         return this._bagData;
     }
+
+    addDataByKey(key,data) {
+        this._bagData[key] = data;
+    }
+    removeDataByKey(key) {
+        if (this._bagData.hasOwnProperty(key)) {
+            delete this._bagData[key];
+        }
+    }
+
+    parseDataByServer(data) {
+        for (const key in data) {
+            if (Object.prototype.hasOwnProperty.call(data, key)) {
+                const element = data[key];
+                if(this._bagData[key]){
+                    if(element > 0){
+                        let equip = EquipManager.getEquipById(key, element, false);
+                        if (equip) {
+                            this._bagData[key] = equip;
+                        }
+                    }else{
+                        delete this._bagData[key];
+                    }
+                }else{
+                    let equip = EquipManager.getEquipById(key, element, false);
+                    if (equip) {
+                        this._bagData[key] = equip;
+                    }
+                }
+            }
+        }
+    }
 }
 
 export let EquipData = new Data;

+ 3 - 0
assets/script/game/data/GameEvent.ts

@@ -23,6 +23,9 @@ let event = {
     EquipChange: "EquipChange",											//装备变化
 	// boss数据刷新
 	BossUpdate: "BossUpdate",	
+
+	EquipWearChange: "EquipWearChange",									//穿戴装备变化
+
 }
 
 export let GameEvent = event;

+ 62 - 2
assets/script/game/manager/EquipManager.ts

@@ -1,8 +1,10 @@
+import { Framework } from "../../framework/Framework";
 import { ItemEnum } from "../common/InterfaceAddEnum";
 import { LoginMgr } from "../common/LoginManager";
 import { EquipConf } from "../config/EquipConf";
 import { EquipstrengthenConf } from "../config/EquipstrengthenConf";
 import { Equip, EquipData } from "../data/EquipData";
+import { GameEvent } from "../data/GameEvent";
 
 export class EquipManager {
     /**
@@ -135,11 +137,69 @@ export class EquipManager {
         return equips;
     }
 
+    static updateEquips(race, slot) {
+
+    }
+
     //消息-穿戴装备
-    static sendWearMsg(args: { eid: string, slot: number , race: number}, callback) {
+    static sendWearMsg(args: { eid: string, slot: number, race: number }, callback) {
         LoginMgr.sendPost('equip', 'wear', (data) => {
             console.log(data);
-            // MailData.setMailReadById(args.id)
+            let wearData = this.getEquipWearRaceGroup()[args.race][args.slot];
+            if (wearData && wearData.id) {
+                EquipData.removeDataByKey(wearData.id + '_' + args.slot);
+            }
+            if (data.race_equip) {
+                for (const slot in data.race_equip) {
+                    if (Object.prototype.hasOwnProperty.call(data.race_equip, slot)) {
+                        if (Number(slot) == args.slot) {
+                            const eid = data.race_equip[slot];
+                            if (eid != 0) {
+                                let equip = this.getEquipById(eid, 1, true);
+                                if (equip) {
+                                    EquipData.addDataByKey(eid + '_' + args.race, equip);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+            if (data.equip) {
+                EquipData.parseDataByServer(data.equip);
+            }
+            Framework.event.fireEvent(GameEvent.EquipWearChange, args.race);
+            callback();
+        }, args)
+    }
+
+    //消息-升级装备
+    static sendUpdateMsg(args: { eat_eids: {}, slot: number, race: number }, callback) {
+        LoginMgr.sendPost('equip', 'strengthen', (data) => {
+            console.log(data);
+            let wearData = this.getEquipWearRaceGroup()[args.race][args.slot];
+            if (wearData && wearData.id) {
+                EquipData.removeDataByKey(wearData.id + '_' + args.slot);
+            }
+            if (data.race_equip) {
+                for (const slot in data.race_equip) {
+                    if (Object.prototype.hasOwnProperty.call(data.race_equip, slot)) {
+                        if (Number(slot) == args.slot) {
+                            const eid = data.race_equip[slot];
+                            if (eid != 0) {
+                                let equip = this.getEquipById(eid, 1, true);
+                                if (equip) {
+                                    EquipData.addDataByKey(eid + '_' + args.race, equip);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+            if (data.equip) {
+                EquipData.parseDataByServer(data.equip);
+            }
+            Framework.event.fireEvent(GameEvent.EquipWearChange, args.race);
+            callback();
         }, args)
     }
 }

+ 67 - 4
assets/script/game/ui/common/CommonItem.ts

@@ -1,6 +1,8 @@
 import { _decorator, Label, Node, Sprite, SpriteFrame } from 'cc';
 import { ResKeeper } from '../../../framework/res/ResKeeper';
 import { ItemEnum } from '../../common/InterfaceAddEnum';
+import { Framework } from '../../../framework/Framework';
+import { ViewID } from '../../../framework/config/LayerConf';
 const { ccclass, property } = _decorator;
 
 @ccclass('CommonItem')
@@ -14,17 +16,38 @@ export class CommonItem extends ResKeeper {
 	@property({ type: Sprite, tooltip: "图标" })
 	icoImg: Sprite = null;
 
+	@property({ type: Node, tooltip: "碎片标记" })
+	pieceIco: Node = null;
+
+	@property({ type: Node, tooltip: "阵营标记" })
+	raceIco: Node = null;
+
+	@property({ type: Node, tooltip: "星级节点" })
+	starNode: Node = null;
+
+	@property({ type: [Node], tooltip: "星星" })
+	stars: Node[] = [];
+
+	@property({ type: [SpriteFrame], tooltip: "星星" })
+	gradeBgs: SpriteFrame[] = [];
+
 	@property({ type: Node, tooltip: "选中效果" })
 	selectBg: Node = null;
 
 	@property({ type: [SpriteFrame], tooltip: "背景图" })
 	bgFrame: SpriteFrame[] = [];
 
+	private isSelect = false;
+	private isNumShow = true;
+	private isClickEnable = true;
 	private data = null;
 	private clickFunc = null;
 
 	protected onLoad() {
-
+		this.selectBg.active = false;
+		this.pieceIco.active = false;
+		this.raceIco.active = false;
+		this.starNode.active = false;
 	}
 
 	protected onDestroy() {
@@ -50,13 +73,53 @@ export class CommonItem extends ResKeeper {
 			this.clickFunc = data.clickFunc;
 		}
 		if (this.data.type == ItemEnum.material) {
-		
+			this.setMaterial();
 		} else if (this.data.type == ItemEnum.equip) {
-		
+			this.setEquip();
 		}
+		this.numTx.node.active = this.isNumShow;
 	}
 
-	onClick() {
+	setMaterial() {
+		this.farmeBg.spriteFrame = this.bgFrame[this.data.conf.Quality];
+		this.load('common', `texture/icon/item/item_1/spriteFrame`, SpriteFrame, (res: SpriteFrame) => {
+			this.icoImg.spriteFrame = res;
+		})
+		this.numTx.string = this.data.count;
+	}
+
+	setEquip() {
+		this.farmeBg.spriteFrame = this.bgFrame[this.data.conf.Quality];
+		this.load('common', `texture/icon/equips/equip1_${this.data.conf.Slot}1/spriteFrame`, SpriteFrame, (res: SpriteFrame) => {
+			this.icoImg.spriteFrame = res;
+		})
+		this.numTx.string = this.data.count;
+	}
 
+	setSelectEnable(state: boolean) {
+		this.selectBg.active = state;
+	}
+
+	setClickEnable(state: boolean) {
+		this.isClickEnable = state;
+	}
+
+	setNumShow(state: boolean) {
+		this.isNumShow = state;
+	}
+
+	setClick(callFunc) {
+		this.clickFunc = callFunc;
+	}
+
+	onClick() {
+		this.isSelect = !this.isSelect;
+		if (this.clickFunc) {
+			this.clickFunc(this.data, this.isSelect);
+		} else {
+			if (this.isClickEnable) {
+				Framework.layer.open(ViewID.ItemMsg, null, this.data);
+			}
+		}
 	}
 }

+ 2 - 2
assets/script/game/ui/common/CommonTips.ts

@@ -48,9 +48,9 @@ export class CommonTips extends BaseView {
 	onOpen(args) {
 		this._callback = args.callback;
 		this.contentTx.string = args.content;
-		if (args.openType==TipsOpereteEnum.yes) {
+		if (args.openType == TipsOpereteEnum.yes) {
 			this.closeBtn.active = true;
-		} else if (args.openType==TipsOpereteEnum.yes_no) {
+		} else if (args.openType == TipsOpereteEnum.yes_no) {
 			this.cancelBtn.active = true;
 			this.confirmBtn.active = true;
 		}

+ 4 - 0
assets/script/game/ui/common/ItemMsg.ts

@@ -2,6 +2,7 @@ import { _decorator, Label, Node, tween, UIOpacity } from 'cc';
 import { BaseView } from '../../../framework/layer/BaseView';
 import { StringUtil } from '../../../framework/util/StringUtil';
 import { ItemEnum } from '../../common/InterfaceAddEnum';
+import { Framework } from '../../../framework/Framework';
 const { ccclass, property } = _decorator;
 
 @ccclass('ItemMsg')
@@ -75,5 +76,8 @@ export class ItemMsg extends BaseView {
 	private onTouchButton(event: Event) {
 		//Framework.audio.playEffect(AudioID.Click);
 		let target: any = event.target;
+		if (target.name == 'mask') {
+			Framework.layer.close(this);
+		}
 	}
 }

+ 7 - 0
assets/script/game/ui/hero/EquipChoose.ts

@@ -8,6 +8,7 @@ import { Framework } from '../../../framework/Framework';
 import { Equip } from '../../data/EquipData';
 import { CommonItem } from '../common/CommonItem';
 import { AttrAddTypeEnum, AttrEnum } from '../../common/InterfaceAddEnum';
+import { GameEvent } from '../../data/GameEvent';
 const { ccclass, property } = _decorator;
 
 @ccclass('EquipChoose')
@@ -59,6 +60,10 @@ export class EquipChoose extends BaseView {
 		this.equipListNoneTx.string = StringUtil.getLanguageData('暂无可用装备');
 		this.closeTips.node.getComponent(UIOpacity).opacity = 0;
 		this.wearNode.active = false;
+
+		Framework.event.addEvent(GameEvent.EquipWearChange, () => {
+			Framework.layer.close(this);
+		}, this);
 	}
 
 	protected onDestroy() {
@@ -118,6 +123,8 @@ export class EquipChoose extends BaseView {
 		this.load('common', `prefab/CommonItem`, Prefab, (pre: Prefab) => {
 			let item = instantiate(pre);
 			this.itemNode.addChild(item);
+			item.getComponent(CommonItem).setClickEnable(false);
+			item.getComponent(CommonItem).setNumShow(false);
 			item.getComponent(CommonItem).refreshItem(this._curEquip);
 		})
 

+ 2 - 0
assets/script/game/ui/hero/EquipChooseItem.ts

@@ -63,6 +63,8 @@ export class EquipChooseItem extends ResKeeper {
 		this.load('common', `prefab/CommonItem`, Prefab, (pre: Prefab) => {
 			let item = instantiate(pre);
 			this.itemNode.addChild(item);
+			item.getComponent(CommonItem).setClickEnable(false);
+			item.getComponent(CommonItem).setNumShow(false);
 			item.getComponent(CommonItem).refreshItem(data);
 		})
 		

+ 7 - 0
assets/script/game/ui/hero/EquipOpreate.ts

@@ -7,6 +7,7 @@ import { CommonItem } from '../common/CommonItem';
 import { AttrAddTypeEnum, AttrEnum } from '../../common/InterfaceAddEnum';
 import { Framework } from '../../../framework/Framework';
 import { ViewID } from '../../../framework/config/LayerConf';
+import { GameEvent } from '../../data/GameEvent';
 const { ccclass, property } = _decorator;
 
 @ccclass('EquipOpreate')
@@ -64,6 +65,10 @@ export class EquipOpreate extends BaseView {
 		this.updateBtnTx.string = StringUtil.getLanguageData('升级');
 		this.strongBtnTx.string = StringUtil.getLanguageData('突破');
 		this.closeTips.node.getComponent(UIOpacity).opacity = 0;
+
+		Framework.event.addEvent(GameEvent.EquipWearChange, () => {
+			Framework.layer.close(this);
+		}, this);
 	}
 
 	protected onDestroy() {
@@ -127,6 +132,8 @@ export class EquipOpreate extends BaseView {
 		this.load('common', `prefab/CommonItem`, Prefab, (pre: Prefab) => {
 			let item = instantiate(pre);
 			this.itemNode.addChild(item);
+			item.getComponent(CommonItem).setClickEnable(false);
+			item.getComponent(CommonItem).setNumShow(false);
 			item.getComponent(CommonItem).refreshItem(this._curEquip);
 		})
 

+ 86 - 6
assets/script/game/ui/hero/EquipUpdate.ts

@@ -71,10 +71,14 @@ export class EquipUpdate extends BaseView {
 
 	private _equipsData = [];
 
+	private _selectEquip = {};
+
 	protected onLoad() {
 		super.onLoad();
 		this.closeTips.string = StringUtil.getLanguageData('点击空白关闭');
 		this.titieTx.string = StringUtil.getLanguageData('装备升级');
+		this.updateBtnTx.string = StringUtil.getLanguageData('升级');
+		this.autoBtnTx.string = StringUtil.getLanguageData('一键选择');
 		this.closeTips.node.getComponent(UIOpacity).opacity = 0;
 	}
 
@@ -98,6 +102,8 @@ export class EquipUpdate extends BaseView {
 		this.load('common', `prefab/CommonItem`, Prefab, (pre: Prefab) => {
 			let item = instantiate(pre);
 			this.equipNode.addChild(item);
+			item.getComponent(CommonItem).setClickEnable(false);
+			item.getComponent(CommonItem).setNumShow(false);
 			item.getComponent(CommonItem).refreshItem(this._curEquip);
 		})
 
@@ -109,7 +115,6 @@ export class EquipUpdate extends BaseView {
 		this.itemSv.numItems = this._equipsData.length;
 
 		this.initUI();
-		// this.updateByExp();
 	}
 
 	//UI关闭时会调用,该函数在onDestroy前调用
@@ -133,11 +138,46 @@ export class EquipUpdate extends BaseView {
 		let target: any = event.target;
 		if (target.name == 'mask') {
 			Framework.layer.close(this);
+		} else if (target.name == 'update_btn') {
+			if (Object.keys(this._selectEquip).length <= 0) {
+				Framework.tips.setTips(StringUtil.getLanguageData('请选择吞噬的装备'));
+				return;
+			}
+			let args = {
+				race: this._curRace,
+				slot: this._curSlot,
+				eat_eids: {}
+			}
+			for (const key in this._selectEquip) {
+				if (Object.prototype.hasOwnProperty.call(this._selectEquip, key)) {
+					const element = this._selectEquip[key];
+					args.eat_eids[key] = element.count;
+				}
+			}
+			EquipManager.sendUpdateMsg(args, () => {
+				Framework.tips.setTips(StringUtil.getLanguageData('升级成功!'));
+				Framework.layer.close(this);
+			})
+		} else if (target.name == 'auto_btn') {
+
 		}
 	}
 
 	onEventList(item, idx) {
-		item.getComponent(CommonItem).refreshItem();
+		item.getComponent(CommonItem).refreshItem(this._equipsData[idx]);
+		item.getComponent(CommonItem).setClick((data, isSelect) => {
+			item.getComponent(CommonItem).setSelectEnable(isSelect);
+			if (isSelect) {
+				this._selectEquip[data.id] = data;
+				this._otherExp = this._otherExp + ((data.conf.EatExp + data.exp) * data.count);
+			} else {
+				if (this._selectEquip.hasOwnProperty(data.id)) {
+					delete this._selectEquip[data.id];
+					this._otherExp = this._otherExp - ((data.conf.EatExp + data.exp) * data.count);
+				}
+			}
+			this.updateByExp();
+		});
 	}
 
 	initUI() {
@@ -150,10 +190,10 @@ export class EquipUpdate extends BaseView {
 		let value = null;
 		if (attrConf.type == AttrAddTypeEnum.reality) {
 			nowAdd = attr[1] * (1 + curLvConf.AttackMod);
-			value = " +" + attr[1] * (1 + curLvConf.AttackMod);
+			value = " +" + parseFloat((attr[1] * (1 + curLvConf.AttackMod)).toFixed(2));
 		} else {
 			nowAdd = 100 * Number(attr[1]) * (1 + curLvConf.AttackMod);
-			value = " +" + (100 * Number(attr[1]) * (1 + curLvConf.AttackMod)) + "%";
+			value = " +" + parseFloat((100 * Number(attr[1]) * (1 + curLvConf.AttackMod)).toFixed(2)) + "%";
 		}
 		attrStr = attrStr + value;
 		this.equipNowAttr.string = attrStr;
@@ -166,10 +206,10 @@ export class EquipUpdate extends BaseView {
 		let valueNext = null;
 		if (attrConf.type == AttrAddTypeEnum.reality) {
 			nextAdd = attr[1] * (1 + nextLvConf.AttackMod);
-			valueNext = " +" + attr[1] * (1 + nextLvConf.AttackMod);
+			valueNext = " +" + parseFloat((attr[1] * (1 + nextLvConf.AttackMod)).toFixed(2));
 		} else {
 			nextAdd = 100 * Number(attr[1]) * (1 + nextLvConf.AttackMod);
-			valueNext = " +" + (100 * Number(attr[1]) * (1 + nextLvConf.AttackMod)) + "%";
+			valueNext = " +" + parseFloat((100 * Number(attr[1]) * (1 + nextLvConf.AttackMod)).toFixed(2)) + "%";
 		}
 		attrNextStr = attrNextStr + valueNext;
 		this.equipNextAttr.string = attrNextStr;
@@ -180,4 +220,44 @@ export class EquipUpdate extends BaseView {
 		this.expBar.progress = this._curExp / curLvConf.NeedExp;
 		this.expBarTx.string = this._curExp + '/' + curLvConf.NeedExp;
 	}
+
+	updateByExp() {
+		if (Object.keys(this._selectEquip).length <= 0) {
+			this.initUI()
+		} else {
+			let curLvConf = EquipManager.getEquipLevelByExp(this._curExp);
+			let attr = this._curEquip.conf['Stat1'].split(':');
+			let attrConf = AttrEnum[attr[0]]
+			let nowAdd = null;
+			if (attrConf.type == AttrAddTypeEnum.reality) {
+				nowAdd = attr[1] * (1 + curLvConf.AttackMod);
+			} else {
+				nowAdd = 100 * Number(attr[1]) * (1 + curLvConf.AttackMod);
+			}
+			let nextLvConf = EquipManager.getEquipLevelByExp(this._curExp + this._otherExp);
+			if (nextLvConf.Id <= curLvConf.Id) {
+				nextLvConf = EquipManager.getEquipNextLevel(this._curExp + this._otherExp);
+			}
+			this.equipNextLevel.string = 'Lv.' + nextLvConf.Id;
+			let attrNextConf = AttrEnum[attr[0]]
+			let attrNextStr = StringUtil.getLanguageData(attrNextConf.name);
+			let nextAdd = null;
+			let valueNext = null;
+			if (attrConf.type == AttrAddTypeEnum.reality) {
+				nextAdd = attr[1] * (1 + nextLvConf.AttackMod);
+				valueNext = " +" + parseFloat((attr[1] * (1 + nextLvConf.AttackMod)).toFixed(2));
+			} else {
+				nextAdd = 100 * Number(attr[1]) * (1 + nextLvConf.AttackMod);
+				valueNext = " +" + parseFloat((100 * Number(attr[1]) * (1 + nextLvConf.AttackMod)).toFixed(2)) + "%";
+			}
+			attrNextStr = attrNextStr + valueNext;
+			this.equipNextAttr.string = attrNextStr;
+
+			this.equipNextAttrAdd.string = attrConf.type == AttrAddTypeEnum.reality ? (" (+" + parseFloat((nextAdd - nowAdd).toFixed(2)) + ")") :
+				(" (+" + parseFloat((nextAdd - nowAdd).toFixed(2)) + "%)");
+
+			this.expBar.progress = (this._curExp + this._otherExp) / curLvConf.NeedExp;
+			this.expBarTx.string = (this._curExp + this._otherExp) + '/' + curLvConf.NeedExp;
+		}
+	}
 }

+ 0 - 3
assets/script/game/ui/hero/HeroAttr.ts

@@ -65,7 +65,6 @@ export class HeroAttr extends BaseView {
 
 	//UI开打时会调用,如果有初始化代码应该放到此函数
 	onOpen(data) {
-		console.log('=============== onOpen', data)
 		this.data = data.heroDate;
 		if (data.tag) {
 			this.selectTag = data.tag;
@@ -108,10 +107,8 @@ export class HeroAttr extends BaseView {
 			RoleManager.sendRoleAdvance({ hid: this.data['id'] }, () => {
 				Framework.tips.setTips(StringUtil.getLanguageData('升级成功!'));
 				let rData = RoleData.getRoleDataByID(this.data['id']);
-				console.log('=============== 11', this.data)
 				this.data = {}
 				this.data = rData;
-				console.log('=============== 22', this.data)
 				this.updateAttr();
 			});
 		}

+ 13 - 0
assets/script/game/ui/hero/HeroList.ts

@@ -6,6 +6,7 @@ import { HeroListItem, heroListItemData } from './HeroListItem';
 import { RoleManager } from '../../manager/RoleManager';
 import { EquipManager } from '../../manager/EquipManager';
 import { Framework } from '../../../framework/Framework';
+import { GameEvent } from '../../data/GameEvent';
 const { ccclass, property } = _decorator;
 
 @ccclass('HeroList')
@@ -28,6 +29,17 @@ export class HeroList extends BaseView {
 			this._herosData.push(t);
 		}
 		this.sv.numItems = this._herosData.length;
+
+		Framework.event.addEvent(GameEvent.EquipWearChange, (race) => {
+			let herodata = RoleManager.getRolesRaceGroup();
+			let equipData = EquipManager.getEquipWearRaceGroup();
+			let t: heroListItemData = { race: race, heros: herodata[race], equips: equipData[race] }
+			// this._herosData[race - 1] = t;
+			let item = this.sv.content.getChildByName('race_' + race);
+			if(item){
+				item.getComponent(HeroListItem).refreshItem(t);
+			}
+		}, this);
 	}
 
 	protected onDestroy() {
@@ -65,6 +77,7 @@ export class HeroList extends BaseView {
 	}
 
 	onEventList(item, idx) {
+		item.name = 'race_' + this._herosData[idx].race;
 		item.getComponent(HeroListItem).refreshItem(this._herosData[idx]);
 	}
 }

+ 10 - 0
assets/script/game/ui/hero/HeroListItem.ts

@@ -67,6 +67,7 @@ export class HeroListItem extends ResKeeper {
 	}
 
 	updateHero() {
+		this.herosNode.removeAllChildren();
 		for (const element of this.data['heros']) {
 			this.load('hero', `prefab/HeroListCard`, Prefab, (pre: Prefab) => {
 				let heroCard = instantiate(pre);
@@ -96,9 +97,18 @@ export class HeroListItem extends ResKeeper {
 				if (eData) {
 					noneNode.active = false;
 					equipNode.active = true;
+					this.load('common', `texture/background/frame_bg_${eData.conf.Quality}/spriteFrame`, SpriteFrame, (res: SpriteFrame) => {
+						bg.spriteFrame = res;
+					})
+					this.load('common', `texture/icon/equips/equip1_${eData.conf.Slot}1/spriteFrame`, SpriteFrame, (res: SpriteFrame) => {
+						ico.spriteFrame = res;
+					})
 				} else {
 					noneNode.active = true;
 					equipNode.active = false;
+					this.load('common', `texture/background/frame_bg_0/spriteFrame`, SpriteFrame, (res: SpriteFrame) => {
+						bg.spriteFrame = res;
+					})
 				}
 			}
 		}

+ 33 - 0
assets/sub_bundle/common/prefab/CommonItem.prefab

@@ -1942,6 +1942,39 @@
     "icoImg": {
       "__id__": 11
     },
+    "pieceIco": {
+      "__id__": 14
+    },
+    "raceIco": {
+      "__id__": 20
+    },
+    "starNode": {
+      "__id__": 26
+    },
+    "stars": [
+      {
+        "__id__": 27
+      },
+      {
+        "__id__": 33
+      },
+      {
+        "__id__": 39
+      },
+      {
+        "__id__": 45
+      },
+      {
+        "__id__": 51
+      }
+    ],
+    "gradeBgs": [
+      null,
+      null,
+      null,
+      null,
+      null
+    ],
     "selectBg": {
       "__id__": 68
     },