Esempio n. 1
0
        public override string Show()
        {
            XJGUILayout.VerticalLayout(() =>
            {
                base.ShowTitle();

                XJGUILayout.HorizontalLayout(() =>
                {
                    int x = this.intGUIX.Show();

                    GUILayout.Label(".");

                    int y = this.intGUIY.Show();

                    GUILayout.Label(".");

                    int z = this.intGUIZ.Show();

                    GUILayout.Label(".");

                    int w = this.intGUIW.Show();

                    base.Value = x + "." + y + "." + z + "." + w;
                });
            });

            return(this.Value);
        }
Esempio n. 2
0
        public override string Show(string value)
        {
            int[] values = ParseIPv4Text(value);

            XJGUILayout.VerticalLayout(() =>
            {
                base.ShowTitle();

                XJGUILayout.HorizontalLayout(() =>
                {
                    value  = this.intGUIX.Show(values[0]).ToString();
                    value += ".";

                    GUILayout.Label(".");

                    value += this.intGUIY.Show(values[1]);
                    value += ".";

                    GUILayout.Label(".");

                    value += this.intGUIZ.Show(values[2]);
                    value += ".";

                    GUILayout.Label(".");

                    value += this.intGUIW.Show(values[3]);
                });
            });

            return(value);
        }
Esempio n. 3
0
        public override T Show(T value)
        {
            Type enumType = value.GetType();

            string[] enumNames     = Enum.GetNames(enumType);
            int      selectedIndex = GetSelectedIndex(value, enumNames);

            XJGUILayout.HorizontalLayout(() =>
            {
                base.ShowTitle();

                if (this.Width > 0)
                {
                    GUILayout.FlexibleSpace();
                }

                if (GUILayout.Button(enumNames[selectedIndex],
                                     this.ButtonStyle,
                                     this.ButtonLayout))
                {
                    this.isEditing = !this.isEditing;
                }
            });

            if (!this.isEditing)
            {
                return(value);
            }

            XJGUILayout.HorizontalLayout(() =>
            {
                if (this.Width > 0)
                {
                    GUILayout.FlexibleSpace();
                }

                XJGUILayout.VerticalLayout(() =>
                {
                    for (int i = 0; i < enumNames.Length; i++)
                    {
                        if (i == selectedIndex)
                        {
                            continue;
                        }

                        if (GUILayout.Button(enumNames[i], ButtonLayout))
                        {
                            this.isEditing = false;
                            value          = (T)Enum.Parse(enumType, enumNames[i]);
                        }
                    }
                }, GUI.skin.box);
            });

            return(value);
        }
Esempio n. 4
0
        public override string Show()
        {
            XJGUILayout.HorizontalLayout(() =>
            {
                base.ShowTitle();
                base.Value = base.ShowTextField(base.Value);
            });

            return(base.Value);
        }
Esempio n. 5
0
        public override T Show()
        {
            XJGUILayout.HorizontalLayout(() =>
            {
                base.ShowTitle();

                if (this.ButtonWidth > 0)
                {
                    GUILayout.FlexibleSpace();
                }

                if (GUILayout.Button(this.enumNames[this.selectedIndex],
                                     this.ButtonStyle,
                                     this.ButtonLayout))
                {
                    this.isEditing = !this.isEditing;
                }
            });

            if (!this.isEditing)
            {
                return(Value);
            }

            XJGUILayout.HorizontalLayout(() =>
            {
                if (this.ButtonWidth > 0)
                {
                    GUILayout.FlexibleSpace();
                }

                XJGUILayout.VerticalLayout(() =>
                {
                    for (int i = 0; i < this.enumNames.Length; i++)
                    {
                        if (i == this.selectedIndex)
                        {
                            continue;
                        }

                        if (GUILayout.Button(this.enumNames[i], ButtonLayout))
                        {
                            this.selectedIndex = i;
                            this.isEditing     = false;
                            base.Value         = (T)Enum.Parse(this.enumType, this.enumNames[i]);
                        }
                    }
                }, GUI.skin.box);
            });

            return(this.Value);
        }
Esempio n. 6
0
        public override string Show()
        {
            XJGUILayout.HorizontalLayout(() =>
            {
                base.ShowTitle(this.FieldWidth > 0 && base.Title == null);

                base.Value = GUILayout.TextField
                                 (base.Value, this.FieldWidth <= 0 ? GUILayout.ExpandWidth(true)
                                                      : GUILayout.Width(this.FieldWidth));
            });

            return(base.Value);
        }
Esempio n. 7
0
        public override bool Show()
        {
            XJGUILayout.HorizontalLayout(() =>
            {
                base.ShowTitle(base.title == null);

                GUILayout.FlexibleSpace();

                base.Value = GUILayout.Toggle(base.Value, "");
            });

            return(base.Value);
        }
Esempio n. 8
0
        public override float Show()
        {
            InitializeGUIStyle();

            XJGUILayout.VerticalLayout(() =>
            {
                // TextField

                XJGUILayout.HorizontalLayout(() =>
                {
                    base.ShowTitle(this.FieldWidth > 0 && base.Title == null);

                    UpdateTextFieldColor();

                    this.text = GUILayout.TextField
                                    (this.text, ValueGUI <float> .TextFieldStyle,
                                    base.FieldWidth <= 0 ? GUILayout.ExpandWidth(true)
                                                     : GUILayout.Width(base.FieldWidth));

                    // NOTE:
                    // float.TryParse("0.") return true.
                    // But need to keep user input text, because the user may input "0.x~".

                    float textFieldValue;

                    if (float.TryParse(this.text, out textFieldValue))
                    {
                        base.value = CorrectValue(textFieldValue);
                    }
                });

                // Slider

                if (!base.WithSlider)
                {
                    return;
                }

                // NOTE:
                // Need to update text when the value is updated with Slider.

                float sliderValue = (float)GUILayout.HorizontalSlider(this.Value, base.MinValue, base.MaxValue);

                if (sliderValue != this.Value)
                {
                    this.Value = sliderValue;
                }
            });

            return(this.Value);
        }
Esempio n. 9
0
        public override T Show()
        {
            XJGUILayout.VerticalLayout(() =>
            {
                base.ShowTitle();

                XJGUILayout.HorizontalLayout(() =>
                {
                    ShowComponentGUI();
                });
            });

            return(this.Value);
        }
Esempio n. 10
0
        public override T Show(T value)
        {
            XJGUILayout.VerticalLayout(() =>
            {
                base.ShowTitle();

                XJGUILayout.HorizontalLayout(() =>
                {
                    value = ShowComponents(value);
                });
            });

            return(value);
        }
Esempio n. 11
0
        public override T Show()
        {
            XJGUILayout.VerticalLayout(() =>
            {
                XJGUILayout.HorizontalLayout(() =>
                {
                    base.ShowTitle();

                    this.text = base.ShowTextField(this.text);

                    // NOTE:
                    // float.TryParse("0.") return true.
                    // But need to keep user input text, because the user may input "0.x~".

                    float textValue;

                    if (float.TryParse(this.text, out textValue))
                    {
                        base.Value = (T)Convert.ChangeType(textValue, typeof(T));
                    }
                });

                if (!base.WithSlider)
                {
                    return;
                }

                // NOTE:
                // Need to update text when the value is updated with Slider.

                float value    = (float)Convert.ChangeType(base.Value, typeof(float));
                float minValue = (float)Convert.ChangeType(base.MinValue, typeof(float));
                float maxValue = (float)Convert.ChangeType(base.MaxValue, typeof(float));

                float sliderValue = GUILayout.HorizontalSlider(value, minValue, maxValue);

                T sliderValueT = (T)Convert.ChangeType(sliderValue, typeof(T));

                if (!sliderValueT.Equals(base.Value))
                {
                    this.Value = sliderValueT;
                }
            });

            return(base.Value);
        }
Esempio n. 12
0
        public override Matrix4x4 Show(Matrix4x4 value)
        {
            this.foldoutPanel.Show(() =>
            {
                XJGUILayout.HorizontalLayout(() =>
                {
                    value.m00 = this.floatGUIM00.Show(value.m00);
                    value.m10 = this.floatGUIM10.Show(value.m10);
                    value.m20 = this.floatGUIM20.Show(value.m20);
                    value.m30 = this.floatGUIM30.Show(value.m30);
                });

                XJGUILayout.HorizontalLayout(() =>
                {
                    value.m01 = this.floatGUIM01.Show(value.m01);
                    value.m11 = this.floatGUIM11.Show(value.m11);
                    value.m21 = this.floatGUIM21.Show(value.m21);
                    value.m31 = this.floatGUIM31.Show(value.m31);
                });

                XJGUILayout.HorizontalLayout(() =>
                {
                    value.m02 = this.floatGUIM02.Show(value.m02);
                    value.m12 = this.floatGUIM12.Show(value.m12);
                    value.m22 = this.floatGUIM22.Show(value.m22);
                    value.m32 = this.floatGUIM32.Show(value.m32);
                });

                XJGUILayout.HorizontalLayout(() =>
                {
                    value.m03 = this.floatGUIM03.Show(value.m03);
                    value.m13 = this.floatGUIM13.Show(value.m13);
                    value.m23 = this.floatGUIM23.Show(value.m23);
                    value.m33 = this.floatGUIM33.Show(value.m33);
                });
            });

            return(value);
        }
Esempio n. 13
0
        public override T Show()
        {
            if (EnumGUI <T> .ButtonStyle == null)
            {
                EnumGUI <T> .ButtonStyle        = new GUIStyle(GUI.skin.button);
                EnumGUI <T> .ButtonStyle.normal = GUI.skin.button.active;
            }

            // Selected Element

            XJGUILayout.HorizontalLayout(() =>
            {
                base.ShowTitle();

                string buttonContent = this.enumNames[this.selectedIndex];
                GUIStyle buttonStyle = this.isEditing ? EnumGUI <T> .ButtonStyle : GUI.skin.button;

                if (this.ButtonWidth > 0)
                {
                    GUILayout.FlexibleSpace();
                }

                bool buttonPressed = this.ButtonWidth <= 0 ?
                                     GUILayout.Button(buttonContent, buttonStyle) :
                                     GUILayout.Button(buttonContent, buttonStyle, GUILayout.Width(this.ButtonWidth));

                if (buttonPressed)
                {
                    this.isEditing = !this.isEditing;
                }
            });

            if (!this.isEditing)
            {
                return(this.Value);
            }

            // Other Element

            XJGUILayout.HorizontalLayout(() =>
            {
                if (this.ButtonWidth > 0)
                {
                    GUILayout.FlexibleSpace();
                }

                XJGUILayout.VerticalLayout(() =>
                {
                    for (int i = 0; i < this.enumNames.Length; i++)
                    {
                        if (i == this.selectedIndex)
                        {
                            continue;
                        }

                        string buttonContent = this.enumNames[i];

                        bool buttonPressed = this.ButtonWidth <= 0 ?
                                             GUILayout.Button(buttonContent) :
                                             GUILayout.Button(buttonContent, GUILayout.Width(this.ButtonWidth));

                        if (buttonPressed)
                        {
                            this.selectedIndex = i;
                            this.isEditing     = false;
                            base.value         = (T)Enum.Parse(this.enumType, this.enumNames[i]);
                        }
                    }
                }, GUI.skin.box);
            });

            return(base.Value);
        }
Esempio n. 14
0
    private void OnGUI()
    {
        this.flexibleWindow.Show(() =>
        {
            if (UNetworkManager.singleton.NetworkType == UNetworkManager.UNetType.None)
            {
                GUILayout.Label("Connection Settings");

                UNetworkManager.singleton.networkAddress = this.ipV4GUI.Show(UNetworkManager.singleton.networkAddress);
                UNetworkManager.singleton.networkPort    = this.portGUI.Show(UNetworkManager.singleton.networkPort);

                GUILayout.Label("Start");

                XJGUILayout.HorizontalLayout(() =>
                {
                    if (GUILayout.Button("Start as Server"))
                    {
                        UNetworkManager.singleton.StartServerSafe();
                    }
                    ;

                    if (GUILayout.Button("Start as Host"))
                    {
                        UNetworkManager.singleton.StartHostSafe();
                    }
                    ;

                    if (GUILayout.Button("Start as Client"))
                    {
                        UNetworkManager.singleton.StartClientSafe();
                    }
                    ;
                });

                UNetworkManager.singleton.autoStart     = this.autoStartGUI.Show(UNetworkManager.singleton.autoStart);
                UNetworkManager.singleton.autoStartType = this.autoStartTypeGUI.Show(UNetworkManager.singleton.autoStartType);

                XJGUILayout.HorizontalLayout(() =>
                {
                    GUILayout.Label("Auto Start After : ");
                    GUILayout.FlexibleSpace();
                    GUILayout.Label(UNetworkManager.singleton.AutoStartIntervalTick.ToString("00.00"));
                });
            }

            else
            {
                GUILayout.Label("Connection Type");
                GUILayout.Label(UNetworkManager.singleton.NetworkType.ToString());

                GUILayout.Label("Connection Info");
                GUILayout.Label("Address : " + UNetworkManager.singleton.networkAddress);
                GUILayout.Label("Port : " + UNetworkManager.singleton.networkPort);

                if (GUILayout.Button("Stop Connection"))
                {
                    UNetworkManager.singleton.Stop();
                }
            }

            GUILayout.Label("Status");

            foreach (UNetworkManager.StatusMessage statusMessage
                     in UNetworkManager.singleton.StatusMessages)
            {
                GUILayout.Label(statusMessage.time.ToLongTimeString() + " - " + statusMessage.message);
            }
        });
    }
Esempio n. 15
0
        public override Matrix4x4 Show()
        {
            this.foldoutPanel.Show(() =>
            {
                XJGUILayout.HorizontalLayout(() =>
                {
                    this.floatGUIM00.Show();
                    this.floatGUIM10.Show();
                    this.floatGUIM20.Show();
                    this.floatGUIM30.Show();
                });

                XJGUILayout.HorizontalLayout(() =>
                {
                    this.floatGUIM01.Show();
                    this.floatGUIM11.Show();
                    this.floatGUIM21.Show();
                    this.floatGUIM31.Show();
                });

                XJGUILayout.HorizontalLayout(() =>
                {
                    this.floatGUIM02.Show();
                    this.floatGUIM12.Show();
                    this.floatGUIM22.Show();
                    this.floatGUIM32.Show();
                });

                XJGUILayout.HorizontalLayout(() =>
                {
                    this.floatGUIM03.Show();
                    this.floatGUIM13.Show();
                    this.floatGUIM23.Show();
                    this.floatGUIM33.Show();
                });
            });

            base.Value = new Matrix4x4()
            {
                m00 = this.floatGUIM00.Value,
                m10 = this.floatGUIM10.Value,
                m20 = this.floatGUIM20.Value,
                m30 = this.floatGUIM30.Value,

                m01 = this.floatGUIM01.Value,
                m11 = this.floatGUIM11.Value,
                m21 = this.floatGUIM21.Value,
                m31 = this.floatGUIM31.Value,

                m02 = this.floatGUIM02.Value,
                m12 = this.floatGUIM12.Value,
                m22 = this.floatGUIM22.Value,
                m32 = this.floatGUIM32.Value,

                m03 = this.floatGUIM03.Value,
                m13 = this.floatGUIM13.Value,
                m23 = this.floatGUIM23.Value,
                m33 = this.floatGUIM33.Value,
            };

            return(base.Value);
        }