override public void SetParams(bool is_new, object[] parms) { base.SetParams(is_new, parms); if (parms == null || parms.Length != 2) { throw new System.Exception("invalid parms"); } m_Creature = (Creature)parms[0]; OnEquipEnchantCallback = parms[1] as System.Action; EquipEnchantPrefab.Clear(); EquipEnchantMaxPrefab.Clear(); m_Weapon = null; m_Armor = null; Init(); }
public void Init(bool bTweenWeapon = false, bool bTweenArmor = false) { if (m_Creature.Weapon.Info.Grade == 6 && m_Creature.Weapon.EnchantLevel == 5) { if (m_Weapon != null) { if (EquipEnchantPrefab.Contains(m_Weapon.gameObject) == true) { EquipEnchantPrefab.Free(m_Weapon.gameObject); m_Weapon = null; } } if (m_Weapon == null) { m_Weapon = EquipEnchantMaxPrefab.GetNewObject <EquipEnchant>(m_WeaponIndicator.transform, Vector3.zero); } } else { if (m_Weapon != null) { if (EquipEnchantMaxPrefab.Contains(m_Weapon.gameObject) == true) { EquipEnchantMaxPrefab.Free(m_Weapon.gameObject); m_Weapon = null; } } if (m_Weapon == null) { m_Weapon = EquipEnchantPrefab.GetNewObject <EquipEnchant>(m_WeaponIndicator.transform, Vector3.zero); } } if (m_Creature.Armor.Info.Grade == 6 && m_Creature.Armor.EnchantLevel == 5) { if (m_Armor != null) { if (EquipEnchantPrefab.Contains(m_Armor.gameObject) == true) { EquipEnchantPrefab.Free(m_Armor.gameObject); m_Armor = null; } } if (m_Armor == null) { m_Armor = EquipEnchantMaxPrefab.GetNewObject <EquipEnchant>(m_ArmorIndicator.transform, Vector3.zero); } } else { if (m_Armor != null) { if (EquipEnchantMaxPrefab.Contains(m_Armor.gameObject) == true) { EquipEnchantMaxPrefab.Free(m_Armor.gameObject); m_Armor = null; } } if (m_Armor == null) { m_Armor = EquipEnchantPrefab.GetNewObject <EquipEnchant>(m_ArmorIndicator.transform, Vector3.zero); } } m_Weapon.Init(m_Creature.Weapon, OnEnchantCallback, bTweenWeapon); m_Armor.Init(m_Creature.Armor, OnEnchantCallback, bTweenArmor); }
public void OnCancel() { m_Weapon = null; m_Armor = null; base.OnClose(); }