Esempio n. 1
0
    private void OnInitProp()
    {
        m_dicLabls_Player = new Dictionary <PlayerLabelEnum, UILabel>();
        if (m_trans_propRoot != null)
        {
            int index = 1;
            int start = (int)PlayerLabelEnum.None + 1;
            int end   = (int)PlayerLabelEnum.HpMax;
            do
            {
                Transform labelRoot = m_trans_propRoot.Find("part" + index.ToString());
                if (labelRoot != null)
                {
                    PlayerLabelEnum le = PlayerLabelEnum.None;
                    for (int i = start; i < end; i++)
                    {
                        le = (PlayerLabelEnum)i;

                        Transform child = labelRoot.Find(le.ToString());
                        if (child != null)
                        {
                            UILabel lable = child.GetComponent <UILabel>();
                            if (lable != null)
                            {
                                m_dicLabls_Player.Add(le, lable);
                            }
                            else
                            {
                                Debug.LogError("GetComponent error " + le.ToString());
                            }
                        }
                        else
                        {
                            Debug.LogError("FindChild error " + le.ToString());
                        }
                    }
                }
                else
                {
                    Debug.LogError("FindChild error " + index.ToString());
                }
                start = end;

                if (index == 1)
                {
                    end = (int)PlayerLabelEnum.Power;
                }
                else if (index == 2)
                {
                    end = (int)PlayerLabelEnum.FireATK;
                }
                else if (index == 3)
                {
                    end = (int)PlayerLabelEnum.PCrit;
                }
                else if (index == 4)
                {
                    end = (int)PlayerLabelEnum.Max;
                }
                index++;
            } while (index <= 5);
        }
    }