using UnityEngine; using System.Collections; using UnityEngine.UI; using System.Collections.Generic; public class OtherCombatInfoPanelCtr : MonoBehaviour { public static OtherCombatInfoPanelCtr Instance; void Awake() { Instance = this; } void OnDestroy() { Instance = null; } #region public Text m_CombatValue; public List item; #endregion public enum CombatValueType { LevelCombat = 0, EquipCombat = 1, GemCombat = 2, SkillCombat = 3, MagicCombat = 4, Pet = 5, EquipChanceCombat =6, GuidpracticCombat = 7, } public void InitInfo(GC_RET_OTHERROLE_POWER_DATA packet) { int otherValue = 0; int mValue = 0; for(int index = 0; index < item.Count; index++) { switch (item[index].GetComponent().type) { case CombatValueType.LevelCombat: otherValue = packet.Otherlevelpower; mValue = packet.Mylevelpower; break; case CombatValueType.EquipCombat: otherValue = packet.Otherequippower; mValue = packet.Myequippower; break; case CombatValueType.GemCombat: otherValue = packet.Otherdiamondpower; mValue = packet.Mydiamondpower; break; case CombatValueType.SkillCombat: otherValue = packet.Otherskillpower; mValue = packet.Myskillpower; break; case CombatValueType.MagicCombat: otherValue = packet.Othermagicweaponpower; mValue = packet.Mymagicweaponpower; break; case CombatValueType.Pet: otherValue = packet.Otherpetcombat; mValue = packet.Mypetcombat; break; } item[index].gameObject.GetComponent().InitInfo(otherValue.ToString(), mValue.ToString(), GetItemTitleByType(item[index].GetComponent().type)); InitMyTotalCombat(packet.Otherlevelpower + packet.Otherequippower + packet.Otherdiamondpower + packet.Otherskillpower + packet.Othermagicweaponpower); } } public string GetItemTitleByType(CombatValueType type) { string desc = ""; switch (type) { case CombatValueType.LevelCombat: desc = GCGame.Table.StrDictionary.GetClientDictionaryString("#{86711}"); break; case CombatValueType.EquipCombat: desc = GCGame.Table.StrDictionary.GetClientDictionaryString("#{86712}"); break; case CombatValueType.GemCombat: desc = GCGame.Table.StrDictionary.GetClientDictionaryString("#{86713}"); break; case CombatValueType.SkillCombat: desc = GCGame.Table.StrDictionary.GetClientDictionaryString("#{86714}"); break; case CombatValueType.MagicCombat: desc = GCGame.Table.StrDictionary.GetClientDictionaryString("#{86715}"); break; case CombatValueType.Pet: desc = GCGame.Table.StrDictionary.GetClientDictionaryString("#{86716}"); break; } return desc; } public void InitMyTotalCombat(int value) { m_CombatValue.text = value + ""; } }