using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { [XLua.Hotfix] public class GodWeaponSkillBehaviour : MonoBehaviour { [SerializeField] Image m_SkillIcon; [SerializeField] Transform m_ContainerLock; [SerializeField] Text m_SkillCondition; [SerializeField] Button m_Func; [SerializeField] UIEffect m_Effect; GodWeaponConfig godWeaponConfig = null; GodWeaponEffectConfig godWeaponEffectConfig = null; MagicianModel model { get { return ModelCenter.Instance.GetModel(); } } private void Awake() { m_Func.onClick.AddListener(OnFunc); } public void Display(GodWeaponConfig config) { this.godWeaponConfig = config; this.godWeaponEffectConfig = null; var skillConfig = SkillConfig.Get(config.SkillID); m_Effect.StopImediatly(); if (config != null && skillConfig != null) { m_SkillIcon.SetSprite(skillConfig.IconName); var active = PlayerDatas.Instance.skill.GetSKillById(skillConfig.SkillID) != null; m_ContainerLock.gameObject.SetActive(!active); m_SkillCondition.gameObject.SetActive(!active); m_SkillIcon.material = active ? MaterialUtility.GetUIDefaultGraphicMaterial() : MaterialUtility.GetDefaultSpriteGrayMaterial(); if (!active) { m_SkillCondition.text = Language.Get("L1091", config.Lv); } } } public void Display(GodWeaponEffectConfig config) { this.godWeaponEffectConfig = config; this.godWeaponConfig = null; m_Effect.StopImediatly(); if (config != null) { m_SkillIcon.SetSprite(model.GetEffectSkillIcon(config.type, config.level)); var weaponInfo = model.GetGodWeaponInfo(config.type); bool active = weaponInfo != null && weaponInfo.level >= config.level; m_SkillCondition.gameObject.SetActive(!active); m_ContainerLock.gameObject.SetActive(!active); m_SkillIcon.material = active ? MaterialUtility.GetUIDefaultGraphicMaterial() : MaterialUtility.GetDefaultSpriteGrayMaterial(); if (!active) { m_SkillCondition.text = Language.Get("L1091", config.level); } m_Effect.Play(); } } private void OnFunc() { if (godWeaponConfig != null) { string extra = StringUtility.Contact("", Language.Get("L1113", godWeaponConfig.Name, godWeaponConfig.Lv), ""); var skillConfig = SkillConfig.Get(godWeaponConfig.SkillID); SkillDetails.ShowSkillDetails(godWeaponConfig.SkillID, SkillDetails.SkillSourceType.GodWeaponSkill, skillConfig != null ? skillConfig.FightPower : 0, godWeaponConfig.Name, extra); } else if (godWeaponEffectConfig != null) { var stage = 0; var type = godWeaponEffectConfig.type; if (model.TryGetGodWeaponStage(type, godWeaponEffectConfig.level, out stage)) { SkillDetails.ShowGodWeaponEffectSkill(type, stage); } } } } }