public void Show(string name, string subText, string desc, IUseData data, bool useAble = true) { gameObject.SetActive(true); _name.text = name; _subText.text = subText; _desc.text = desc; _data = data; _useBtn.onClick.RemoveAllListeners(); _cancelBtn.onClick.RemoveAllListeners(); _useBtn.onClick.AddListener(_UseSKill); _cancelBtn.onClick.AddListener(EndShow); _tip.gameObject.SetActive(!useAble); if (!useAble) { _tip.color = Color.red; _tip.text = "无法使用"; _useBtn.interactable = false; _subText.color = Color.red; } else { _useBtn.interactable = true; _subText.color = _titleColor; } }
private void _UseItemOrSkill(IUseData data) { if (data == null || data is Skill) { _UseSkill(data as Skill); } else if (data is Item) { _UseItem(data as Item); } }