using UnityEngine; using UnityEngine.UI; using System.Collections; using Games.Item; using GCGame.Table; using System.Collections.Generic; using GCGame; public class TargetPlayerEquipInfo : MonoBehaviour { #region //装备属性 public UICameraTexture _UICameraTexture; // 人物模型 public Text _NameText; // 昵称 public Text _AbilityText; // 技能修为 public Text _Level; // 等级 public Text _Guild; // 帮派 public UIImgText _CombotText; // 战斗力 public CommonItemEquipItem[] _EquipItems; // 身上装备列表 public GameObject baseAttrPanel; // 基础属性面板 public GameObject detailAttrPanel; // 详细属性面板 //人物属性 public Slider m_HpSlider; // 气血 public Text m_HpValue; public Slider m_MpSlider; // 魔法 public Text m_MpValue; public Slider m_ExpSlider; // 经验 public Text m_ExpValue; public UIContainerBase _SimpleAttrs; // 基础属性 public UIContainerBase _DetailMainAttrs; // 重要属性 public UIContainerBase _DetailBaseAttrs; // 基本属性 public UIContainerBase _DetailSpecilAttrs; // 特殊属性 public UIContainerBase _DetailEffectAttrs; // 效果属性 public UIContainerBase _DetailExAttrs; // 元素属性 #endregion public static TargetPlayerEquipInfo Instance; public TogglesControl toggleControl; void Awake() { Instance = this; } private void OnEnable() { toggleControl.OnTogglesSelect += ShowPage; } private void OnDisable() { toggleControl.OnTogglesSelect -= ShowPage; } private void OnDestroy() { Instance = null; } // 协议调用入口 public void SetShowPage(int page) { UpdateEquipInfo(); toggleControl.SetToggleOn(page); } // 控制显示页面 public void ShowPage(int page) { if (page == 0) { baseAttrPanel.SetActive(true); detailAttrPanel.SetActive(false); } else if(page == 1) { baseAttrPanel.SetActive(false); detailAttrPanel.SetActive(true); } } public void UpdateEquipInfo() { _NameText.text = GameManager.gameManager.OtherPlayerData.Name; if(string.IsNullOrEmpty(GameManager.gameManager.OtherPlayerData.GuildName)) { _Guild.text = StrDictionary.GetClientDictionaryString("#{8122}"); } else { _Guild.text = GameManager.gameManager.OtherPlayerData.GuildName; } _Level.text = StrDictionary.GetClientDictionaryString("#{8113}", GameManager.gameManager.OtherPlayerData.Level); _AbilityText.text = GameManager.gameManager.OtherPlayerData.AbilityLevel.ToString(); _CombotText.text = GameManager.gameManager.OtherPlayerData.CombatValue.ToString(); GameItemContainer EquipPack = GameManager.gameManager.OtherPlayerData.EquipPack; for (int index = 0; index < EquipPack.ContainerSize; ++index) { GameItem equip = EquipPack.GetItem(GetEquipSlotByIndex(index)); _EquipItems[index].SetStrength(GameManager.gameManager.OtherPlayerData.EquipSlotStrength[GetEquipSlotByIndex(index)].lv); _EquipItems[index].InitItem(equip); _EquipItems[index]._ClickEvent = OnEquipClick; } //显示模型 UpdateShowModel(); //刷新人物基础属性 ShowSimpleAttrInfo(); // 刷新任务详细属性 ShowDetailAttrInfo(); //刷新Slider InitRoleSliderValue(); } //装备提示 void OnEquipClick(object equipObj) { GameItem equipItem = equipObj as GameItem; EquipTooltipsLogic.ShowEquipTooltip(equipItem, ItemTooltipsLogic.ShowType.Info, transform.position); } // 显示模型 public void UpdateShowModel() { _UICameraTexture.InitModel(GameManager.gameManager.OtherPlayerData.Profession, GlobalData.GetCharModelId(GameManager.gameManager.OtherPlayerData.Profession, GameManager.gameManager.OtherPlayerData.ModuleVisualID), GameManager.gameManager.OtherPlayerData.CurWeaponDataID, GameManager.gameManager.OtherPlayerData.WingAuraId, GameManager.gameManager.OtherPlayerData.WeaponEffectId, GameManager.gameManager.OtherPlayerData.EffectAuraId); } private int GetEquipSlotByIndex(int index) { switch (index) { //case 0: return (int)EquipPackSlot.Slot_HEAD; //case 1: return (int)EquipPackSlot.Slot_NECK; //case 2: return (int)EquipPackSlot.Slot_ARMOR; //case 3: return (int)EquipPackSlot.Slot_LEG_GUARD; //case 4: return (int)EquipPackSlot.Slot_WEAPON; //case 5: return (int)EquipPackSlot.Slot_BELT; //case 6: return (int)EquipPackSlot.Slot_AMULET; //case 7: return (int)EquipPackSlot.Slot_RING; //case 8: return (int)EquipPackSlot.Slot_SHOES; //case 9: return (int)EquipPackSlot.Slot_CUFF; case 0: return (int)EquipPackSlot.Slot_NECK; //项链 case 1: return (int)EquipPackSlot.Slot_HEAD; //头部 case 2: return (int)EquipPackSlot.Slot_WEAPON; //武器 case 3: return (int)EquipPackSlot.Slot_ARMOR; //衣服 case 4: return (int)EquipPackSlot.Slot_RING; //戒指 case 5: return (int)EquipPackSlot.Slot_BELT; //腰带 case 6: return (int)EquipPackSlot.Slot_AMULET; //护腕 case 7: return (int)EquipPackSlot.Slot_LEG_GUARD; //手部 case 8: return (int)EquipPackSlot.Slot_CUFF; //镯子 case 9: return (int)EquipPackSlot.Slot_SHOES; //鞋子 default: break; } return -1; } private void ShowSimpleAttrInfo() { List attrList = new List(); attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.CONSTITU, GameManager.gameManager.OtherPlayerData.Constitu)); attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.MORFIB, GameManager.gameManager.OtherPlayerData.Morfib)); attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.STRENGTH, GameManager.gameManager.OtherPlayerData.Strength)); attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.INTELLENG, GameManager.gameManager.OtherPlayerData.Intellenge)); attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.AGILE, GameManager.gameManager.OtherPlayerData.Agile)); attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.MAXHP, GameManager.gameManager.OtherPlayerData.MaxHP)); attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.MAXMP, GameManager.gameManager.OtherPlayerData.MaxMp)); attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.PYSATTACK, GameManager.gameManager.OtherPlayerData.PAttck)); attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.MAGATTACK, GameManager.gameManager.OtherPlayerData.MAttack)); attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.HIT, GameManager.gameManager.OtherPlayerData.Hit)); attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.LEVEL, GameManager.gameManager.OtherPlayerData.Level)); //attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.CUREAMOUNT, GameManager.gameManager.OtherPlayerData.CureMount)); attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.PYSDEF, GameManager.gameManager.OtherPlayerData.PDefense)); attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.MAGDEF, GameManager.gameManager.OtherPlayerData.MDefense)); attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.DODGE, GameManager.gameManager.OtherPlayerData.Doge)); _SimpleAttrs.InitContentItem(attrList); } // 显示详细数据 public void ShowDetailAttrInfo() { List attrList = new List(); //// 详细数据 //attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.PROPUSER_EXP, GameManager.gameManager.OtherPlayerData.CurExp));//经验 //// 仅在到达最大等级前显示下一级经验 //Tab_LevelUp curTabLevelup = TableManager.GetLevelUpByID(GameManager.gameManager.OtherPlayerData.Level, 0); //if (curTabLevelup != null) //{ // var maxExp = long.Parse(curTabLevelup.ExpNeed); // attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.LEVEL_UP_EXP, maxExp)); //} //attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.ACTVAL, GameManager.gameManager.OtherPlayerData.ActVal));// 活力值 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.PKVAL, GameManager.gameManager.OtherPlayerData.PkVal));//pk值 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.LUCKYVAL, GameManager.gameManager.OtherPlayerData.LuckVal));//幸运值 _DetailMainAttrs.InitContentItem(attrList);//显示重要属性 attrList.Clear(); attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.MAXHP, GameManager.gameManager.OtherPlayerData.MaxHP));//血量 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.MAXMP, GameManager.gameManager.OtherPlayerData.MaxMp));//法力 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.PYSATTACK, GameManager.gameManager.OtherPlayerData.PAttck));//物攻 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.MAGATTACK, GameManager.gameManager.OtherPlayerData.MAttack));//法攻 //attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.CUREAMOUNT, GameManager.gameManager.OtherPlayerData.CureMount)); attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.PYSDEF, GameManager.gameManager.OtherPlayerData.PDefense));//物防 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.MAGDEF, GameManager.gameManager.OtherPlayerData.MDefense));////法防 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.HIT, GameManager.gameManager.OtherPlayerData.Hit)); // 命中率 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.DODGE, GameManager.gameManager.OtherPlayerData.Doge));//闪避 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.CRITICAL, GameManager.gameManager.OtherPlayerData.Critical));//暴击 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.DECRITICAL, GameManager.gameManager.OtherPlayerData.DeCritical));//暴击抗性 _DetailBaseAttrs.InitContentItem(attrList);//显示基础属性 attrList.Clear(); attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.STRIKE, GameManager.gameManager.OtherPlayerData.Strike));//穿透 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.DUCTICAL, GameManager.gameManager.OtherPlayerData.Ductical));//韧性 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.CRITIADD, GameManager.gameManager.OtherPlayerData.CriticalAdd));//暴击加成 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.CRITIMIS, GameManager.gameManager.OtherPlayerData.CriticalMis));//暴击减免 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.INGDEF, GameManager.gameManager.OtherPlayerData.IngDef)); // 无视防御 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.REDUCEDAM, GameManager.gameManager.OtherPlayerData.ReduceDam));// 伤害减免 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.VOCDAMAGERATE, Games.GlobeDefine.CharacterDefine.PROFESSION.TIANJI, GameManager.gameManager.OtherPlayerData.VOCDAMAGERATE_TianJi));// // 对天机伤害提升比 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.VOCDAMAGERATE,Games.GlobeDefine.CharacterDefine.PROFESSION.LIUSHAN,GameManager.gameManager.OtherPlayerData.VOCDAMAGERATE_LiuShan)); // 对六扇伤害提升比 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.VOCDAMAGERATE,Games.GlobeDefine.CharacterDefine.PROFESSION.SHUSHAN,GameManager.gameManager.OtherPlayerData.VOCDAMAGERATE_ShuShan)); // 对蜀山伤害提升比 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.VOCDAMAGERATE,Games.GlobeDefine.CharacterDefine.PROFESSION.XUANNV, GameManager.gameManager.OtherPlayerData.VOCDAMAGERATE_XuanNv)); // 对玄女伤害提升比 _DetailSpecilAttrs.InitContentItem(attrList);//显示特殊属性 attrList.Clear(); attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.DIZZYENHANCE, GameManager.gameManager.OtherPlayerData.DizzyEnhance)); // 眩晕增强 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.DIZZYEDEF, GameManager.gameManager.OtherPlayerData.DizzyeDef)); // 眩晕抗性 //attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.SILENTENHANCE, GameManager.gameManager.OtherPlayerData.SilentEnhance)); // 沉默增强 //attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.SILENTDEF, GameManager.gameManager.OtherPlayerData.SilentDef)); // 沉默抗性 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.IMMOBENHANCE, GameManager.gameManager.OtherPlayerData.ImmobEnhance)); // 定身 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.IMMOBDEF, GameManager.gameManager.OtherPlayerData.ImmobDef)); // 定身抗性 //attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.REPELENHANCE, GameManager.gameManager.OtherPlayerData.RepelEnhance));// 击退增强 //attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.REPELDEF, GameManager.gameManager.OtherPlayerData.RepelDef));// 击退抗性 //attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.POLYMORPHENHANCE, GameManager.gameManager.OtherPlayerData.PolymorphEnhance)); // 变羊增强 //attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.POLYMORPHDEF, GameManager.gameManager.OtherPlayerData.PolymorphDef));// 变羊抗性 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.SMENHANCE, GameManager.gameManager.OtherPlayerData.SmEnhance)); // 失明增强 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.SMDEF, GameManager.gameManager.OtherPlayerData.SmDef)); // 失明抗性 //attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.HMENHANCE, GameManager.gameManager.OtherPlayerData.HmEnhance));// 昏迷增强 //attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.HMDEF, GameManager.gameManager.OtherPlayerData.HmDef)); // 昏迷抗性 //attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.SHENHANCE, GameManager.gameManager.OtherPlayerData.ShEnhance)); // 石化增强 //attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.SHDEF, GameManager.gameManager.OtherPlayerData.ShDef)); // 石化抗性 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.HLENHANCE, GameManager.gameManager.OtherPlayerData.HLENCHANCE)); // 混乱增强 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.HLDEF, GameManager.gameManager.OtherPlayerData.HlDef)); //抗混乱 _DetailEffectAttrs.InitContentItem(attrList);//显示效果属性 attrList.Clear(); attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.DGDEF, GameManager.gameManager.OtherPlayerData.DgDef)); // 电抗 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.DGIGNDEF, GameManager.gameManager.OtherPlayerData.DgIgnDef)); // 忽视电抗 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.HUOGDEF, GameManager.gameManager.OtherPlayerData.HuogDef)); // 火抗 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.HUOGIGNDEF, GameManager.gameManager.OtherPlayerData.HuogIgnDef));// 忽视火抗 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.DUGDEF, GameManager.gameManager.OtherPlayerData.DugDef)); // 毒抗 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.DUGIGNDEF, GameManager.gameManager.OtherPlayerData.DugIgnDef)); // 忽视毒抗 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.BGDEF, GameManager.gameManager.OtherPlayerData.BgDef)); // 冰抗 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.BGIGNDEF, GameManager.gameManager.OtherPlayerData.BgIgnDef)); // 忽视冰抗 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.FGDEF, GameManager.gameManager.OtherPlayerData.FgDef)); // 风抗 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.FGIGNDEF, GameManager.gameManager.OtherPlayerData.FgIgnDef)); // 忽视风抗 //attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.GGDEF, GameManager.gameManager.OtherPlayerData.GgDef)); // 光抗 //attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.GGIGNDEF, GameManager.gameManager.OtherPlayerData.GgIgnDef)); // 忽视光抗 //attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.HUANGDEF, GameManager.gameManager.OtherPlayerData.HuangDef));// 幻抗 //attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.HUANGIFNDEF, GameManager.gameManager.OtherPlayerData.HuangIgnDef));// 忽视幻抗 //attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.HLDEF, GameManager.gameManager.OtherPlayerData.HlDef)); // 混乱抗 //attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.HLIGNDEF, GameManager.gameManager.OtherPlayerData.HlIgnDef)); // 忽视混乱抗 // Todo: New attr attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.DUGATTACK, GameManager.gameManager.OtherPlayerData.DuGAttack)); // 毒攻 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.HUOATTACK, GameManager.gameManager.OtherPlayerData.HuoAttack)); // 火攻 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.BGATTACK, GameManager.gameManager.OtherPlayerData.BGAttack)); // 冰攻 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.DGATTACK, GameManager.gameManager.OtherPlayerData.DGAttack));// 点攻 attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.FGATTACK, GameManager.gameManager.OtherPlayerData.FGAttack)); // 风攻 //attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.GGATTACK, GameManager.gameManager.OtherPlayerData.GGAttack)); // 光攻 //attrList.Add(new RoleViewAttrPair.AttrPair(PropID.PropertyID.HUANGATTACK, GameManager.gameManager.OtherPlayerData.HuanGAttack)); // 幻攻 _DetailExAttrs.InitContentItem(attrList);//显示元素属性 } // 显示滑动条属性 血气、法力、经验值 public void InitRoleSliderValue() { m_HpValue.text = GameManager.gameManager.OtherPlayerData.CurHp + "/" + GameManager.gameManager.OtherPlayerData.MaxHP; m_HpSlider.value = (float)GameManager.gameManager.OtherPlayerData.CurHp / (float)GameManager.gameManager.OtherPlayerData.MaxHP; m_MpValue.text = GameManager.gameManager.OtherPlayerData.CurMp + "/" + GameManager.gameManager.OtherPlayerData.MaxMp; m_MpSlider.value = (float)GameManager.gameManager.OtherPlayerData.CurMp / (float)GameManager.gameManager.OtherPlayerData.MaxMp; // 用"万"字缩减数字长度 // 目前只有经验值会超出百万范围 m_ExpValue.text = string.Format("{0}/{1}", Utils.ConvertLargeNumToString(GameManager.gameManager.OtherPlayerData.CurExp), Utils.ConvertLargeNumToString(GameManager.gameManager.OtherPlayerData.MaxExp)); m_ExpSlider.value = (float)GameManager.gameManager.OtherPlayerData.CurExp / (float)GameManager.gameManager.OtherPlayerData.MaxExp; } }