Esempio n. 1
0
    public void InitializeSkillButton(List <PSkillInfo> SkillInfos)
    {
        void InitializeSkillButton(PToolTipedButton SkillButton, int Index)
        {
            SkillButton.gameObject.SetActive(false);
            if (SkillInfos.Count > Index)
            {
                PSkillInfo SkillInfo  = SkillInfos[Index];
                string     ButtonText = SkillInfo.Name;
                if (SkillInfo.Type.Equals(PSkillType.Lock))
                {
                    ButtonText += "[锁定]";
                }
                else if (SkillInfo.Type.Equals(PSkillType.SoftLock))
                {
                    ButtonText += "[软锁定]";
                }
                SkillButton.GetComponentInChildren <Text>().text = ButtonText;
                ColorBlock Colors = SkillButton.colors;
                Colors.normalColor      = SkillInfo.Type.SkillColor;
                Colors.highlightedColor = SkillInfo.Type.SkillColor;
                SkillButton.colors      = Colors;
                SkillButton.ToolTip     = SkillInfo.ToolTip;
                SkillButton.onClick.RemoveAllListeners();
                SkillButton.onClick.AddListener(() => {
                    PNetworkManager.NetworkClient.Send(new PClickOnSkillOrder(Index.ToString()));
                });
                SkillButton.gameObject.SetActive(true);
            }
        }

        InitializeSkillButton(Skill1Button, 0);
        InitializeSkillButton(Skill2Button, 1);
    }