| | |
| | | { |
| | | if (m_LvText == null) |
| | | { |
| | | m_LvText = this.transform.GetComponent<Text>("Container_GiftCell/lv"); |
| | | m_LvText = this.transform.GetComponent<Text>("Container_GiftCell/lvrect/lv"); |
| | | } |
| | | return m_LvText; |
| | | } |
| | |
| | | |
| | | //showState 0:不显示 1:新增 2:提升 |
| | | //giftID 0 :代表未激活灰色 -1:代表不能激活 棕色,其他根据配表 |
| | | private void Init(int giftID, int lv, UnityAction onclick = null, int showState = 0) |
| | | public void Init(int giftID, int lv, UnityAction onclick = null, int showState = 0) |
| | | { |
| | | if (HeroTalentConfig.HasKey(giftID)) |
| | | { |
| | |
| | | if (quality == 1) |
| | | { |
| | | //692088 |
| | | return new Color32(105, 32, 136, 255); |
| | | return new Color32(105, 32, 136, 128); |
| | | } |
| | | else if (quality == 2) |
| | | { |
| | | //886220 |
| | | return new Color32(136, 98, 32, 255); |
| | | return new Color32(136, 98, 32, 128); |
| | | } |
| | | else if (quality == 3) |
| | | { |
| | | //884a20 |
| | | return new Color32(136, 74, 32, 255); |
| | | return new Color32(136, 74, 32, 128); |
| | | } |
| | | else if (quality == 4) |
| | | { |
| | | //882020 |
| | | return new Color32(136, 32, 32, 255); |
| | | return new Color32(136, 32, 32, 128); |
| | | } |
| | | return new Color32(255, 255, 255, 255); |
| | | return new Color32(0, 0, 0, 128); |
| | | } |
| | | |
| | | GameObject cellContainer; |
| | |
| | | if (cellContainer != null) |
| | | return; |
| | | |
| | | var tmp = transform.Find("Container_SkillCell"); |
| | | var tmp = transform.Find("Container_GiftCell"); |
| | | if (tmp != null) |
| | | { |
| | | cellContainer = tmp.gameObject; |
| | |
| | | } |
| | | if (cellContainer == null) |
| | | { |
| | | cellContainer = UIUtility.CreateWidget("SkillBaseCell", "Container_SkillCell"); |
| | | cellContainer = UIUtility.CreateWidget("GiftBaseCell", "Container_GiftCell"); |
| | | |
| | | if (cellContainer != null) |
| | | { |
| | |
| | | cellContainer.transform.SetAsFirstSibling(); |
| | | } |
| | | } |
| | | |
| | | //缩放到和父rect一样大 |
| | | var scale = 1f; |
| | | var rect = cellContainer.GetComponent<RectTransform>(); |
| | | var parentRect = transform.GetComponent<RectTransform>(); |
| | | scale = parentRect.sizeDelta.x / rect.sizeDelta.x; |
| | | cellContainer.transform.localScale = new Vector3(scale, scale, scale); |
| | | } |
| | | } |
| | | |