public override void Validate()
 {
     for (int i = 0; i < this._rewardList.Count; i++)
     {
         RewardWidget.RewardListItem rewardListItem = this._rewardList[i];
         rewardListItem.Validate();
     }
 }
Ejemplo n.º 2
0
 public override void Validate()
 {
     for (int i = 0; i < this._rewardList.get_Count(); i++)
     {
         RewardWidget.RewardListItem rewardListItem = this._rewardList.get_Item(i);
         rewardListItem.Validate();
     }
 }
 private void OnClickGet(CUIEvent uiEvent)
 {
     for (int i = 0; i < this._rewardList.Count; i++)
     {
         RewardWidget.RewardListItem rewardListItem = this._rewardList[i];
         if (rewardListItem.getBtn == uiEvent.m_srcWidget)
         {
             if (rewardListItem.actvPhase.ReadyForGet)
             {
                 rewardListItem.actvPhase.DrawReward();
             }
             else
             {
                 base.view.form.Close();
                 rewardListItem.actvPhase.AchieveJump();
             }
             break;
         }
     }
 }
        public RewardWidget(GameObject node, ActivityView view) : base(node, view)
        {
            this._elementTmpl = Utility.FindChild(node, "Template");
            float height = this._elementTmpl.GetComponent <RectTransform>().rect.height;
            ListView <ActivityPhase> listView = new ListView <ActivityPhase>(view.activity.PhaseList.Count);

            listView.AddRange(view.activity.PhaseList);
            listView.Sort(new Comparison <ActivityPhase>(RewardWidget.APSort));
            this._rewardList = new ListView <RewardWidget.RewardListItem>();
            for (int i = 0; i < listView.Count; i++)
            {
                GameObject gameObject;
                if (i > 0)
                {
                    gameObject = (GameObject)Object.Instantiate(this._elementTmpl);
                    gameObject.transform.SetParent(this._elementTmpl.transform.parent);
                    gameObject.transform.localPosition = this._rewardList[i - 1].root.transform.localPosition + new Vector3(0f, -(height + 5f), 0f);
                    gameObject.transform.localScale    = Vector3.one;
                    gameObject.transform.localRotation = Quaternion.identity;
                }
                else
                {
                    this._elementTmpl.SetActive(true);
                    gameObject = this._elementTmpl;
                }
                RewardWidget.RewardListItem item = new RewardWidget.RewardListItem(gameObject, this, listView[i]);
                this._rewardList.Add(item);
            }
            if (this._rewardList.Count == 0)
            {
                this._elementTmpl.SetActive(false);
            }
            node.GetComponent <RectTransform>().sizeDelta = new Vector2(node.GetComponent <RectTransform>().sizeDelta.x, (this._rewardList.Count > 0) ? (height * (float)this._rewardList.Count + (float)(this._rewardList.Count - 1) * 5f) : 0f);
            Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Activity_ClickGet, new CUIEventManager.OnUIEventHandler(this.OnClickGet));

            this.Validate();
        }