//---------------------------------------------------------------------------- public bool GetUIObject() { m_redParent = m_uiTrans.Find(m_centerAnchorPath + "redball"); redTemp = m_redParent.Find("Button").gameObject; m_blueParent = m_uiTrans.Find(m_centerAnchorPath + "blueball"); blueTemp = m_blueParent.Find("Button").gameObject; selectedRedBallParent = m_uiTrans.Find(m_centerAnchorPath + "selectedRedball"); selectedRedBallTemp = selectedRedBallParent.Find("Button").gameObject; selectedBlueBallParent = m_uiTrans.Find(m_centerAnchorPath + "selectedBlueball"); selectedBlueBallTemp = selectedBlueBallParent.Find("Button").gameObject; m_totalLab = m_uiTrans.Find(m_centerAnchorPath + "total").GetComponent <Text>(); m_totalLab.text = string.Empty; m_selectRedAll = m_uiTrans.Find(m_centerAnchorPath + "selRedAll").GetComponent <Toggle>(); m_selectRedAll.onValueChanged.AddListener((bool isOn) => OnSelRedAllChange(isOn)); m_selectBlueAll = m_uiTrans.Find(m_centerAnchorPath + "selBlueAll").GetComponent <Toggle>(); m_selectBlueAll.onValueChanged.AddListener((bool isOn) => OnSelBlueAllChange(isOn)); dropdown = GetUIComponent <GDropDown>(m_centerAnchorPath + "periodSelection"); dropdown.OnValueChanged = OnDropValueChanged; if (drawData.tcbStatiDataList != null && drawData.tcbStatiDataList.Count > 0) { List <string> str = new List <string>(); for (int i = 0; i < drawData.tcbStatiDataList.Count; i++) { str.Add(drawData.tcbStatiDataList[i].numperiods.ToString()); } dropdown.AddOptions(str); } dropdown.RefreshShowValue(); for (int i = 0; i < RedBallMaxNumber; i++) { var redToggle = Object.Instantiate(redTemp, m_redParent) as GameObject; redToggle.name = (i + 1).ToString(); redToggle.transform.localScale = Vector3.one; redToggle.transform.localRotation = Quaternion.identity; redToggle.transform.Find("Label").GetComponent <Text>().text = (i + 1).ToString(); var toggle = redToggle.GetComponent <Toggle>(); toggle.onValueChanged.AddListener((bool isOn) => OnRedBallToggleChange(toggle, isOn)); redBallToggleList.Add(toggle); } Object.DestroyImmediate(redTemp); for (int i = 0; i < BlueBallMaxNumber; i++) { var blueToggle = Object.Instantiate(blueTemp, m_blueParent) as GameObject; blueToggle.name = (i + 1).ToString(); blueToggle.transform.localScale = Vector3.one; blueToggle.transform.localRotation = Quaternion.identity; blueToggle.transform.Find("Label").GetComponent <Text>().text = (i + 1).ToString(); Toggle toggle = blueToggle.GetComponent <Toggle>(); toggle.onValueChanged.AddListener((bool isOn) => OnBlueBallToggleChange(toggle, isOn)); blueBallToggleList.Add(toggle); } Object.DestroyImmediate(blueTemp); return(true); }
//---------------------------------------------------------------------------- public bool GetUIObject() { if (m_objUI != null) { m_loopScrollView = GetUIComponent <LoopScrollerView>(m_centerAnchorPath + "filterResult/scrollView"); m_winResultScroll = GetUIComponent <LoopScrollerView>(m_centerAnchorPath + "winningResult/scrollView"); m_totalNum = GetUIComponent <Text>(m_centerAnchorPath + "filterResult/after"); m_totalNum.text = string.Empty; m_curPeriod = GetUIComponent <Text>(m_centerAnchorPath + "curPeriod"); m_curPeriod.text = string.Empty; m_dropdown = GetUIComponent <GDropDown>(m_centerAnchorPath + "seePanel/periodSelection"); m_dropdown.OnValueChanged = OnDropValueChanged; if (drawData.tcbStatiDataList != null && drawData.tcbStatiDataList.Count > 0) { List <string> str = new List <string>(); for (int i = 0; i < drawData.tcbStatiDataList.Count; i++) { str.Add(drawData.tcbStatiDataList[i].numperiods.ToString()); } m_dropdown.AddOptions(str); } m_dropdown.RefreshShowValue(); m_prizeNum = GetUIComponent <Text>(m_centerAnchorPath + "seePanel/number"); m_prizeNum.text = string.Empty; m_tempParent = m_uiTrans.Find(m_centerAnchorPath + "seePanel/selectBall"); temp = m_tempParent.Find("Btn").gameObject; for (int i = 0; i < ballMaxNumber; i++) { var redToggle = Object.Instantiate(temp, m_tempParent) as GameObject; redToggle.name = (i + 1).ToString(); redToggle.transform.localScale = Vector3.one; redToggle.transform.localRotation = Quaternion.identity; redToggle.transform.Find("Label").GetComponent <Text>().text = (i + 1).ToString(); var toggle = redToggle.GetComponent <Toggle>(); toggle.onValueChanged.AddListener((bool isOn) => OnBallToggleChange(toggle, isOn)); ballToggleList.Add(toggle); } Object.DestroyImmediate(temp); for (int i = 1; i <= maxRewardLevel; i++) { var text = GetUIComponent <Text>(string.Format(m_centerAnchorPath + "seePanel/result/{0}", i)); text.text = string.Empty; m_winningResult.Add(text); } } return(true); }
public GItem(GDropDown parent, Transform item) { this.dropDown = parent; this.item = item; activeSelf = false; Transform t_trans = item.Find("text"); if (t_trans) { text = t_trans.gameObject.GetComponent <Text>(); } Transform t_image = item.Find("image"); if (t_image) { image = t_image.gameObject.GetComponent <Image>(); } Transform t_selected = item.Find("selected"); if (t_selected) { selected = t_selected.gameObject; } btn = item.GetComponent <Button>(); if (btn == null) { Transform t_btn = item.Find("btn"); if (t_btn != null) { btn = dropDown.GetOrAddComponent <Button>(t_btn.gameObject); } else { btn = dropDown.GetOrAddComponent <Button>(item.gameObject); } } btn.onClick.AddListener(OnBtnItemClicked); }