Esempio n. 1
0
 protected void DrawChildren()
 {
     if (m_subviews.Count > 0)
     {
         for (int i = 0; i < m_subviews.Count; ++i)
         {
             View subview = m_subviews[i];
             if (!subview.IsEnabled && GUI.enabled)
             {
                 GUI.enabled = false;
                 try
                 {
                     subview.OnGUI();
                 }
                 finally
                 {
                     GUI.enabled = true;
                 }
             }
             else
             {
                 subview.OnGUI();
             }
         }
     }
 }
Esempio n. 2
0
        void OnGUI()
        {
            if (m_rootView == null)
            {
                m_oldSize = new Vector2(this.Width, this.Height);

                m_rootView = CreateRootView();
                if (m_rootView == null)
                {
                    throw new NullReferenceException("Root view should not be null");
                }

                CreateUI();
                RunStart();
            }

            if (m_oldSize.x != this.Width ||
                m_oldSize.y != this.Height)
            {
                m_oldSize = new Vector2(this.Width, this.Height);
                OnSizeChanged();
            }

            m_rootView.OnGUI();
            m_dirty = true;

            Event.Destroy();
        }
Esempio n. 3
0
        public void OnGUI()
        {
            float w = 2 * Screen.width / 3;
            float h = w / 1.6f;
            float x = 0.5f * (Screen.width - w);
            float y = 0.5f * (Screen.height - h);

            GUI.ModalWindow(0, new Rect(x, y, w, h), delegate(int id) {
                GUILayout.BeginVertical();
                {
                    GUILayout.Label("Select a server:");
                    GUILayout.Space(GUILayoutUtility.GetLastRect().height);

                    GUILayout.BeginScrollView(Vector2.zero);
                    {
                        m_rootView.OnGUI();
                    }
                    GUILayout.EndScrollView();

                    GUILayout.BeginHorizontal();
                    {
                        if (GUILayout.Button("Connect"))
                        {
                            Debug.Log("Connect");
                        }

                        if (GUILayout.Button("Cancel"))
                        {
                            Debug.Log("Cancel");
                        }
                    }
                    GUILayout.EndHorizontal();
                }
                GUILayout.EndVertical();
            }, "Test");
        }