Skip to content

Commit 60f62ac

Browse files
author
BlackSpiral15
committed
Added project icon and some functions
1 parent 0a1ee97 commit 60f62ac

File tree

10 files changed

+205
-31
lines changed

10 files changed

+205
-31
lines changed

Assets/Resources.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Resources/SpiralIco.bmp

12.1 KB
Binary file not shown.

Assets/Resources/SpiralIco.bmp.meta

Lines changed: 92 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Scripts/DeadScripts/SceneFile.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ private static bool IsMono(string line, bool dbg = false, ulong scriptID = 0)
430430

431431
public static void DrawSceneReloadButton()
432432
{
433-
SpiralEditor.BeginPanel(PanelType.Vertical);
433+
SpiralEditor.BeginPanel(GroupType.Vertical);
434434
if (SpiralEditor.DrawRoundButton(strSceneFile_ReuploadCurrentSceneText))
435435
{
436436
ReloadCurrentSceneFile();

Assets/Scripts/Dependencies/EditorLocalization/Localization.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public static Language language
7373
#if UNITY_EDITOR
7474
public static void DrawLanguageSelect()
7575
{
76-
SpiralEditor.BeginPanel(PanelType.Vertical);
76+
SpiralEditor.BeginPanel(GroupType.Vertical);
7777
language = (Language)EditorGUILayout.EnumPopup(strLocal, language);
7878
SpiralEditor.EndPanel();
7979
}

Assets/Scripts/Dependencies/EditorTools/SpiralCustomEditorWindow.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ private void OnEnable()
2929
protected void OpenStandartBack(Color? color = null, bool includeLogo = true, bool includeScript = true)
3030
{
3131
EditorGUILayout.Space();
32-
if (color == null) SpiralEditor.BeginPanel(PanelType.Vertical);
33-
else SpiralEditor.BeginPanel(PanelType.Vertical, (Color)color);
32+
if (color == null) SpiralEditor.BeginPanel(GroupType.Vertical);
33+
else SpiralEditor.BeginPanel(GroupType.Vertical, (Color)color);
3434
if (includeLogo) SpiralEditor.DrawLogoLine();
3535
if (includeScript) SpiralEditor.DrawEditorWindowScriptField(this);
3636
}

Assets/Scripts/Dependencies/EditorTools/SpiralEditor.cs

Lines changed: 82 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
using UnityEditor;
2121
namespace Spiral.EditorToolkit
2222
{
23-
public enum PanelType { Vertical, Horizontal }
23+
public enum GroupType { Vertical, Horizontal }
2424

2525
public static class SpiralEditor
2626
{
@@ -31,6 +31,8 @@ public static class SpiralEditor
3131
public static Color colorLightRed { get; private set; } = new Color(0.9f, 0.7f, 0.7f);
3232
public static Color colorLightGreen { get; private set; } = new Color(0.7f, 0.9f, 0.7f);
3333
public static Color colorLightBlue { get; private set; } = new Color(0.5f, 0.7f, 0.8f);
34+
public static Color colorLightYellow { get; private set; } = new Color(0.9f, 0.9f, 0.7f);
35+
public static Color colorLightOrange { get; private set; } = new Color(0.8f, 0.9f, 0.7f);
3436

3537
// PANELS ---------------------------------------------------------------------------------
3638
public static GUIStyle panel { get; private set; }
@@ -67,6 +69,45 @@ public static GUIContent GetLabel(string text, string tooltip)
6769
return output;
6870
}
6971

72+
// Buttons --------------------------------------------------------------------------------
73+
public static bool DrawRoundButton(string name, params GUILayoutOption[] options)
74+
{
75+
Color prevColor = GUI.color;
76+
GUI.color = defaultButtonColor;
77+
bool result = GUILayout.Button(name, buttonNormal, options);
78+
GUI.color = prevColor;
79+
return result;
80+
}
81+
82+
public static bool DrawRoundButton(GUIContent name, params GUILayoutOption[] options)
83+
{
84+
Color prevColor = GUI.color;
85+
GUI.color = defaultButtonColor;
86+
bool result = GUILayout.Button(name, buttonNormal, options);
87+
GUI.color = prevColor;
88+
return result;
89+
}
90+
91+
public static bool DrawRoundButton(string name, GUIStyle style, params GUILayoutOption[] options)
92+
{
93+
Color prevColor = GUI.color;
94+
GUI.color = defaultButtonColor;
95+
if (style == null) style = buttonNormal;
96+
bool result = GUILayout.Button(name, style, options);
97+
GUI.color = prevColor;
98+
return result;
99+
}
100+
101+
public static bool DrawRoundButton(GUIContent name, GUIStyle style, params GUILayoutOption[] options)
102+
{
103+
Color prevColor = GUI.color;
104+
GUI.color = defaultButtonColor;
105+
if (style == null) style = buttonNormal;
106+
bool result = GUILayout.Button(name, style, options);
107+
GUI.color = prevColor;
108+
return result;
109+
}
110+
70111
public static bool DrawRoundButton(string name, Color? color = null, params GUILayoutOption[] options)
71112
{
72113
Color prevColor = GUI.color;
@@ -85,6 +126,7 @@ public static bool DrawRoundButton(GUIContent name, Color? color = null, params
85126
return result;
86127
}
87128

129+
// Captions -------------------------------------------------------------------------------
88130
public static void DrawCaptionLabel(GUIContent content, bool selectable = false, bool small = false, params GUILayoutOption[] options)
89131
{
90132
GUIStyle style = small ? smallBoldLabel : boldLabel;
@@ -110,44 +152,61 @@ public static void DrawCaptionLabel(GUIContent content, params GUILayoutOption[]
110152
EditorGUILayout.LabelField(content, boldLabel, options);
111153
}
112154

155+
// Panels ---------------------------------------------------------------------------------
156+
private static readonly List<GroupType> panelTypesStack = new List<GroupType>();
157+
158+
public static void BeginGroup(GroupType groupType)
159+
{
160+
if (groupType == GroupType.Vertical) EditorGUILayout.BeginVertical();
161+
else EditorGUILayout.BeginHorizontal();
162+
panelTypesStack.Add(groupType);
163+
}
113164

114-
private static readonly List<PanelType> panelTypesStack = new List<PanelType>();
165+
public static void BeginGroup(GroupType groupType, Color color)
166+
{
167+
Color prevColor = GUI.color;
168+
GUI.color = color;
169+
if (groupType == GroupType.Vertical) EditorGUILayout.BeginVertical();
170+
else EditorGUILayout.BeginHorizontal();
171+
panelTypesStack.Add(groupType);
172+
GUI.color = prevColor;
173+
}
115174

116-
public static void BeginPanel(PanelType panelType, Color? color = null)
175+
public static void BeginPanel(GroupType groupType, Color? color = null)
117176
{
118177
Color prevColor = GUI.color;
119178
GUI.color = color != null ? (Color)color : defaultPanelColor;
120-
if (panelType == PanelType.Vertical) EditorGUILayout.BeginVertical(panel);
179+
if (groupType == GroupType.Vertical) EditorGUILayout.BeginVertical(panel);
121180
else EditorGUILayout.BeginHorizontal(panel);
122-
panelTypesStack.Add(panelType);
181+
panelTypesStack.Add(groupType);
123182
GUI.color = prevColor;
124183
}
125184

126185
public static void BeginPanel(string caption, bool smallCaption, params GUILayoutOption[] options)
127186
{
128-
BeginPanel(PanelType.Vertical);
187+
BeginPanel(GroupType.Vertical);
129188
GUIStyle style = smallCaption ? smallBoldLabel : boldLabel;
130189
EditorGUILayout.LabelField(caption, style, options);
131190
}
132191

133192
public static void BeginPanel(string caption, Color color, params GUILayoutOption[] options)
134193
{
135-
BeginPanel(PanelType.Vertical, color);
194+
BeginPanel(GroupType.Vertical, color);
136195
EditorGUILayout.LabelField(caption, boldLabel, options);
137196
}
138197

139198
public static void BeginPanel(string caption, bool smallCaption = false, Color? color = null, params GUILayoutOption[] options)
140199
{
141200
Color sendColor = color != null ? (Color)color : defaultPanelColor;
142-
BeginPanel(PanelType.Vertical, sendColor);
201+
BeginPanel(GroupType.Vertical, sendColor);
143202
GUIStyle style = smallCaption ? smallBoldLabel : boldLabel;
144203
EditorGUILayout.LabelField(caption, style, options);
145204
}
146205

147206
public static void BeginPanel(GUIContent caption, bool smallCaption = false, Color? color = null, params GUILayoutOption[] options)
148207
{
149208
Color sendColor = color != null ? (Color)color : defaultPanelColor;
150-
BeginPanel(PanelType.Vertical, sendColor);
209+
BeginPanel(GroupType.Vertical, sendColor);
151210
GUIStyle style = smallCaption ? smallBoldLabel : boldLabel;
152211
EditorGUILayout.LabelField(caption, style, options);
153212
}
@@ -156,18 +215,24 @@ public static void EndPanel()
156215
{
157216
if (panelTypesStack.Count == 0)
158217
{
159-
Debug.LogWarning("No panels to close");
218+
Debug.LogWarning("No panels or groups to close");
160219
return;
161220
}
162-
PanelType panelType = panelTypesStack.GetLast();
163-
if (panelType == PanelType.Vertical) EditorGUILayout.EndVertical();
221+
GroupType panelType = panelTypesStack.GetLast();
222+
if (panelType == GroupType.Vertical) EditorGUILayout.EndVertical();
164223
else EditorGUILayout.EndHorizontal();
165224
panelTypesStack.RemoveLast();
166225
}
167226

227+
public static void EndGroup()
228+
{
229+
EndPanel();
230+
}
231+
232+
// Script fields --------------------------------------------------------------------------
168233
public static void DrawScriptField(SerializedObject serializedObject)
169234
{
170-
BeginPanel(PanelType.Vertical);
235+
BeginPanel(GroupType.Vertical);
171236
SerializedProperty prop = serializedObject.FindProperty("m_Script");
172237
GUI.enabled = prop != null;
173238
EditorGUILayout.PropertyField(prop, true);
@@ -177,7 +242,7 @@ public static void DrawScriptField(SerializedObject serializedObject)
177242

178243
public static void DrawEditorScriptField(ScriptableObject editor)
179244
{
180-
BeginPanel(PanelType.Vertical);
245+
BeginPanel(GroupType.Vertical);
181246
GUI.enabled = false;
182247
Type type = editor.GetType();
183248
MonoScript monoScript = MonoScript.FromScriptableObject(editor);
@@ -195,7 +260,7 @@ public static void DrawEditorScriptField(ScriptableObject editor)
195260

196261
public static void DrawEditorWindowScriptField(ScriptableObject editor)
197262
{
198-
BeginPanel(PanelType.Vertical);
263+
BeginPanel(GroupType.Vertical);
199264
GUI.enabled = false;
200265
Type type = editor.GetType();
201266
MonoScript monoScript = MonoScript.FromScriptableObject(editor);
@@ -211,6 +276,7 @@ public static void DrawEditorWindowScriptField(ScriptableObject editor)
211276
EndPanel();
212277
}
213278

279+
// Misc -----------------------------------------------------------------------------------
214280
public static void DrawLogoLine(Color? color = null)
215281
{
216282
Color defaultColor = GUI.color;
@@ -223,7 +289,7 @@ public static void DrawLogoLine(Color? color = null)
223289

224290
public static void ShowHelp(string message, ref bool showHelp, MessageType messageType = MessageType.None)
225291
{
226-
BeginPanel(PanelType.Vertical);
292+
BeginPanel(GroupType.Vertical);
227293
EditorGUI.indentLevel += 1;
228294
string helpFoldout = showHelp ? "Hide help" : "Show help";
229295
showHelp = EditorGUILayout.Foldout(showHelp, helpFoldout);

Assets/Scripts/EditorWindows/DeadSearcherWindow.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private void OnGUI()
5353
//=========================================================================================
5454
private void DrawDebugMode()
5555
{
56-
SpiralEditor.BeginPanel(PanelType.Vertical);
56+
SpiralEditor.BeginPanel(GroupType.Vertical);
5757
DeadScripts.isDebugMode = EditorGUILayout.Toggle(strDeadScriptSearcher_DebugMode, DeadScripts.isDebugMode);
5858
if (DeadScripts.isDebugMode)
5959
{
@@ -78,9 +78,9 @@ private void DrawBoxSceneState()
7878
{
7979
SpiralEditor.BeginPanel(strSceneFileCheckout);
8080

81-
SpiralEditor.BeginPanel(PanelType.Vertical);
81+
SpiralEditor.BeginPanel(GroupType.Vertical);
8282

83-
SpiralEditor.BeginPanel(PanelType.Horizontal);
83+
SpiralEditor.BeginPanel(GroupType.Horizontal);
8484
GUIStyle styleSceneIsDirty = new GUIStyle(SpiralEditor.boldLabel);
8585
string sceneIsDirty = DeadScripts.isDirty ?
8686
strSceneWasChanged :
@@ -89,7 +89,7 @@ private void DrawBoxSceneState()
8989
EditorGUILayout.LabelField(sceneIsDirty, styleSceneIsDirty);
9090
SpiralEditor.EndPanel();
9191

92-
SpiralEditor.BeginPanel(PanelType.Vertical);
92+
SpiralEditor.BeginPanel(GroupType.Vertical);
9393
EditorGUI.indentLevel += 1;
9494
foldoutSceneSearchHelp = EditorGUILayout.Foldout(foldoutSceneSearchHelp,
9595
strShowHelp,
@@ -146,7 +146,7 @@ private void ShowDeadGUIDs()
146146
private void DrawDeadGUIDEntry(ComponentGUID dead)
147147
{
148148
GUILayoutOption labelOption = GUILayout.Height(20);
149-
SpiralEditor.BeginPanel(PanelType.Vertical);
149+
SpiralEditor.BeginPanel(GroupType.Vertical);
150150

151151
EditorGUILayout.SelectableLabel($"GUID: {dead.guid}", GUILayout.MinWidth(250), labelOption);
152152

@@ -168,7 +168,7 @@ private void DrawDeadGUIDEntry(ComponentGUID dead)
168168
}
169169
if (dgid.showInfo)
170170
{
171-
SpiralEditor.BeginPanel(PanelType.Vertical);
171+
SpiralEditor.BeginPanel(GroupType.Vertical);
172172
EditorGUILayout.SelectableLabel(strGID);
173173
if (SpiralEditor.DrawRoundButton(strSelectObject))
174174
{

Assets/Scripts/EditorWindows/ObjectAuditorWindow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ private void DrawComponentList(ObjectID oid)
132132
for (int comIDX = 0; comIDX < oid.componentIDs.Count; comIDX++)
133133
{
134134
var cid = oid.componentIDs[comIDX];
135-
SpiralEditor.BeginPanel(PanelType.Vertical, cid.alive ? colorNormal : colorAlert);
135+
SpiralEditor.BeginPanel(GroupType.Vertical, cid.alive ? colorNormal : colorAlert);
136136

137137
ulong fileID = oid.componentFileIDs[comIDX]; // соответствует cid.fileID
138138
string guid = oid.componentGUIDs[comIDX];

0 commit comments

Comments
 (0)