diff options
| author | Andrew Lee <alee14498@gmail.com> | 2019-11-03 18:31:04 -0500 |
|---|---|---|
| committer | Andrew Lee <alee14498@gmail.com> | 2019-11-03 18:31:04 -0500 |
| commit | e8dd5d4fd406e6e6b710cbe85309f6870bccc37a (patch) | |
| tree | db0e99cfdbefb1625d66d07631f43565ae8ff41f /Assets/Packages/RTS_Camera/Scripts/Editor/LayoutHelpers.cs | |
| parent | 20b14c9a89821e6592bf25bed9329a5abe20495c (diff) | |
| download | Unicity-e8dd5d4fd406e6e6b710cbe85309f6870bccc37a.tar.gz Unicity-e8dd5d4fd406e6e6b710cbe85309f6870bccc37a.tar.bz2 Unicity-e8dd5d4fd406e6e6b710cbe85309f6870bccc37a.zip | |
Remove everything
Diffstat (limited to 'Assets/Packages/RTS_Camera/Scripts/Editor/LayoutHelpers.cs')
| -rw-r--r-- | Assets/Packages/RTS_Camera/Scripts/Editor/LayoutHelpers.cs | 108 |
1 files changed, 0 insertions, 108 deletions
diff --git a/Assets/Packages/RTS_Camera/Scripts/Editor/LayoutHelpers.cs b/Assets/Packages/RTS_Camera/Scripts/Editor/LayoutHelpers.cs deleted file mode 100644 index 2c41a09..0000000 --- a/Assets/Packages/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 |
