private void CreateSpecialStageButtons() { UIPanel uiPanel = this.StageSelectScrollViewer.GetComponent <UIPanel>(); Vector2 viewSize = uiPanel.GetViewSize(); int buttonWidth = (int)viewSize.x - this.StageSelectButtonTrimSize; foreach (VirtualGood virtualGood in ShopManager.VirtualGoods) { SpecialStage readSpecialStage = SpecialStageXmlIo.ReadSpecialStage(virtualGood.ItemId); GameObject item = NGUITools.AddChild(this.StageSelectGrid.gameObject, this.SpecialStageSelectButton); SpecialStageSelectButton stageSelectButton = item.GetComponent <SpecialStageSelectButton>(); if (stageSelectButton != null) { stageSelectButton.SetStage( this, readSpecialStage, this.StageSelectOverrideActivateTarget, this.StageSelectOverrideDeactivateTarget, this.PurchaseStagePopUp, this.RewardOnlyStagePopUp); } UIWidget uiWidget = item.GetComponent <UIWidget>(); if (uiWidget != null) { uiWidget.SetDimensions(buttonWidth, uiWidget.height); } } this.StageSelectGrid.enabled = true; this.StageSelectGrid.repositionNow = true; UIScrollView scrollView = this.StageSelectScrollViewer.GetComponent <UIScrollView>(); scrollView.enabled = true; scrollView.ResetPosition(); this.refreshGrid = true; }
private void Start() { foreach (UILabel dayTextLabel in this.DayTextLabels) { dayTextLabel.text = string.Format("Day {0}", this.Day); } foreach (UILabel rewardTextLabel in this.RewardTextLabels) { switch (this.Reward) { case RewardType.Token: rewardTextLabel.text = string.Format("{0} Tokens", this.RewardCount); break; case RewardType.Stage: SpecialStage rewardStage = SpecialStageXmlIo.ReadSpecialStage(this.StageId); rewardTextLabel.text = rewardStage.Description; break; } } }