private void OnClickGoto(CUIEvent uiEvent) { for (int i = 0; i < this._elementList.Count; i++) { MultiGainListItem item = this._elementList[i]; if (item.gotoBtn == uiEvent.m_srcWidget) { base.view.form.Close(); item.actvPhase.AchieveJump(); break; } } }
public MultiGainWgt(GameObject node, ActivityView view) : base(node, view) { this._elementTmpl = Utility.FindChild(node, "Template"); float height = this._elementTmpl.GetComponent <RectTransform>().rect.height; ListView <ActivityPhase> phaseList = view.activity.PhaseList; this._elementList = new ListView <MultiGainListItem>(); for (int i = 0; i < phaseList.Count; i++) { GameObject obj2 = null; if (i > 0) { obj2 = (GameObject)UnityEngine.Object.Instantiate(this._elementTmpl); obj2.transform.SetParent(this._elementTmpl.transform.parent); obj2.transform.localPosition = this._elementList[i - 1].root.transform.localPosition + new Vector3(0f, -(height + 5f), 0f); obj2.transform.localScale = Vector3.one; obj2.transform.localRotation = Quaternion.identity; } else { this._elementTmpl.SetActive(true); obj2 = this._elementTmpl; } MultiGainListItem item = new MultiGainListItem(obj2, (MultiGainPhase)phaseList[i]); this._elementList.Add(item); } if (this._elementList.Count == 0) { this._elementTmpl.SetActive(false); } node.GetComponent <RectTransform>().sizeDelta = new Vector2(node.GetComponent <RectTransform>().sizeDelta.x, (this._elementList.Count <= 0) ? 0f : ((height * this._elementList.Count) + ((this._elementList.Count - 1) * 5f))); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Activity_ClickGoto, new CUIEventManager.OnUIEventHandler(this.OnClickGoto)); view.activity.OnTimeStateChange += new Activity.ActivityEvent(this.OnStateChange); this.Validate(); }