Beispiel #1
0
		//METHODS:
#if UNITY_EDITOR
		public override void Draw(E.SceneView sceneView)
		{
			base.Draw(sceneView);
			EditorUtil.BeginColorPocket(m_color);
			G.Label(GetPositionedRect(sceneView), m_text, guiStyle);
			EditorUtil.EndColorPocket();
		}
Beispiel #2
0
 public static void ToggleButton(Rect position, Setting <bool> val, string label)
 {
     UGUI.Label(position, label, Style.Label);
     if (UGUI.Button(position, val.Value ? LabelEnabled : LabelDisabled, Style.TextButton))
     {
         val.Value = !val.Value;
     }
 }
Beispiel #3
0
 public static void LabelCenter(SmartRect position, string content, bool move = false)
 {
     UGUI.Label(position.ToRect(), content, Style.LabelCenter);
     if (move)
     {
         position.MoveY();
     }
 }
Beispiel #4
0
 public static bool ToggleButton(Rect position, bool val, string label)
 {
     UGUI.Label(position, label, Style.Label);
     if (UGUI.Button(position, val ? LabelEnabled : LabelDisabled, Style.TextButton))
     {
         return(!val);
     }
     return(val);
 }
Beispiel #5
0
 public static string TextField(Rect position, string value, string label, float offset)
 {
     if (offset > 0f)
     {
         UGUI.Label(position, label, Style.Label);
         position.x     += offset;
         position.width -= offset;
     }
     return(UGUI.TextField(position, value, Style.TextField));
 }
Beispiel #6
0
 public static void TextField(Rect position, Setting <string> value, string label, float offset)
 {
     if (offset > 0f)
     {
         UGUI.Label(position, label, Style.Label);
         position.x     += offset;
         position.width -= offset;
     }
     value.Value = UGUI.TextField(position, value.Value, Style.TextField);
 }
Beispiel #7
0
 public static void HorizontalSlider(Rect position, Setting <float> value, string label, float min, float max, float offset)
 {
     if (offset > 0f)
     {
         UGUI.Label(position, label, Style.Label);
         position.x     += offset;
         position.width -= offset;
     }
     value.Value = UGUI.HorizontalSlider(position, value.Value, min, max, Style.Slider, Style.SliderBody);
 }
Beispiel #8
0
 public static float HorizontalSlider(Rect position, float value, string label, float min, float max, float offset)
 {
     if (offset > 0f)
     {
         UGUI.Label(position, label, Style.Label);
         position.x     += offset;
         position.width -= offset;
     }
     return(UGUI.HorizontalSlider(position, value, min, max, Style.Slider, Style.SliderBody));
 }
Beispiel #9
0
 public static void Toggle(SmartRect position, Setting <bool> val, string label, float offset, bool move = false)
 {
     UGUI.Label(position.ToRect(), label, Style.Label);
     position.MoveOffsetX(position.width - Style.Height);
     val.Value = UGUI.Toggle(position.ToRect(), val.Value, string.Empty, Style.Toggle);
     position.ResetX();
     if (move)
     {
         position.MoveY();
     }
 }
Beispiel #10
0
 public static bool Toggle(SmartRect position, bool val, string label, bool move = false)
 {
     UGUI.Label(position.ToRect(), label, Style.Label);
     position.MoveOffsetX(position.width - Height);
     val = UGUI.Toggle(position.ToRect(), val, string.Empty, Style.Toggle);
     position.ResetX();
     if (move)
     {
         position.MoveY();
     }
     return(val);
 }
Beispiel #11
0
 public static void ToggleButton(SmartRect position, Setting <bool> val, string label, bool move = false)
 {
     UGUI.Label(position.ToRect(), label, Style.Label);
     if (UGUI.Button(position.ToRect(), val.Value ? LabelEnabled : LabelDisabled, Style.TextButton))
     {
         val.Value = !val.Value;
     }
     if (move)
     {
         position.MoveY();
     }
 }
Beispiel #12
0
 public static bool ToggleButton(SmartRect position, bool val, string label, bool move = false)
 {
     UGUI.Label(position.ToRect(), label, Style.Label);
     if (UGUI.Button(position.ToRect(), val ? LabelEnabled : LabelDisabled, Style.TextButton))
     {
         val = !val;
     }
     if (move)
     {
         position.MoveY();
     }
     return(val);
 }
Beispiel #13
0
 public static void HorizontalSlider(SmartRect position, Setting <float> value, string label, float min, float max, float offset, bool move = false)
 {
     if (offset > 0f)
     {
         UGUI.Label(position.ToRect(), label, Style.Label);
         position.MoveOffsetX(offset);
     }
     value.Value = UGUI.HorizontalSlider(position.ToRect(), value.Value, min, max, Style.Slider, Style.SliderBody);
     position.ResetX();
     if (move)
     {
         position.MoveY();
     }
 }
Beispiel #14
0
 public static void TextField(SmartRect position, Setting <string> value, string label, float offset, bool move = false)
 {
     if (offset > 0f)
     {
         UGUI.Label(position.ToRect(), label, Style.Label);
         position.MoveOffsetX(offset);
     }
     value.Value = UGUI.TextField(position.ToRect(), value.Value, Style.TextField);
     position.ResetX();
     if (move)
     {
         position.MoveY();
     }
 }
        private void WindowFunc(int windowID)
        {
            const int border  = 10;
            const int width   = 50;
            const int height  = 25;
            const int spacing = 10;

            Rect l = new Rect(
                border, border + spacing,
                this.windowRect.width - border * 2, this.windowRect.height - border * 2 - height - spacing
                );

            if (this.text_style is null)
            {
                UGUI.Label(l, this.msg);
            }
            else
            {
                UGUI.Label(l, this.msg, this.text_style);
            }

            Rect b = new Rect(
                this.windowRect.width - width - border,
                this.windowRect.height - height - border,
                width,
                height);

            if (this.action is null)
            {
                if (UGUI.Button(b, "OK"))
                {
                    Destroy(this.gameObject);
                }
            }
            else
            {
                if (UGUI.Button(b, "OK"))
                {
                    this.action(); Destroy(this.gameObject);
                }

                Rect b1 = new Rect(b);
                b1.x -= b.width + spacing;
                if (UGUI.Button(b1, "Cancel"))
                {
                    Destroy(this.gameObject);
                }
            }
        }
Beispiel #16
0
 public static float HorizontalSlider(SmartRect position, float value, string label, float offset, bool move = false)
 {
     if (offset > 0f)
     {
         UGUI.Label(position.ToRect(), label, Style.Label);
         position.MoveOffsetX(offset);
     }
     value = UGUI.HorizontalSlider(position.ToRect(), value, 0f, 1f, Style.Slider, Style.SliderBody);
     position.ResetX();
     if (move)
     {
         position.MoveY();
     }
     return(value);
 }
Beispiel #17
0
        public static void TextField(Rect position, Setting <int> val, string label, float offset)
        {
            if (offset > 0f)
            {
                UGUI.Label(position, label, Style.Label);
                position.x     += offset;
                position.width -= offset;
            }
            if (!integers.ContainsKey(val))
            {
                integers.Add(val, val.Value.ToString());
            }
            string text = integers[val];

            text = UGUI.TextField(position, text, Style.TextField);
            int.TryParse(text, out val.Value);
            integers[val] = text;
        }
        private void WindowFunc(int windowID)
        {
            const int border  = 10;
            const int width   = 50;
            const int height  = 25;
            const int spacing = 10;

            Rect l = new Rect(
                border, border + spacing,
                this.windowRect.width - border * 2, this.windowRect.height - border * 2 - height - spacing
                );

            if (this.text_style is null)
            {
                UGUI.Label(l, this.msg);
            }
            else
            {
                UGUI.Label(l, this.msg, this.text_style);
            }

            Rect b = new Rect(
                this.windowRect.width - width - border,
                this.windowRect.height - height - border,
                width,
                height);

            if ((0 == Event.current.button) && (EventType.MouseUp == Event.current.type))
            {
                this.isTicking = false;
            }

            string label = this.isTicking ? string.Format("{0}", (int)(this.seconds_to_show - this.timer)) : "OK";

            if (UGUI.Button(b, label))
            {
                Destroy(this.gameObject);
            }

            GUI.DragWindow();
        }
Beispiel #19
0
        public static void TextField(SmartRect position, Setting <int> val, string label, float offset, bool move = false)
        {
            if (offset > 0f)
            {
                UGUI.Label(position.ToRect(), label, Style.Label);
                position.MoveOffsetX(offset);
            }
            if (!integers.ContainsKey(val))
            {
                integers.Add(val, val.Value.ToString());
            }
            string text = integers[val];

            text = UGUI.TextField(position.ToRect(), text, Style.TextField);
            int.TryParse(text, out val.Value);
            integers[val] = text;
            position.ResetX();
            if (move)
            {
                position.MoveY();
            }
        }
Beispiel #20
0
 public static void LabelCenter(Rect position, string content)
 {
     UGUI.Label(position, content, Style.LabelCenter);
 }
Beispiel #21
0
 public static void Toggle(Rect position, Setting <bool> val, string label)
 {
     UGUI.Label(position, label, Style.Label);
     val.Value = UGUI.Toggle(new Rect(position.x + position.width - Style.Height, position.y, Style.Height, Style.Height), val.Value, string.Empty, Style.Toggle);
 }
Beispiel #22
0
 public static bool Toggle(Rect position, bool val, string label)
 {
     UGUI.Label(position, label, Style.Label);
     return(UGUI.Toggle(new Rect(position.x + position.width - Style.Height, position.y, Style.Height, Style.Height), val, string.Empty, Style.Toggle));
 }