public void Initialize(OnCallBackIndex callBackIdx, OnCallBack conCallBack = null) { for (int i = 0; i < TabList.Count; i++) { //스크립트가 추가가 되어 있지 아니하다면 추가하려고 검사한다. UITabbase tabBase = TabList[i].GetComponent <UITabbase>(); if (tabBase == null) { tabBase = TabList[i].AddComponent <UITabbase>(); tabBase.Init(); } //누구한테 클릭되면 신호를 보내야 할지 정해준다. tabBase.TabGroup = this; UIButton uiBtn = TabList[i].GetComponent <UIButton>(); if (uiBtn != null) { uiBtn.duration = 0; } //uiBtn.tweenTarget = null; } ConCallback = conCallBack; CallBackIdx = callBackIdx; if (DefaultInitIndex < 0) { return; } OnClickChildBtn(TabList[DefaultInitIndex]); }
/// <summary> /// Initialize 실행 뒤에 해줘야함. /// </summary> /// <param name="tabTextArray">넣고자하는 텍스트들, *주의 할점 : TabList와 길이가 동일해야 함</param> public void SetTabText(string[] tabTextArray) { if (TabList.Count <= 0 || TabList[0].GetComponent <UITabbase>() == null) { return; } int loopCount = TabList.Count; for (int i = 0; i < loopCount; i++) { UITabbase tabBase = TabList[i].GetComponent <UITabbase>(); if (i < tabTextArray.Length) { tabBase.ChangeLabel(tabTextArray[i]); } else { tabBase.gameObject.SetActive(false); } } }
/// <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; } }