/// <summary> /// 选择武器变化 /// </summary> /// <param name="b"></param> /// <param name="item"></param> public void OnWeaponSelected(bool b, WeaponShopItem item) { if (!b || item == null) { this.selectWeaponId = -1; } else { selectWeaponItem = item; if (weaponDisplay != null) { WeaponItem wi = WeaponManager.Instance.GetWeaponItemById(item.weaponId); if (wi == null) { selectWeaponId = -1; } else { selectWeaponId = wi.Id; CommonUtils.SetChildText(weaponDisplay, "WeaponName", wi.Name); CommonUtils.SetChildRawImage(weaponDisplay, "WeaponIcon", item.weaponIcon); CommonUtils.SetChildText(weaponInfo, "WeaponName", wi.Name); var weaponUnlockInfo = Player.CurrentPlayer.GetWeaponInfoById(wi.Id); if (weaponUnlockInfo != null && weaponUnlockInfo.IsUnlocked) { CommonUtils.SetChildActive(weaponDisplay, "Locked", false); DisplayWeaponLevelInfo(wi.GetLevelProperty(weaponUnlockInfo.Level), true); } else { CommonUtils.SetChildActive(weaponDisplay, "Locked", true); CommonUtils.SetChildText(weaponDisplay, "Locked/Price", wi.Prices.ToString()); DisplayWeaponLevelInfo(wi.GetCurrentProperty(), false); } //显示按钮 if (Player.CurrentPlayer.EquipedWeaponId == wi.Id) { //CommonUtils.SetChildActive(buttons, "BtnEquiped",true); SetButtonActive("BtnEquiped"); } else { if (weaponUnlockInfo != null && weaponUnlockInfo.IsUnlocked) { SetButtonActive("BtnEquip"); } else { SetButtonActive("BtnBuy"); } } } } } }