Esempio n. 1
0
 // Token: 0x060046BD RID: 18109 RVA: 0x0017FCC4 File Offset: 0x0017E0C4
 private void CreateButtons(DialogActions buttons, string focusButton)
 {
     this.defaultButton.gameObject.SetActive(false);
     if (buttons == null)
     {
         return;
     }
     buttons.ForEach(delegate(KeyValuePair <string, Func <bool> > x)
     {
         Button button     = this.GetButton();
         UnityAction value = delegate
         {
             if (x.Value())
             {
                 this.Hide();
             }
         };
         this.buttonsInUse.Add(x.Key, button);
         this.buttonsActions.Add(x.Key, value);
         button.gameObject.SetActive(true);
         button.transform.SetAsLastSibling();
         Text componentInChildren = button.GetComponentInChildren <Text>();
         if (componentInChildren)
         {
             componentInChildren.text = x.Key;
         }
         button.onClick.AddListener(this.buttonsActions[x.Key]);
         if (x.Key == focusButton)
         {
             button.Select();
         }
     });
 }
Esempio n. 2
0
        /// <summary>
        /// Creates the buttons.
        /// </summary>
        /// <param name="buttons">Buttons.</param>
        /// <param name="focusButton">Focus button.</param>
        protected virtual void CreateButtons(DialogActions buttons, string focusButton)
        {
            defaultButton.gameObject.SetActive(false);

            if (buttons == null)
            {
                return;
            }

            buttons.ForEach(x =>
            {
                var button = GetButton();

                UnityAction callback = () =>
                {
                    if (x.Value())
                    {
                        Hide();
                    }
                };

                buttonsInUse.Add(button);
                buttonsActions.Add(callback);

                button.gameObject.SetActive(true);
                button.transform.SetAsLastSibling();

                var dialog_button = button.GetComponentInChildren <DialogButtonComponentBase>();
                if (dialog_button != null)
                {
                    dialog_button.SetButtonName(x.Key);
                }
                else
                {
                    var text = button.GetComponentInChildren <Text>();
                    if (text != null)
                    {
                        text.text = x.Key;
                    }
                }

                button.onClick.AddListener(callback);

                if (x.Key == focusButton)
                {
                    button.Select();
                }
            });
        }