static void PrefabSelectionSpecificUI(float width) { EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); switch (clickAction) { case ClickAction.SetAsCurrent: { GUILayout.FlexibleSpace(); if (PrefabManager.currentPrefab != null) { Texture2D texture; SpriteManager.spriteTextures.TryGetValue(PrefabManager.currentPrefab.spriteName, out texture); GUILayout.Button(texture, GUILayout.Width(texture.width + buttonPadding), GUILayout.Height(texture.height + buttonPadding)); } GUILayout.FlexibleSpace(); break; } case ClickAction.ChangeSetId: { GUILayout.Label("Set ID: "); nextSetId = EditorGUILayout.IntField(nextSetId); if (GUILayout.Button("Get Next")) { nextSetId = PrefabManager.prefabs.Max(p => p.Value.setId) + 1; } break; } case ClickAction.ChangeType: { nextPrefabType = (PrefabType)EditorGUILayout.EnumPopup("Prefab Type ", nextPrefabType); break; } case ClickAction.ChangeCategory: { nextPrefabCategory = (PrefabCategory)EditorGUILayout.EnumPopup("Prefab Category ", nextPrefabCategory); break; } case ClickAction.ChangeColor: { nextPrefabColor = (PrefabColor)EditorGUILayout.EnumPopup("Prefab Color ", nextPrefabColor); break; } } EditorGUILayout.EndHorizontal(); }
static void PrefabViewFilterUI(float width) { EditorGUILayout.BeginHorizontal(); GUILayout.Label("Type:", GUILayout.Width(65f)); typeFilter = (PrefabType)EditorGUILayout.EnumPopup(typeFilter, GUILayout.Width(90f)); if (GUILayout.Button("Reset", GUILayout.Width(45f))) { categoryFilter = PrefabCategory.Any; } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Label("Category:", GUILayout.Width(65f)); categoryFilter = (PrefabCategory)EditorGUILayout.EnumPopup(categoryFilter, GUILayout.Width(90f)); if (GUILayout.Button("Reset", GUILayout.Width(45f))) { categoryFilter = PrefabCategory.Any; } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Label("Color:", GUILayout.Width(65f)); colorFilter = (PrefabColor)EditorGUILayout.EnumPopup(colorFilter, GUILayout.Width(90f)); if (GUILayout.Button("Reset", GUILayout.Width(45f))) { colorFilter = PrefabColor.Any; } EditorGUILayout.EndHorizontal(); }
public void OnGUI() { if (selectionList == null || selectionList.Count <= 0) { this.Close(); } GUILayout.Label("Sprites in selection: " + selectionList.Count()); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("<", GUILayout.Width(30f))) { selectionIndex--; } if (GUILayout.Button(">", GUILayout.Width(30f))) { selectionIndex++; } GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); selectionNode = selectionList[Mathf.Abs(selectionIndex) % selectionList.Count]; GUILayout.Button(selectionNode.Value, GUILayout.Width(selectionNode.Value.width), GUILayout.Height(selectionNode.Value.height)); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label(selectionNode.Key); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); nextSetId = EditorGUILayout.IntField("Set ID: ", nextSetId); if (GUILayout.Button("Get Next ID", GUILayout.Width(85f))) { nextSetId = GetNextSetID(); } EditorGUILayout.EndHorizontal(); nextPrefabType = (PrefabType)EditorGUILayout.EnumPopup("Type: ", nextPrefabType); nextPrefabCategory = (PrefabCategory)EditorGUILayout.EnumPopup("Prefab Category: ", nextPrefabCategory); nextPrefabColor = (PrefabColor)EditorGUILayout.EnumPopup("Prefab Color: ", nextPrefabColor); hasBoxCollider = EditorGUILayout.Toggle("BoxCollider2D", hasBoxCollider); isTrigger = EditorGUILayout.Toggle("isTrigger", isTrigger); EditorGUILayout.Space(); EditorGUILayout.Space(); if (hasError) { GUIStyle style = new GUIStyle(EditorStyles.label); style.normal.textColor = Color.red; foreach (var error in errorText) { EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label(error, style); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); } } if (hasCompleted) { EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUIStyle style = new GUIStyle(EditorStyles.label); style.normal.textColor = Color.blue; GUILayout.Label(completionText, style); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); } EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Make", GUILayout.Width(50f))) { Make(); } if (GUILayout.Button("Close", GUILayout.Width(50f))) { this.Close(); } EditorGUILayout.EndHorizontal(); }