diff options
| author | Alee <Alee14498@gmail.com> | 2019-05-31 20:34:40 -0400 |
|---|---|---|
| committer | Alee <Alee14498@gmail.com> | 2019-05-31 20:34:40 -0400 |
| commit | 1a218e49d6c23b0d1da5c30d81784ea9d8350016 (patch) | |
| tree | c9470c471ea23e377fa69ad74fe4ef459ebc2a4a /Assets/RTS_Camera/Scripts/Editor/LayoutHelpers.cs | |
| parent | 15c23e28f3bd5ac8015cb93df034a1196031d97b (diff) | |
| download | Unicity-1a218e49d6c23b0d1da5c30d81784ea9d8350016.tar.gz Unicity-1a218e49d6c23b0d1da5c30d81784ea9d8350016.tar.bz2 Unicity-1a218e49d6c23b0d1da5c30d81784ea9d8350016.zip | |
UI changesexperimental-1
Diffstat (limited to 'Assets/RTS_Camera/Scripts/Editor/LayoutHelpers.cs')
| -rw-r--r-- | Assets/RTS_Camera/Scripts/Editor/LayoutHelpers.cs | 108 |
1 files changed, 0 insertions, 108 deletions
diff --git a/Assets/RTS_Camera/Scripts/Editor/LayoutHelpers.cs b/Assets/RTS_Camera/Scripts/Editor/LayoutHelpers.cs deleted file mode 100644 index 2c41a09..0000000 --- a/Assets/RTS_Camera/Scripts/Editor/LayoutHelpers.cs +++ /dev/null @@ -1,108 +0,0 @@ -using UnityEngine; -using System; -using System.Collections.Generic; -using UnityEditor; -using System.Linq; - - -public class VerticalBlock : IDisposable -{ - public VerticalBlock(params GUILayoutOption[] options) - { - GUILayout.BeginVertical(options); - } - - public VerticalBlock(GUIStyle style, params GUILayoutOption[] options) - { - GUILayout.BeginVertical(style, options); - } - - public void Dispose() - { - GUILayout.EndVertical(); - } -} - -public class ScrollviewBlock : IDisposable -{ - public ScrollviewBlock(ref Vector2 scrollPos, params GUILayoutOption[] options) - { - scrollPos = GUILayout.BeginScrollView(scrollPos, options); - } - - public void Dispose() - { - GUILayout.EndScrollView(); - } -} - -public class HorizontalBlock : IDisposable -{ - public HorizontalBlock(params GUILayoutOption[] options) - { - GUILayout.BeginHorizontal(options); - } - - public HorizontalBlock(GUIStyle style, params GUILayoutOption[] options) - { - GUILayout.BeginHorizontal(style, options); - } - - public void Dispose() - { - GUILayout.EndHorizontal(); - } -} - -public class ColoredBlock : System.IDisposable -{ - public ColoredBlock(Color color) - { - GUI.color = color; - } - - public void Dispose() - { - GUI.color = Color.white; - } -} - -[Serializable] -public class TabsBlock -{ - private Dictionary<string, Action> methods; - private Action currentGuiMethod; - public int curMethodIndex = -1; - - public TabsBlock(Dictionary<string, Action> _methods) - { - methods = _methods; - SetCurrentMethod(0); - } - - public void Draw() - { - var keys = methods.Keys.ToArray(); - using (new VerticalBlock(EditorStyles.helpBox)) - { - using (new HorizontalBlock()) - { - for (int i = 0; i < keys.Length; i++) - { - var btnStyle = i == 0 ? EditorStyles.miniButtonLeft : i == (keys.Length - 1) ? EditorStyles.miniButtonRight : EditorStyles.miniButtonMid; - using (new ColoredBlock(currentGuiMethod == methods[keys[i]] ? Color.grey : Color.white)) - if (GUILayout.Button(keys[i], btnStyle)) - SetCurrentMethod(i); - } - } - GUILayout.Label(keys[curMethodIndex], EditorStyles.centeredGreyMiniLabel); - currentGuiMethod(); - } - } - - public void SetCurrentMethod(int index) - { - curMethodIndex = index; - currentGuiMethod = methods[methods.Keys.ToArray()[index]]; - } -}
\ No newline at end of file |
