public ExchangeWgt(GameObject node, ActivityView view) : base(node, view) { ListView <ActivityPhase> phaseList = view.activity.PhaseList; this._elementList = new ListView <ExchangeElement>(); this._elementTmpl = Utility.FindChild(node, "Template"); float height = this._elementTmpl.GetComponent <RectTransform>().rect.height; for (int i = 0; i < phaseList.Count; i++) { GameObject uiItem = null; uiItem = (GameObject)UnityEngine.Object.Instantiate(this._elementTmpl); if (uiItem != null) { uiItem.GetComponent <RectTransform>().sizeDelta = this._elementTmpl.GetComponent <RectTransform>().sizeDelta; uiItem.transform.SetParent(this._elementTmpl.transform.parent); uiItem.transform.localPosition = this._elementTmpl.transform.localPosition + new Vector3(0f, -(height + 5f) * i, 0f); uiItem.transform.localScale = Vector3.one; uiItem.transform.localRotation = Quaternion.identity; this._elementList.Add(new ExchangeElement(phaseList[(phaseList.Count - i) - 1] as ExchangePhase, uiItem, this, i)); } } node.GetComponent <RectTransform>().sizeDelta = new Vector2(node.GetComponent <RectTransform>().sizeDelta.x, (height * phaseList.Count) + ((phaseList.Count - 1) * 5f)); this._elementTmpl.CustomSetActive(false); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Activity_Exchange, new CUIEventManager.OnUIEventHandler(this.OnClickExchange)); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Activity_ExchangeConfirm, new CUIEventManager.OnUIEventHandler(this.OnClickExchangeConfirm)); view.activity.OnTimeStateChange += new Activity.ActivityEvent(this.OnStateChange); }
public ProgressWidget(GameObject node, ActivityView view) : base(node, view) { this._tips = Utility.GetComponetInChild <Text>(node, "Tips"); this._back = Utility.GetComponetInChild <Image>(node, "Bar"); this._fore = Utility.GetComponetInChild <Image>(node, "Bar/Fore"); this._cursorTemplate = new Cursor(Utility.FindChild(node, "Bar/Cursor")); ListView <ActivityPhase> phaseList = view.activity.PhaseList; if (phaseList.Count > 0) { this._cursorArray = new Cursor[phaseList.Count]; this._cursorTemplate.root.SetActive(true); this._cursorArray[0] = this._cursorTemplate; for (int i = 1; i < phaseList.Count; i++) { Cursor cursor = new Cursor((GameObject)UnityEngine.Object.Instantiate(this._cursorTemplate.root)); cursor.root.transform.SetParent(this._cursorTemplate.root.transform.parent); this._cursorArray[i] = cursor; } } else { this._cursorTemplate.root.SetActive(false); } view.activity.OnTimeStateChange += new Activity.ActivityEvent(this.OnStateChange); view.activity.OnMaskStateChange += new Activity.ActivityEvent(this.OnStateChange); this.Validate(); }
public ExchangeWgt(GameObject node, ActivityView view) : base(node, view) { this._elementsGo = new DictionaryView <int, GameObject>(); ListView <ActivityPhase> phaseList = view.activity.PhaseList; this._elementsGo.Clear(); this._elementTmpl = Utility.FindChild(node, "Template"); float height = this._elementTmpl.GetComponent <RectTransform>().rect.height; for (int i = 0; i < phaseList.Count; i++) { GameObject obj2 = null; obj2 = (GameObject)UnityEngine.Object.Instantiate(this._elementTmpl); if (obj2 != null) { obj2.GetComponent <RectTransform>().sizeDelta = this._elementTmpl.GetComponent <RectTransform>().sizeDelta; obj2.transform.SetParent(this._elementTmpl.transform.parent); obj2.transform.localPosition = this._elementTmpl.transform.localPosition + new Vector3(0f, -(height + 5f) * i, 0f); obj2.transform.localScale = Vector3.one; obj2.transform.localRotation = Quaternion.identity; this._elementsGo.Add(i, obj2); } } node.GetComponent <RectTransform>().sizeDelta = new Vector2(node.GetComponent <RectTransform>().sizeDelta.x, (height * phaseList.Count) + ((phaseList.Count - 1) * 5f)); this._elementTmpl.CustomSetActive(false); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Activity_Exchange, new CUIEventManager.OnUIEventHandler(this.OnClickExchange)); view.activity.OnTimeStateChange += new Activity.ActivityEvent(this.OnStateChange); this.UpdateAllElements(); }
public PointsExchangeWgt(GameObject node, ActivityView view) : base(node, view) { ListView <ActivityPhase> phaseList = view.activity.PhaseList; this._elementList = new ListView <PointsExchangeWgt.PointsExchangeElement>(); this._elementTmpl = Utility.FindChild(node, "Template"); float height = this._elementTmpl.GetComponent <RectTransform>().rect.height; for (int i = 0; i < phaseList.Count; i++) { GameObject gameObject = (GameObject)Object.Instantiate(this._elementTmpl); if (gameObject != null) { gameObject.GetComponent <RectTransform>().sizeDelta = this._elementTmpl.GetComponent <RectTransform>().sizeDelta; gameObject.transform.SetParent(this._elementTmpl.transform.parent); gameObject.transform.localPosition = this._elementTmpl.transform.localPosition + new Vector3(0f, -(height + 5f) * (float)i, 0f); gameObject.transform.localScale = Vector3.one; gameObject.transform.localRotation = Quaternion.identity; this._elementList.Add(new PointsExchangeWgt.PointsExchangeElement(phaseList[i] as PointsExchangePhase, gameObject, this, i)); } } node.GetComponent <RectTransform>().sizeDelta = new Vector2(node.GetComponent <RectTransform>().sizeDelta.x, height * (float)phaseList.Count + (float)(phaseList.Count - 1) * 5f); this._elementTmpl.CustomSetActive(false); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Activity_PtExchange, new CUIEventManager.OnUIEventHandler(this.OnClickExchange)); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Activity_PtExchangeConfirm, new CUIEventManager.OnUIEventHandler(this.OnClickExchangeConfirm)); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Activity_PtExchangeCountReady, new CUIEventManager.OnUIEventHandler(this.OnClickExchangeCountSelectReady)); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Activity_ExchangeHeroSkinConfirm, new CUIEventManager.OnUIEventHandler(this.OnExchangeHeroSkinConfirm)); view.activity.OnTimeStateChange += new Activity.ActivityEvent(this.OnStateChange); }
public BannerWidget(GameObject node, ActivityView view) : base(node, view) { this._stepList = Utility.GetComponetInChild <CUIStepListScript>(node, "StepList"); this._stepList.SetDontUpdate(true); this._timeCD = Utility.GetComponetInChild <Text>(node, "TimeCD"); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Activity_BannerClick, new CUIEventManager.OnUIEventHandler(this.OnClick)); this.Validate(); }
public NoticeWidget(GameObject node, ActivityView view) : base(node, view) { this._datePeriod = Utility.GetComponetInChild <Text>(node, "DatePeriod"); this._scrollRect = Utility.GetComponetInChild <ScrollRect>(node, "ScrollRect"); this._descContent = Utility.GetComponetInChild <Text>(node, "ScrollRect/DescContent"); this._jumpBtn = Utility.FindChild(node, "JumpBtn"); this._jumpBtnLabel = Utility.GetComponetInChild <Text>(this._jumpBtn, "Text"); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Activity_NoticeJump, new CUIEventManager.OnUIEventHandler(this.OnClickJump)); this.Validate(); }
public CheckInWidget(GameObject node, ActivityView view) : base(node, view) { this._awardTitle = Utility.GetComponetInChild <Text>(node, "Content/AwardTitle"); this._awardDesc = Utility.GetComponetInChild <Text>(node, "Content/AwardDesc"); this._timeRemain = Utility.GetComponetInChild <Text>(node, "Content/TimeRemain"); this._progLabel = Utility.GetComponetInChild <Text>(node, "Content/Progress"); this._getBtn = Utility.FindChild(node, "GetAward"); this._getBtnText = Utility.GetComponetInChild <Text>(this._getBtn, "Text"); this.Validate(); view.activity.OnMaskStateChange += new Activity.ActivityEvent(this.OnStateChanged); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Wealfare_CheckInGet, new CUIEventManager.OnUIEventHandler(this.OnClickGet)); }
public IntrodWidget(GameObject node, ActivityView view) : base(node, view) { this._datePeriod = Utility.GetComponetInChild <Text>(node, "DatePeriod"); this._descTitle = Utility.GetComponetInChild <Text>(node, "DescTitle"); this._descContent = Utility.GetComponetInChild <Text>(node, "DescContent"); this._moreBtn = Utility.FindChild(node, "DetailBtn"); this._moreBtnLabel = Utility.GetComponetInChild <Text>(this._moreBtn, "Text"); this._isDetail = false; this._moreBtn.SetActive(view.activity.Content.Trim().get_Length() > 0); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Activity_ClickMore, new CUIEventManager.OnUIEventHandler(this.OnClickMore)); this.Validate(); }
private void OnStateChange(Activity acty) { this.Validate(); ActivityView view = base.view; if (view != null) { ListView <ActivityWidget> widgetList = view.WidgetList; for (int i = 0; i < widgetList.Count; i++) { IntrodWidget introdWidget = widgetList[i] as IntrodWidget; if (introdWidget != null) { introdWidget.Validate(); 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(); }
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(); }
public ActivityWidget(GameObject node, ActivityView view) { this._root = node; this._view = view; }