示例#1
0
        private void SampleTabView()
        {
            GUILayout.Indent(10);
            GUILayout.Text("TabView Horizontal");
            m_sampleTabIndex = GUILayout.TabView(m_sampleTabIndex, m_sampleTabNames, (index) =>
            {
                GUILayout.Button("TabItems " + index);
            }, GUIOption.Width(300), GUIOption.Height(100));

            GUILayout.Space(10);

            GUILayout.Text("TabView Vertical");
            m_sampleTabIndex = GUILayout.TabViewVertical(m_sampleTabIndex, m_sampleTabNames, (index) =>
            {
                GUILayout.Button("TabItems " + index);
            }, 50, GUIOption.Width(300), GUIOption.Height(100));
        }
示例#2
0
        private void SampleLayout()
        {
            GUILayout.Text("GUILayout Flow");
            GUI.Context.BackgroundColor.Set(GUIStyle.Current.BackgroundColorS1);

            GUILayout.Text("GUILayout.Horizontal");
            {
                GUILayout.BeginHorizontal();
                {
                    GUILayout.BeginVertical();
                    {
                        GUILayout.Button("V1-0");
                        GUILayout.Button("V1-1");
                        GUILayout.Button("V1-2");
                    }
                    GUILayout.EndVertical();

                    GUILayout.BeginVertical();
                    {
                        GUILayout.Button("V0-0");
                        GUILayout.Button("V0-1");
                    }
                    GUILayout.EndVertical();

                    GUILayout.BeginVertical();
                    {
                        GUILayout.BeginHorizontal();
                        {
                            GUILayout.Button("V1-H0-0");
                        }
                        GUILayout.EndHorizontal();

                        GUILayout.BeginHorizontal();
                        {
                            GUILayout.Button("V1-H1-0");
                            GUILayout.Button("V1-H1-1");
                        }
                        GUILayout.EndHorizontal();
                    }
                    GUILayout.EndVertical();
                }
                GUILayout.EndHorizontal();
                //wrong
                GUILayout.Text("AAAAAA");
            }

            GUILayout.Text("GUILayout.Vertical");

            GUILayout.BeginVertical();
            {
                GUILayout.BeginHorizontal();
                {
                    GUILayout.Text("TestText");
                    GUILayout.BeginVertical();
                    GUILayout.Button("ButtonExtend");
                    GUILayout.Button("ButtonExtend");
                    GUILayout.EndVertical();
                    GUILayout.Button("TestButton");
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                {
                    GUILayout.Button("Width 100px", GUIOption.Width(100));
                    GUILayout.Button("Height 40px", GUIOption.Height(40));
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                {
                    GUILayout.Text("Test Text");
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndVertical();


            GUI.Context.BackgroundColor.Restore();
        }
示例#3
0
        private void SampleScrollView()
        {
            if (GUILayout.BeginCollapseGroup("[ScrollView]", ref m_sampleScrollView))
            {
                //scrollview1
                GUILayout.BeginHorizontal();
                {
                    m_scrollViewPosV = GUILayout.BeginScrollView(m_scrollViewPosV, GUIScrollType.Vertical, GUIOption.Width(200), GUIOption.Height(200));
                    {
                        GUILayout.Button("Scroll Vertical");
                        for (int i = 0; i < 5; i++)
                        {
                            GUILayout.Space(100);
                            GUILayout.Text("WWW" + i);
                            GUILayout.Button("Btn" + i);
                        }
                    }
                    GUILayout.EndScrollView();

                    m_scrollViewPosH = GUILayout.BeginScrollView(m_scrollViewPosH, GUIScrollType.Horizontal, GUIOption.Width(200), GUIOption.Height(200));
                    {
                        GUILayout.Button("Scroll Horizontal");

                        GUILayout.Space(20);
                        GUILayout.BeginHorizontal();
                        for (int i = 0; i < 5; i++)
                        {
                            GUILayout.Button("Btn " + i);
                            GUILayout.Text("TEXT:" + i);
                            GUILayout.Indent(100);
                        }
                        GUILayout.EndHorizontal();
                        GUILayout.BeginHorizontal();
                        for (int i = 0; i < 7; i++)
                        {
                            GUILayout.Button("-Btn----" + i);
                        }
                        GUILayout.EndHorizontal();
                    }
                    GUILayout.EndScrollView();

                    m_scrollViewPosAll = GUILayout.BeginScrollView(m_scrollViewPosAll, GUIScrollType.All, GUIOption.Width(200), GUIOption.Height(200));
                    {
                        GUILayout.Button("Scroll All");

                        GUILayout.BeginHorizontal();
                        for (int i = 0; i < 7; i++)
                        {
                            GUILayout.Button("-Btn----" + i);
                        }
                        GUILayout.EndHorizontal();


                        GUILayout.BeginVertical();

                        for (int i = 0; i < 5; i++)
                        {
                            GUILayout.Space(100);
                            GUILayout.Text("WWW" + i);
                            GUILayout.Button("Btn" + i);
                        }

                        GUILayout.EndVertical();
                    }
                    GUILayout.EndScrollView();
                }
                GUILayout.EndHorizontal();

                GUILayout.Button("dwdw");
            }
            GUILayout.EndCollapseGroup();
        }