Пример #1
0
        public override Status Update()
        {
            // Is OnGUI?
            if (Event.current == null)
            {
                return(Status.Error);
            }

            // Get GUIContent
            GUIContent guiContent = new GUIContent(text.Value, texture.Value, tooltip.Value);

            if (guiStyle.isNone)
            {
                if (GUILayout.Button(guiContent, LayoutOptions.GetCurrent()))
                {
                    // Send event?
                    if (onSuccess.id != 0)
                    {
                        owner.root.SendEvent(onSuccess.id);
                    }

                    return(Status.Success);
                }
                else
                {
                    return(Status.Failure);
                }
            }
            else
            {
                if (GUILayout.Button(guiContent, guiStyle.Value, LayoutOptions.GetCurrent()))
                {
                    // Send event?
                    if (onSuccess.id != 0)
                    {
                        owner.root.SendEvent(onSuccess.id);
                    }

                    return(Status.Success);
                }
                else
                {
                    return(Status.Failure);
                }
            }
        }
Пример #2
0
        public override Status Update()
        {
            // Is OnGUI?
            if (Event.current == null)
            {
                return(Status.Error);
            }

            Status currentStatus = this.status;

            switch (position)
            {
            case AlignPosition.Left:
                GUILayout.BeginHorizontal(LayoutOptions.GetCurrent());
                GUILayout.FlexibleSpace();
                currentStatus = base.Update();
                GUILayout.EndHorizontal();
                break;

            case AlignPosition.Right:
                GUILayout.BeginHorizontal(LayoutOptions.GetCurrent());
                currentStatus = base.Update();
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
                break;

            case AlignPosition.Up:
                GUILayout.BeginVertical(LayoutOptions.GetCurrent());
                currentStatus = base.Update();
                GUILayout.FlexibleSpace();
                GUILayout.EndVertical();
                break;

            case AlignPosition.Down:
                GUILayout.BeginVertical(LayoutOptions.GetCurrent());
                GUILayout.FlexibleSpace();
                currentStatus = base.Update();
                GUILayout.EndVertical();
                break;
            }

            return(currentStatus);
        }
Пример #3
0
        public override Status Update()
        {
            // Is OnGUI?
            if (Event.current == null || Value.isNone)
            {
                return(Status.Error);
            }

            if (guiStyle.isNone)
            {
                Value.Value = GUILayout.Toggle(Value.Value, GetGUIContent(), LayoutOptions.GetCurrent());
            }
            else
            {
                Value.Value = GUILayout.Toggle(Value.Value, GetGUIContent(), guiStyle.Value, LayoutOptions.GetCurrent());
            }

            return(Status.Success);
        }
Пример #4
0
        public override void EditorOnTick()
        {
            // Is OnGUI?
            if (Event.current == null)
            {
                return;
            }

            switch (position)
            {
            case AlignPosition.Left:
                GUILayout.BeginHorizontal(LayoutOptions.GetCurrent());
                GUILayout.FlexibleSpace();
                base.EditorOnTick();
                GUILayout.EndHorizontal();
                break;

            case AlignPosition.Right:
                GUILayout.BeginHorizontal(LayoutOptions.GetCurrent());
                base.EditorOnTick();
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
                break;

            case AlignPosition.Up:
                GUILayout.BeginVertical(LayoutOptions.GetCurrent());
                base.EditorOnTick();
                GUILayout.FlexibleSpace();
                GUILayout.EndVertical();
                break;

            case AlignPosition.Down:
                GUILayout.BeginVertical(LayoutOptions.GetCurrent());
                GUILayout.FlexibleSpace();
                base.EditorOnTick();
                GUILayout.EndVertical();
                break;
            }
        }
        public override void EditorOnTick()
        {
            // Is OnGUI?
            if (Event.current == null)
            {
                return;
            }

            // Get the gui content
            GUIContent guiContent = new GUIContent(text.Value, texture.Value, tooltip.Value);

            if (guiStyle.isNone)
            {
                GUILayout.BeginHorizontal(guiContent, GUIStyle.none, LayoutOptions.GetCurrent());
            }
            else
            {
                GUILayout.BeginHorizontal(guiContent, guiStyle.Value, LayoutOptions.GetCurrent());
            }

            base.EditorOnTick();

            GUILayout.EndHorizontal();
        }
Пример #6
0
        public override Status Update()
        {
            // Is OnGUI?
            if (Event.current == null || password.isNone)
            {
                return(Status.Error);
            }

            // Get mask char
            char maskChar = this.maskChar.isNone || this.maskChar.Value.Length < 1 ? '*' : this.maskChar.Value[0];

            if (maxLength.isNone)
            {
                if (guiStyle.isNone)
                {
                    password.Value = GUILayout.PasswordField(password.Value, maskChar, LayoutOptions.GetCurrent());
                }
                else
                {
                    password.Value = GUILayout.PasswordField(password.Value, maskChar, guiStyle.Value, LayoutOptions.GetCurrent());
                }
            }
            else
            {
                if (guiStyle.isNone)
                {
                    password.Value = GUILayout.PasswordField(password.Value, maskChar, maxLength.Value, LayoutOptions.GetCurrent());
                }
                else
                {
                    password.Value = GUILayout.PasswordField(password.Value, maskChar, maxLength.Value, guiStyle.Value, LayoutOptions.GetCurrent());
                }
            }

            return(Status.Success);
        }
Пример #7
0
        public override Status Update()
        {
            // Is OnGUI?
            if (Event.current == null || floatVar.isNone)
            {
                return(Status.Error);
            }

            if (maxLength.isNone)
            {
                if (guiStyle.isNone)
                {
                    floatVar.Value = float.Parse(GUILayout.TextField(floatVar.Value.ToString(), LayoutOptions.GetCurrent()));
                }
                else
                {
                    floatVar.Value = float.Parse(GUILayout.TextField(floatVar.Value.ToString(), guiStyle.Value, LayoutOptions.GetCurrent()));
                }
            }
            else
            {
                if (guiStyle.isNone)
                {
                    floatVar.Value = float.Parse(GUILayout.TextField(floatVar.Value.ToString(), maxLength.Value, LayoutOptions.GetCurrent()));
                }
                else
                {
                    floatVar.Value = float.Parse(GUILayout.TextField(floatVar.Value.ToString(), maxLength.Value, guiStyle.Value, LayoutOptions.GetCurrent()));
                }
            }

            return(Status.Success);
        }
Пример #8
0
        public override Status Update()
        {
            // Is OnGUI?
            if (Event.current == null || text.isNone)
            {
                return(Status.Error);
            }

            if (maxLength.isNone)
            {
                if (guiStyle.isNone)
                {
                    text.Value = GUILayout.TextField(text.Value, LayoutOptions.GetCurrent());
                }
                else
                {
                    text.Value = GUILayout.TextField(text.Value, guiStyle.Value, LayoutOptions.GetCurrent());
                }
            }
            else
            {
                if (guiStyle.isNone)
                {
                    text.Value = GUILayout.TextField(text.Value, maxLength.Value, LayoutOptions.GetCurrent());
                }
                else
                {
                    text.Value = GUILayout.TextField(text.Value, maxLength.Value, guiStyle.Value, LayoutOptions.GetCurrent());
                }
            }

            return(Status.Success);
        }
Пример #9
0
        public override void EditorOnTick()
        {
            // Is OnGUI?
            if (Event.current == null)
            {
                return;
            }

            storeScrollPosition.vector2Value = GUILayout.BeginScrollView(storeScrollPosition.vector2Value, alwayShowHorizontal.Value, alwayShowVertical.Value, horizontalStyle.isNone ? GUI.skin.horizontalScrollbar : horizontalStyle.Value, verticalStyle.isNone ? GUI.skin.verticalScrollbar : verticalStyle.Value, backgroundStyle.isNone ? GUI.skin.scrollView : backgroundStyle.Value, LayoutOptions.GetCurrent());

            base.EditorOnTick();

            GUILayout.EndScrollView();
        }
Пример #10
0
        public override Status Update()
        {
            // Is OnGUI?
            if (Event.current == null)
            {
                return(Status.Error);
            }

            storeScrollPosition.vector2Value = GUILayout.BeginScrollView(storeScrollPosition.vector2Value, alwayShowHorizontal.Value, alwayShowVertical.Value, horizontalStyle.isNone ? GUI.skin.horizontalScrollbar : horizontalStyle.Value, verticalStyle.isNone ? GUI.skin.verticalScrollbar : verticalStyle.Value, backgroundStyle.isNone ? GUI.skin.scrollView : backgroundStyle.Value, LayoutOptions.GetCurrent());

            Status currentStatus = base.Update();

            GUILayout.EndScrollView();

            return(currentStatus);
        }