コード例 #1
0
    /// <summary>
    /// Loads a skin for the skills UI
    /// </summary>
    /// <param name="uiData"></param>
    private void LoadSkillsSkin(UIData uiData, Action onComplete = null)
    {
        m_FaceBackground.sprite                    = uiData.m_Panels.m_LeftPanel;
        m_SkillsBackground.sprite                  = uiData.m_Panels.m_RightPanel;
        m_SkillsBackgroundSmall.sprite             = uiData.m_Panels.m_RightPanelSmall;
        m_PortraitImage.sprite                     = uiData.m_SkillsPortrait;
        m_PortraitBackground.sprite                = uiData.m_Bust.m_BustBackground;
        m_PortraitForeground.sprite                = uiData.m_Bust.m_BustForeground;
        m_UIHealthBar.m_HealthBarBackground.sprite = uiData.m_Bust.m_Healthbar;

        // Assign the skills
        for (int i = 0; i < m_SkillSlots.Length; i++)
        {
            SkillButton slot = m_SkillSlots[i];
            m_SkillSlots[i].transform.parent.gameObject.SetActive(i < PlayerManager.m_Instance.GetSelectedUnit().GetSkills().Count);
            slot.m_Skill = PlayerManager.m_Instance.GetSelectedUnit().GetSkill(i);
            if (slot.m_Skill)
            {
                slot.m_LightIcon.sprite = slot.m_Skill.m_LightIcon;
                slot.m_LightIcon.color  = uiData.m_IconColors.m_IconLight;
                slot.m_DarkIcon.sprite  = slot.m_Skill.m_DarkIcon;
                slot.m_DarkIcon.color   = uiData.m_IconColors.m_IconDark;
            }
            slot.UpdateTooltip();
        }


        // Update the skin and cooldown of the skills
        foreach (SkillButton slot in m_SkillSlots)
        {
            slot.m_SidesImage.sprite  = uiData.m_SkillDiamonds.m_SkillDiamondSides;
            slot.m_CenterImage.sprite = uiData.m_SkillDiamonds.m_SkillDiamondCenter;
            slot.m_LightningImage.material.SetColor("_UICloudTint", uiData.m_SkillDiamonds.m_SkillCloudColor);
            slot.UpdateCooldownDisplay();
        }

        onComplete?.Invoke();
    }