public void Init() { ClickEventListener listener = ClickEventListener.Get(mStarIcon.gameObject); listener.SetClickEventHandler(OnStarClicked); mToggle.onValueChanged.AddListener(OnToggleValueChanged); }
public void Init() { for (int i = 0; i < mStarArray.Length; ++i) { int index = i; ClickEventListener listener = ClickEventListener.Get(mStarArray[i].gameObject); listener.SetClickEventHandler(delegate(GameObject obj) { OnStarClicked(index); }); } }
bool mIsExpand; //是否扩大 public void Init() { for (int i = 0; i < mStarArray.Length; ++i) { int index = i; ClickEventListener listener = ClickEventListener.Get(mStarArray[i].gameObject); //得到每一个星的点击事件 listener.SetClickEventHandler(delegate(GameObject obj) { OnStarClicked(index); }); //添加星级点击 } mExpandBtn.onClick.AddListener(OnExpandBtnClicked); //展开按钮点击事件 }
public void Init() { for (int i = 0; i < mStarArray.Length; ++i) { int index = i; ClickEventListener listener = ClickEventListener.Get(mStarArray[i].gameObject); listener.SetClickEventHandler(delegate(GameObject obj) { OnStarClicked(index); }); Debug.Log(i); } mExpandBtn.onClick.AddListener(OnExpandBtnClicked); }
private void InitDots() { int childCount = this.mDotsRootObj.get_childCount(); for (int index1 = 0; index1 < childCount; ++index1) { Transform child = this.mDotsRootObj.GetChild(index1); DotElem dotElem = new DotElem(); dotElem.mDotElemRoot = ((Component)child).get_gameObject(); dotElem.mDotSmall = ((Component)child.Find("dotSmall")).get_gameObject(); dotElem.mDotBig = ((Component)child.Find("dotBig")).get_gameObject(); ClickEventListener clickEventListener = ClickEventListener.Get(dotElem.mDotElemRoot); int index = index1; clickEventListener.SetClickEventHandler((Action <GameObject>)(obj => this.OnDotClicked(index))); this.mDotElemList.Add(dotElem); } }
void InitDots() { int childCount = mDotsRootObj.childCount; for (int i = 0; i < childCount; ++i) { Transform tf = mDotsRootObj.GetChild(i); DotElem elem = new DotElem(); elem.mDotElemRoot = tf.gameObject; elem.mDotSmall = tf.Find("dotSmall").gameObject; elem.mDotBig = tf.Find("dotBig").gameObject; ClickEventListener listener = ClickEventListener.Get(elem.mDotElemRoot); int index = i; listener.SetClickEventHandler(delegate(GameObject obj) { OnDotClicked(index); }); mDotElemList.Add(elem); } }
public void Init() { ClickEventListener listener = ClickEventListener.Get(mStarIcon.gameObject); listener.SetClickEventHandler(OnStarClicked); }