private void DrawSlotList() { GUILayout.BeginArea(new Rect(5.0f, 25.0f, position.width - 10.0f, position.height - 25.0f)); // 20.0f + (slots.count * 20.0f) GUILayout.Label("Load with double click"); scroll = GUILayout.BeginScrollView(scroll); slots.DoLayoutList(); GUILayout.EndScrollView(); if (slots.index >= 0 && slots.index < SceneViewPlus.slotsList.Count) { GUILayout.FlexibleSpace(); GUILayout.BeginVertical((GUIStyle)"HelpBox"); GUI.SetNextControlName("SaveName"); SceneViewPlus.slotsList[slots.index].name = EditorGUILayout.TextField(new GUIContent("Name"), SceneViewPlus.slotsList[slots.index].name); SceneViewPlus.slotsList[slots.index].in2DMode = EditorGUILayout.Toggle(new GUIContent("In 2D Mode"), SceneViewPlus.slotsList[slots.index].in2DMode); SceneViewPlus.slotsList[slots.index].audio = EditorGUILayout.Toggle(new GUIContent("Audio"), SceneViewPlus.slotsList[slots.index].audio); SceneViewPlus.slotsList[slots.index].lighting = EditorGUILayout.Toggle(new GUIContent("Lighting"), SceneViewPlus.slotsList[slots.index].lighting); SceneViewPlus.slotsList[slots.index].wireframe = EditorGUILayout.Toggle(new GUIContent("Wireframe"), SceneViewPlus.slotsList[slots.index].wireframe); SceneViewPlus.slotsList[slots.index].orthographic = EditorGUILayout.Toggle(new GUIContent("Orthographic"), SceneViewPlus.slotsList[slots.index].orthographic); SceneViewPlus.slotsList[slots.index].save_selection = EditorGUILayout.Toggle(new GUIContent("Save Selection"), SceneViewPlus.slotsList[slots.index].save_selection); if (GUI.changed) { SceneViewPlus.SaveData(); } GUILayout.EndVertical(); GUILayout.Space(5.0f); } GUILayout.EndArea(); }
public void GroupList() { groups = new ReorderableList(SceneViewPlus.groupsList, typeof(List <SceneViewPlus.GroupSlot>)); groups.drawHeaderCallback = (Rect rect) => { GUI.Label(rect, "Object Group"); }; groups.onChangedCallback = (ReorderableList list) => { SceneViewPlus.Repaint(); SceneViewPlus.SaveData(); }; groups.onAddCallback = (ReorderableList list) => { SceneViewPlus.SaveCurrentGroup(); GUI.FocusControl("Group Name"); groups.index = groups.count - 1; }; groups.onRemoveCallback = (ReorderableList list) => { ReorderableList.defaultBehaviours.DoRemoveButton(list); SceneViewPlus.SaveData(); SceneViewPlus.Repaint(); }; groups.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => { if (current.clickCount >= 2) { if (rect.Contains(current.mousePosition)) { SceneViewPlus.LoadGroup(index); EditorApplication.RepaintHierarchyWindow(); current.Use(); } } DrawStrip(rect, index); rect.y += 2.0f; GUI.Label(rect, SceneViewPlus.groupsList[index].name); Rect button = new Rect(rect) { position = new Vector2(position.width - 45.0f, rect.y), size = new Vector2(18.0f, 18.0f) }; SceneViewPlus.groupsList[index].label %= 8; Texture2D icon = labels[SceneViewPlus.groupsList[index].label]; if (GUI.Button(button, new GUIContent(icon, "Group Icon"), GUI.skin.label)) { SceneViewPlus.groupsList[index].label++; SceneViewPlus.SaveData(); } }; }
private void DrawGroupList() { GUILayout.BeginArea(new Rect(5.0f, 25.0f, position.width - 10.0f, position.height - 25.0f)); GUILayout.Label("Select whole group with double click"); scroll = GUILayout.BeginScrollView(scroll); groups.DoLayoutList(); GUILayout.EndScrollView(); if (groups.index >= 0 && groups.index < SceneViewPlus.groupsList.Count) { GUILayout.FlexibleSpace(); GUILayout.BeginVertical((GUIStyle)"HelpBox"); GUI.SetNextControlName("Group Name"); SceneViewPlus.groupsList[groups.index].name = EditorGUILayout.TextField(new GUIContent("Name"), SceneViewPlus.groupsList[groups.index].name); if (GUI.changed) { SceneViewPlus.SaveData(); } GUILayout.EndVertical(); GUILayout.Space(5.0f); } GUILayout.EndArea(); }
public void SlotList() { slots = new ReorderableList(SceneViewPlus.slotsList, typeof(List <SceneViewPlus.ViewSlot>)); slots.drawHeaderCallback = (Rect rect) => { GUI.Label(rect, "SceneView"); }; slots.onChangedCallback = (ReorderableList list) => { SceneViewPlus.Repaint(); SceneViewPlus.SaveData(); }; slots.onAddCallback = (ReorderableList list) => { SceneViewPlus.SaveCurrentView(); GUI.FocusControl("SaveName"); slots.index = slots.count - 1; }; slots.onRemoveCallback = (ReorderableList list) => { ReorderableList.defaultBehaviours.DoRemoveButton(list); SceneViewPlus.SaveData(); SceneViewPlus.Repaint(); }; slots.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => { if (current.clickCount >= 2) { if (rect.Contains(current.mousePosition)) { SceneViewPlus.LoadView(index); current.Use(); } } DrawStrip(rect, index); rect.y += 2; GUI.Label(new Rect(rect), SceneViewPlus.slotsList[index].name); // GUI.Label(new Rect(rect.x, rect.y, rect.width, rect.height), SceneViewPlus.slotsList[index].name); }; }
public static void ResetData() { EditorPrefs.DeleteKey(dataPref); SceneViewPlus.SaveData(); }