public PulldownItem SetItem(string label, int index, int value)
        {
            if (index < 0 || index >= this.Items.Count)
            {
                return((PulldownItem)null);
            }
            PulldownItem pulldownItem = this.Items[index];

            if (Object.op_Inequality((Object)pulldownItem.Text, (Object)null))
            {
                pulldownItem.Text.set_text(label);
            }
            pulldownItem.Value = value;
            GameObject gameObject = ((Component)pulldownItem).get_gameObject();

            GameUtility.RequireComponent <SRPG_Button>(gameObject).AddListener((SRPG_Button.ButtonClickEvent)(g =>
            {
                this.Selection = value;
                this.ClosePulldown(false);
                this.TriggerItemChange();
            }));
            gameObject.get_transform().SetParent((Transform)this.ItemHolder, false);
            gameObject.SetActive(true);
            return(pulldownItem);
        }
예제 #2
0
        public PulldownItem AddItem(string label, int value)
        {
            if (Object.op_Equality((Object)this.PulldownItemTemplate, (Object)null))
            {
                return((PulldownItem)null);
            }
            GameObject gameObject = (GameObject)Object.Instantiate <GameObject>((M0)this.PulldownItemTemplate);

            ((SRPG_Button)gameObject.GetComponent <SRPG_Button>()).AddListener((SRPG_Button.ButtonClickEvent)(g =>
            {
                this.Selection = value;
                this.ClosePulldown(false);
                this.TriggerItemChange();
            }));
            PulldownItem component = (PulldownItem)gameObject.GetComponent <PulldownItem>();

            if (Object.op_Inequality((Object)component.Text, (Object)null))
            {
                component.Text.set_text(label);
            }
            component.Value = value;
            this.Items.Add(component);
            gameObject.get_transform().SetParent((Transform)this.ItemHolder, false);
            gameObject.SetActive(true);
            this.ScrollRect.set_verticalNormalizedPosition(1f);
            this.ScrollRect.set_horizontalNormalizedPosition(1f);
            return(component);
        }
예제 #3
0
        public virtual PulldownItem AddItem(string label, int value)
        {
            if (Object.op_Equality((Object)this.PulldownItemTemplate, (Object)null))
            {
                return((PulldownItem)null);
            }
            if (!this.mPulldownItemInitialized)
            {
                this.mPulldownItemInitialized = true;
                PulldownItem pulldownItem = this.OnSetupPulldownItem == null?this.SetupPulldownItem(this.PulldownItemTemplate) : this.OnSetupPulldownItem(this.PulldownItemTemplate);

                pulldownItem.Text    = this.PulldownText;
                pulldownItem.Graphic = this.PulldownGraphic;
            }
            GameObject   gameObject = (GameObject)Object.Instantiate <GameObject>((M0)this.PulldownItemTemplate);
            PulldownItem component  = (PulldownItem)gameObject.GetComponent <PulldownItem>();

            if (Object.op_Inequality((Object)component.Text, (Object)null))
            {
                component.Text.set_text(label);
            }
            component.Value = value;
            this.mItems.Add(component);
            gameObject.get_transform().SetParent((Transform)this.PulldownMenu, false);
            gameObject.SetActive(true);
            return(component);
        }
예제 #4
0
        public PulldownItem AddItem(string label, Sprite sprite, int value)
        {
            PulldownItem        pulldownItem        = this.AddItem(label, value);
            ElementDropdownItem elementDropdownItem = pulldownItem as ElementDropdownItem;

            if (Object.op_Inequality((Object)elementDropdownItem, (Object)null))
            {
                elementDropdownItem.IconImage.set_sprite(sprite);
            }
            return(pulldownItem);
        }
 public void ResetAllItems()
 {
     using (List <PulldownItem> .Enumerator enumerator = this.Items.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             PulldownItem current = enumerator.Current;
             GameUtility.RemoveComponent <SRPG_Button>(((Component)current).get_gameObject());
             ((Component)current).get_gameObject().SetActive(false);
         }
     }
     this.ResetAllStatus();
 }