Пример #1
0
    /// <summary>
    /// 콜라이더와 콜백함수를 제외한 것들 셋팅
    /// </summary>
    /// <param name="targetGo"></param>
    /// <param name="icon"></param>
    /// <param name="color"></param>
    void DefaultChanged(GameObject targetGo, string icon, Color col, Color effCol)
    {
        if (col != Color.clear)
        {
            UITabbase tabBase = targetGo.GetComponent <UITabbase>();
            tabBase.Label[0].color = col;
        }

        if (effCol != Color.clear)
        {
            UITabbase tabBase = targetGo.GetComponent <UITabbase>();
            tabBase.Label[0].effectColor = effCol;
        }

        if (!IsChangeImg)
        {
            UITabbase tabBase = targetGo.GetComponent <UITabbase>();
            //tabBase.Label.color = color;//일단 주석 추후에 사용하면 주석 풀고 사용할일없으면 삭제하자.
            //tabBase.Sprite.color = color;

            if (!string.IsNullOrEmpty(icon) && tabBase.Sprite != null)
            {
                tabBase.ChangeSprite(icon);
            }
        }
        else
        {
            Transform targetTf = targetGo.transform;
            Transform iconTf   = targetTf.FindChild(icon);
            if (iconTf != null)
            {
                targetTf.FindChild(icon).gameObject.SetActive(true);
            }
            else
            {
                Debug.LogError(string.Format("error not found object = {0}", icon));
            }

            if (icon.Contains(DisableIcon))
            {
                targetTf.FindChild(EnableIcon).gameObject.SetActive(false);
            }
            else
            {
                targetTf.FindChild(DisableIcon).gameObject.SetActive(false);
            }
        }

        UIButton uiBtn = targetGo.GetComponent <UIButton>();

        if (uiBtn != null)
        {
            if (!string.IsNullOrEmpty(icon))
            {
                uiBtn.normalSprite = icon;
            }

            uiBtn.duration = 0;
            //uiBtn.defaultColor = color;
            //  uiBtn.defaultColor = col;
        }
    }