Esempio n. 1
0
        public static float BombStatSlider(SmartRect position, float value, string label, float offset, float step, float min, float max, bool move = true)
        {
            if (offset > 0f)
            {
                UnityEngine.GUI.Label(position.ToRect(), label, Style.Label);
                position.MoveOffsetX(offset);
            }

            value = UnityEngine.GUI.HorizontalSlider(position.ToRect(), value, min, max, Style.Slider, Style.SliderBody);
            position.ResetX();
            if (move)
            {
                position.MoveY();
            }

            if (step == 0.5f)
            {
                int   low  = Mathf.FloorToInt(value);
                float diff = value - low;
                if (diff >= 0.25f && diff < 0.75f)
                {
                    return(low + 0.5f);
                }
                else
                {
                    return(Mathf.RoundToInt(value));
                }
            }
            else
            {
                return((int)value);
            }
        }
Esempio n. 2
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();
     }
 }
Esempio n. 3
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();
     }
 }
Esempio n. 4
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);
 }
Esempio n. 5
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);
 }
Esempio n. 6
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();
     }
 }
Esempio n. 7
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();
     }
 }
Esempio n. 8
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);
 }
Esempio n. 9
0
        private bool PauseButton(SmartRect rect, string key)
        {
            bool res = UnityEngine.GUI.Button(rect.ToRect(), locale[key], pauseStyle);

            rect.MoveY();
            return(res);
        }
Esempio n. 10
0
 public static void LabelCenter(SmartRect position, string content, bool move = false)
 {
     UGUI.Label(position.ToRect(), content, Style.LabelCenter);
     if (move)
     {
         position.MoveY();
     }
 }
Esempio n. 11
0
 public static void Box(SmartRect position, string text, bool move = true)
 {
     UGUI.Box(position.ToRect(), text, Style.Box);
     if (move)
     {
         position.MoveY();
     }
 }
Esempio n. 12
0
 public static void DrawTexture(SmartRect position, Texture tex, bool move = false)
 {
     UGUI.DrawTexture(position.ToRect(), tex);
     if (move)
     {
         position.MoveY();
     }
 }
Esempio n. 13
0
 public static Vector2 BeginScrollView(SmartRect position, Vector2 scrollView, Rect viewRect, bool alwaysHorizontal, bool alwaysVertical, bool move = false)
 {
     scrollView = UGUI.BeginScrollView(position.ToRect(), scrollView, viewRect, alwaysHorizontal, alwaysVertical, Style.ScrollView, Style.ScrollView);
     if (move)
     {
         position.MoveY();
     }
     return(scrollView);
 }
Esempio n. 14
0
        public static bool Button(SmartRect position, string text, bool move = true)
        {
            bool value = UGUI.Button(position.ToRect(), text, Style.Button);

            if (move)
            {
                position.MoveY();
            }
            return(value);
        }
Esempio n. 15
0
 public static void DropdownMenuScrollable(GUIBase baseGUI, SmartRect rect, Setting <int> selection, string[] selections, int showItems, bool move = true)
 {
     if (Button(rect, selections[selection.Value], false))
     {
         ScrollableDropdownSelection.CreateNew(baseGUI, rect.ToRect(), selections, selection, showItems);
     }
     if (move)
     {
         rect.MoveY();
     }
 }
Esempio n. 16
0
 public static void DropdownMenu(SmartRect rect, Setting <int> selection, string[] selections, bool move = true)
 {
     if (Button(rect, selections[selection.Value], false))
     {
         DropdownSelection.CreateNew(rect.ToRect(), selections, selection);
     }
     if (move)
     {
         rect.MoveY();
     }
 }
Esempio n. 17
0
        private bool Button(string key)
        {
            if (rect == null)
            {
                return(false);
            }
            bool result = UnityEngine.GUI.Button(rect.ToRect(), locale.Get(key), style);

            rect.MoveY();
            return(result);
        }
Esempio n. 18
0
        private void LogicPage()
        {
            LabelCenter(left, locale["logicScript"], true);
            left.height = (BoxPosition.y + BoxPosition.height - Style.WindowBottomOffset - Style.Height - Style.VerticalMargin) - left.y;
            CustomLevel.currentScriptLogic = UnityEngine.GUI.TextArea(left.ToRect(), CustomLevel.currentScriptLogic, areaStyle);

            rect.MoveToEndY(BoxPosition, Style.Height);
            rect.width  = 144f;
            rect.height = Style.Height;
            if (Button(rect, locale["btnClear"], false))
            {
                CustomLevel.currentScriptLogic = "";
            }

            rect.MoveToEndX(BoxPosition, 144f);
            if (Button(rect, locale["btnClose"]))
            {
                Disable();
                return;
            }
        }
Esempio n. 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();
            }
        }
Esempio n. 20
0
        public static void SelectionGrid(SmartRect position, Setting <int> value, string[] labels, int xCount, bool move = false)
        {
            float old   = position.height;
            int   koeff = (int)(labels.Length / xCount);

            position.height = (old * koeff) + (Style.VerticalMargin * koeff - Style.VerticalMargin);
            value.Value     = UGUI.SelectionGrid(position.ToRect(), value.Value, labels, xCount, Style.SelectionGrid);
            if (move)
            {
                position.MoveY();
            }
            position.height = old;
        }
Esempio n. 21
0
 public static void DropdownMenuScrollable(GUIBase baseGUI, SmartRect rect, Setting <int> selection, string[] selections, string label, float horizontalOffest, int showItems, bool move = true)
 {
     Label(rect, label, false);
     rect.MoveOffsetX(horizontalOffest);
     if (Button(rect, selections[selection.Value], false))
     {
         ScrollableDropdownSelection.CreateNew(baseGUI, rect.ToRect(), selections, selection, showItems);
     }
     rect.ResetX();
     if (move)
     {
         rect.MoveY();
     }
 }
Esempio n. 22
0
 public static void DropdownMenu(SmartRect rect, Setting <int> selection, string[] selections, string label, float horizontalOffest, bool move = true)
 {
     Label(rect, label, false);
     rect.MoveOffsetX(horizontalOffest);
     if (Button(rect, selections[selection.Value], false))
     {
         DropdownSelection.CreateNew(rect.ToRect(), selections, selection);
     }
     rect.ResetX();
     if (move)
     {
         rect.MoveY();
     }
 }
Esempio n. 23
0
 public static void BeginArea(SmartRect rect, string text)
 {
     UGUI.BeginArea(rect.ToRect(), text);
 }
Esempio n. 24
0
 public static void BeginArea(SmartRect rect)
 {
     UGUI.BeginArea(rect.ToRect());
 }