private bool CreateButtons()
        {
            Debug.Assert(ButtonUIPrefab != null);
            Debug.Assert(ButtonUIRoot != null);
            if (ButtonUIPrefab == null || ButtonUIRoot == null)
            {
                return(false);
            }


            for (int i = 0; i < BUTTON_COUNT; i++)
            {
                var go = Instantiate(ButtonUIPrefab, ButtonUIRoot) as GameObject;
                if (go == null)
                {
                    continue;
                }

                var ctrl = go.GetComponentInChildren <NormalButtonController>();
                if (ctrl == null)
                {
                    continue;
                }

                var p = new NormalButtonController.InitParam();
                p.ItemIndex       = i;
                p.OnButtonClicked = OnButtonClicked;

                ctrl.Init(p);
                m_Buttons.Add(ctrl);
            }

            return(true);
        }
Esempio n. 2
0
        //-----------------------------------------
        // メンバ変数
        //-----------------------------------------
        #region ===== MEMBER_VATRIABLES =====


        void Awake()
        {
            if (m_titleButton != null)
            {
                var p = new NormalButtonController.InitParam();
                p.OnButtonClicked = OnButtonClicked;

                m_titleButton.Init(p);
            }
        }
 /// <summary>
 /// ボタン選択肢更新
 /// </summary>
 /// <param name="_settings"></param>
 public void ResetButtons()
 {
     Shuffle <NormalButtonController>(ref m_Buttons);
     for (int i = 0; i < m_Buttons.Count; i++)
     {
         var p = new NormalButtonController.InitParam();
         p.ItemIndex       = i;
         p.ButtonSprite    = buttonImages[i];
         p.OnButtonClicked = OnButtonClicked;
         m_Buttons[i].Init(p);
     }
 }