private void ShowDesc(UISkillItem skill) { _currentItem = skill; _skillDesc.SetActive(true); _skillDesc.transform.localPosition = new Vector3(300f, _skillDesc.transform.localPosition.y, _skillDesc.transform.localPosition.z); _skillDesc.GetComponent <RectTransform>().DOAnchorPos(new Vector2(-290f, -44f), 0.25f, true); RefreshDesc(skill); }
private void CreateSkillItem(UDSkill.Skill skill) { GameObject go = GameObject.Instantiate(_skillItem) as GameObject; go.transform.SetParent(_skillItem.transform.parent); go.transform.localScale = Vector3.one; go.SetActive(true); UISkillItem item = go.AddComponent <UISkillItem>(); item.Refresh(skill); _skillItems.Add(item); go.AddComponent <Button>().onClick.AddListener(OnClickSkillItem); }
private void RefreshDesc(UISkillItem skill) { _skillDesc.transform.Find("content").GetComponent <Text>().text = skill.data.Desc + "\n名称:" + skill.data.Name + "\n等级:" + skill.data.Level; }
private void OnClickSkillItem() { UISkillItem item = EventSystem.current.currentSelectedGameObject.GetComponent <UISkillItem>(); ShowDesc(item); }