Initial commit
This commit is contained in:
1 parent
ee9615239e
commit
16feac691f
4093 files changed
+1030491
No files matched your search
+1206
File diff suppressed because it is too large.
Load diff
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 90d11c9154f1cea46bc91709ce3da22f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,91 @@
|
||||
using PWCommon4;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Gaia
|
||||
{
|
||||
//This class is not a full editor class by itself, but used to collect reusable methods
|
||||
//for editing Biomes in a reorderable list.
|
||||
public class BiomeListEditor : PWEditor, IPWEditor
|
||||
{
|
||||
|
||||
public static float OnElementHeight()
|
||||
{
|
||||
return EditorGUIUtility.singleLineHeight;
|
||||
}
|
||||
|
||||
public static void DrawListHeader(Rect rect, bool currentFoldOutState, List<AdvancedTabBiomeListEntry> biomesList, EditorUtils editorUtils, string headerKey)
|
||||
{
|
||||
int oldIndent = EditorGUI.indentLevel;
|
||||
EditorGUI.indentLevel = 0;
|
||||
//rect.xMin += 0f;
|
||||
EditorGUI.LabelField(rect, editorUtils.GetContent(headerKey));
|
||||
//bool newFoldOutState = EditorGUI.Foldout(rect, currentFoldOutState, PropertyCount("SpawnerAdded", spawnerList, editorUtils), true);
|
||||
EditorGUI.indentLevel = oldIndent;
|
||||
//return newFoldOutState;
|
||||
}
|
||||
|
||||
public static void DrawListElement_AdvancedTab(Rect rect, AdvancedTabBiomeListEntry listEntry, EditorUtils m_editorUtils)
|
||||
{
|
||||
int oldIndent = EditorGUI.indentLevel;
|
||||
EditorGUI.indentLevel = 0;
|
||||
|
||||
|
||||
Rect labelRect = rect;
|
||||
//260 is the total width of the controls at the end of each row
|
||||
labelRect.width = rect.width -280;
|
||||
labelRect.height = EditorGUIUtility.singleLineHeight;
|
||||
|
||||
EditorGUI.LabelField(labelRect, listEntry.m_biomePreset.name);
|
||||
|
||||
EditorGUIUtility.AddCursorRect(labelRect, MouseCursor.Zoom);
|
||||
if (labelRect.Contains(Event.current.mousePosition) && Event.current.clickCount>0)
|
||||
{
|
||||
Selection.activeObject = listEntry.m_biomePreset;
|
||||
EditorGUIUtility.PingObject(Selection.activeObject);
|
||||
}
|
||||
|
||||
labelRect.x = rect.width - 230;
|
||||
labelRect.width = 110f;
|
||||
|
||||
EditorGUI.LabelField(labelRect, m_editorUtils.GetContent("SpawnerListAutoAssignPrototypes"));
|
||||
|
||||
labelRect.x = rect.width - 130f;
|
||||
labelRect.width = 20f;
|
||||
|
||||
listEntry.m_autoAssignPrototypes = EditorGUI.Toggle(labelRect, listEntry.m_autoAssignPrototypes);
|
||||
|
||||
labelRect.x = rect.width - 80f;
|
||||
labelRect.width = 100f;
|
||||
if (GUI.Button(labelRect, m_editorUtils.GetContent("AdvancedTabAddBiome")))
|
||||
{
|
||||
BiomeController newBiome = listEntry.m_biomePreset.CreateBiome(listEntry.m_autoAssignPrototypes);
|
||||
Selection.activeGameObject = newBiome.gameObject;
|
||||
}
|
||||
|
||||
|
||||
EditorGUI.indentLevel = oldIndent;
|
||||
}
|
||||
|
||||
public static void DrawListElement(Rect rect, BiomeSpawnerListEntry listEntry, EditorUtils m_editorUtils)
|
||||
{
|
||||
int oldIndent = EditorGUI.indentLevel;
|
||||
EditorGUI.indentLevel = 0;
|
||||
listEntry.m_spawnerSettings = (SpawnerSettings)EditorGUI.ObjectField(new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight), listEntry.m_spawnerSettings, typeof(SpawnerSettings), false);
|
||||
EditorGUI.indentLevel = oldIndent;
|
||||
}
|
||||
|
||||
public static GUIContent PropertyCount(string key, List<BiomeSpawnerListEntry> list, EditorUtils editorUtils)
|
||||
{
|
||||
GUIContent content = editorUtils.GetContent(key);
|
||||
content.text += " [" + list.Count + "]";
|
||||
return content;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 765621075a226334394984725e5c273e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,157 @@
|
||||
using Gaia.Internal;
|
||||
using PWCommon4;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
#if UNITY_POST_PROCESSING_STACK_V2
|
||||
using UnityEngine.Rendering.PostProcessing;
|
||||
#endif
|
||||
|
||||
namespace Gaia
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Editor for Biome Preset settings, only offers a text & a button to create the spawner in the scene
|
||||
/// If the user wants to edit or create new spawner settings, they can do so by saving a spawner settings file from a spawner directly.
|
||||
/// </summary>
|
||||
[CustomEditor(typeof(BiomePreset))]
|
||||
public class BiomePresetEditor : PWEditor
|
||||
{
|
||||
private EditorUtils m_editorUtils;
|
||||
private BiomePreset m_biomePreset;
|
||||
private UnityEditorInternal.ReorderableList m_spawnerPresetList;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
m_biomePreset = (BiomePreset)target;
|
||||
//Init editor utils
|
||||
if (m_editorUtils == null)
|
||||
{
|
||||
// Get editor utils for this
|
||||
m_editorUtils = PWApp.GetEditorUtils(this);
|
||||
}
|
||||
m_biomePreset.RefreshSpawnerListEntries();
|
||||
CreateSpawnerPresetList();
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
m_editorUtils.Initialize(); // Do not remove this!
|
||||
m_biomePreset = (BiomePreset)target;
|
||||
serializedObject.Update();
|
||||
|
||||
m_editorUtils.Panel("BiomeSettings", DrawBiomeSettings,true);
|
||||
|
||||
if (GUILayout.Button(m_editorUtils.GetContent("AddToScene")))
|
||||
{
|
||||
BiomeController newBiome = m_biomePreset.CreateBiome(true);
|
||||
Selection.activeGameObject = newBiome.gameObject;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void DrawBiomeSettings(bool helpEnabled)
|
||||
{
|
||||
m_biomePreset.m_orderNumber = m_editorUtils.IntField("OrderNumber", m_biomePreset.m_orderNumber, helpEnabled);
|
||||
Rect listRect = EditorGUILayout.GetControlRect(true, m_spawnerPresetList.GetHeight());
|
||||
m_spawnerPresetList.DoList(listRect);
|
||||
m_editorUtils.InlineHelp("SpawnerAdded", helpEnabled);
|
||||
|
||||
|
||||
if (m_biomePreset.m_spawnerPresetList.Count == 0)
|
||||
{
|
||||
GUILayout.Space(EditorGUIUtility.singleLineHeight);
|
||||
EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("NoSpawnersYet"), MessageType.Warning);
|
||||
GUILayout.Space(10);
|
||||
if (m_editorUtils.Button("CreateFirstSpawner"))
|
||||
{
|
||||
GameObject spawnerObj = new GameObject("New Spawner");
|
||||
Spawner spawner = spawnerObj.AddComponent<Spawner>();
|
||||
spawner.m_createdfromBiomePreset = true;
|
||||
Selection.activeGameObject = spawnerObj;
|
||||
}
|
||||
GUILayout.Space(20);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Space(10);
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.FlexibleSpace();
|
||||
if (m_editorUtils.Button("CreateAdditionalSpawner",GUILayout.MaxWidth(200)))
|
||||
{
|
||||
GameObject spawnerObj = new GameObject("New Spawner");
|
||||
Spawner spawner = spawnerObj.AddComponent<Spawner>();
|
||||
spawner.m_createdfromBiomePreset = true;
|
||||
Selection.activeGameObject = spawnerObj;
|
||||
}
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
GUILayout.Space(EditorGUIUtility.singleLineHeight);
|
||||
m_biomePreset.GaiaSceneCullingProfile = (GaiaSceneCullingProfile)m_editorUtils.ObjectField("GaiaSceneCullingProfile", m_biomePreset.GaiaSceneCullingProfile, typeof(GaiaSceneCullingProfile), false, helpEnabled);
|
||||
|
||||
#if UNITY_POST_PROCESSING_STACK_V2
|
||||
GUILayout.Space(EditorGUIUtility.singleLineHeight);
|
||||
m_biomePreset.postProcessProfile = (PostProcessProfile)m_editorUtils.ObjectField("PostProcessingProfile", m_biomePreset.postProcessProfile, typeof(PostProcessProfile), false, helpEnabled);
|
||||
#endif
|
||||
GUILayout.Space(EditorGUIUtility.singleLineHeight);
|
||||
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
EditorUtility.SetDirty(m_biomePreset);
|
||||
}
|
||||
|
||||
#region Spawner Preset List
|
||||
|
||||
void CreateSpawnerPresetList()
|
||||
{
|
||||
m_spawnerPresetList = new UnityEditorInternal.ReorderableList(m_biomePreset.m_spawnerPresetList, typeof(BiomeSpawnerListEntry), true, true, true, true);
|
||||
m_spawnerPresetList.elementHeightCallback = OnElementHeightSpawnerPresetListEntry;
|
||||
m_spawnerPresetList.drawElementCallback = DrawSpawnerPresetListElement;
|
||||
m_spawnerPresetList.drawHeaderCallback = DrawSpawnerPresetListHeader;
|
||||
m_spawnerPresetList.onAddCallback = OnAddSpawnerPresetListEntry;
|
||||
m_spawnerPresetList.onRemoveCallback = OnRemoveSpawnerPresetListEntry;
|
||||
m_spawnerPresetList.onReorderCallback = OnReorderSpawnerPresetList;
|
||||
}
|
||||
|
||||
private void OnReorderSpawnerPresetList(ReorderableList list)
|
||||
{
|
||||
//Do nothing, changing the order does not immediately affect anything in this window
|
||||
}
|
||||
|
||||
private void OnRemoveSpawnerPresetListEntry(ReorderableList list)
|
||||
{
|
||||
m_biomePreset.m_spawnerPresetList = SpawnerPresetListEditor.OnRemoveListEntry(m_biomePreset.m_spawnerPresetList, m_spawnerPresetList.index);
|
||||
list.list = m_biomePreset.m_spawnerPresetList;
|
||||
}
|
||||
|
||||
private void OnAddSpawnerPresetListEntry(ReorderableList list)
|
||||
{
|
||||
m_biomePreset.m_spawnerPresetList = SpawnerPresetListEditor.OnAddListEntry(m_biomePreset.m_spawnerPresetList);
|
||||
list.list = m_biomePreset.m_spawnerPresetList;
|
||||
}
|
||||
|
||||
private void DrawSpawnerPresetListHeader(Rect rect)
|
||||
{
|
||||
SpawnerPresetListEditor.DrawListHeader(rect, true, m_biomePreset.m_spawnerPresetList, m_editorUtils, "SpawnerAdded");
|
||||
}
|
||||
|
||||
private void DrawSpawnerPresetListElement(Rect rect, int index, bool isActive, bool isFocused)
|
||||
{
|
||||
SpawnerPresetListEditor.DrawListElement(rect, m_biomePreset.m_spawnerPresetList[index], m_editorUtils);
|
||||
}
|
||||
|
||||
private float OnElementHeightSpawnerPresetListEntry(int index)
|
||||
{
|
||||
return SpawnerPresetListEditor.OnElementHeight();
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 052ba5ee911edda4892967f51a6b2f6d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,66 @@
|
||||
using Gaia.Internal;
|
||||
using PWCommon4;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Gaia
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Editor for Spawner settings, only offers a text & a button to create the spawner in the scene
|
||||
/// If the user wants to edit or create new spawner settings, they can do so by saving a spawner settings file from a spawner directly.
|
||||
/// </summary>
|
||||
[CustomEditor(typeof(SpawnerSettings))]
|
||||
public class SpawnerSettingsEditor : PWEditor
|
||||
{
|
||||
private EditorUtils m_editorUtils;
|
||||
private SpawnerSettings m_spawnerSettings;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
//Init editor utils
|
||||
if (m_editorUtils == null)
|
||||
{
|
||||
// Get editor utils for this
|
||||
m_editorUtils = PWApp.GetEditorUtils(this);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
m_editorUtils.Initialize(); // Do not remove this!
|
||||
m_spawnerSettings = (SpawnerSettings)target;
|
||||
|
||||
string message = m_editorUtils.GetTextValue("Intro"); ;
|
||||
EditorGUILayout.HelpBox(message, MessageType.Info, true);
|
||||
|
||||
if (GUILayout.Button(m_editorUtils.GetContent("AddToScene")))
|
||||
{
|
||||
m_spawnerSettings.CreateSpawner();
|
||||
}
|
||||
|
||||
GUILayout.Label(m_editorUtils.GetContent("SpawnRulePreview"), m_editorUtils.Styles.heading);
|
||||
|
||||
GaiaResource resource = m_spawnerSettings.m_resources;// (GaiaResource)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(m_spawnerSettings.m_resourcesGUID), typeof(GaiaResource));
|
||||
|
||||
foreach (SpawnRule rule in m_spawnerSettings.m_spawnerRules)
|
||||
{
|
||||
m_editorUtils.LabelField("Name", new GUIContent(rule.m_name));
|
||||
m_editorUtils.LabelField("Type", new GUIContent(rule.m_resourceType.ToString()));
|
||||
|
||||
|
||||
Texture2D resourceTexture = SpawnerEditor.GetSpawnRulePreviewTexture(rule, resource);
|
||||
|
||||
if (resourceTexture != null)
|
||||
{
|
||||
m_editorUtils.Image(resourceTexture, 100, 100);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2798f8dfa33d28345a94494e544a0809
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+289
@@ -0,0 +1,289 @@
|
||||
using PWCommon4;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Gaia
|
||||
{
|
||||
//This class is not a full editor class by itself, but used to collect reusable methods
|
||||
//for editing Spawner Settings in a reorderable list.
|
||||
public class SpawnerPresetListEditor : PWEditor, IPWEditor
|
||||
{
|
||||
|
||||
public static float OnElementHeight()
|
||||
{
|
||||
return EditorGUIUtility.singleLineHeight;
|
||||
}
|
||||
|
||||
public static List<BiomeSpawnerListEntry> OnRemoveListEntry(List<BiomeSpawnerListEntry> oldList, int index)
|
||||
{
|
||||
//if (index < 0 || index >= oldList.Length)
|
||||
// return null;
|
||||
//SpawnerPresetListEntry toRemove = oldList[index];
|
||||
//SpawnerPresetListEntry[] newList = new SpawnerPresetListEntry[oldList.Length - 1];
|
||||
//for (int i = 0; i < newList.Length; ++i)
|
||||
//{
|
||||
// if (i < index)
|
||||
// {
|
||||
// newList[i] = oldList[i];
|
||||
// }
|
||||
// else if (i >= index)
|
||||
// {
|
||||
// newList[i] = oldList[i + 1];
|
||||
// }
|
||||
//}
|
||||
oldList.RemoveAt(index);
|
||||
return oldList;
|
||||
}
|
||||
|
||||
public static List<BiomeSpawnerListEntry> OnAddListEntry(List<BiomeSpawnerListEntry> oldList)
|
||||
{
|
||||
oldList.Add(new BiomeSpawnerListEntry() { m_autoAssignPrototypes = true });
|
||||
return oldList;
|
||||
}
|
||||
|
||||
public static void DrawListHeader(Rect rect, bool currentFoldOutState, List<BiomeSpawnerListEntry> spawnerList, EditorUtils editorUtils, string headerKey)
|
||||
{
|
||||
int oldIndent = EditorGUI.indentLevel;
|
||||
EditorGUI.indentLevel = 0;
|
||||
//rect.xMin += 0f;
|
||||
EditorGUI.LabelField(rect, editorUtils.GetContent(headerKey));
|
||||
//bool newFoldOutState = EditorGUI.Foldout(rect, currentFoldOutState, PropertyCount("SpawnerAdded", spawnerList, editorUtils), true);
|
||||
EditorGUI.indentLevel = oldIndent;
|
||||
//return newFoldOutState;
|
||||
}
|
||||
|
||||
public static void DrawList(ReorderableList list, EditorUtils editorUtils)
|
||||
{
|
||||
Rect maskRect;
|
||||
//if (listExpanded)
|
||||
//{
|
||||
maskRect = EditorGUILayout.GetControlRect(true, list.GetHeight());
|
||||
list.DoList(maskRect);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// int oldIndent = EditorGUI.indentLevel;
|
||||
// EditorGUI.indentLevel = 1;
|
||||
// listExpanded = EditorGUILayout.Foldout(listExpanded, PropertyCount("SpawnerAdded", (List<SpawnerPresetListEntry>)list.list, editorUtils), true);
|
||||
// maskRect = GUILayoutUtility.GetLastRect();
|
||||
// EditorGUI.indentLevel = oldIndent;
|
||||
//}
|
||||
|
||||
//editorUtils.Panel("MaskBaking", DrawMaskBaking, false);
|
||||
}
|
||||
|
||||
//public static void DrawListElement_GaiaManager(Rect rect, BiomeSpawnerListEntry listEntry, EditorUtils m_editorUtils, EditorWindow window = null)
|
||||
//{
|
||||
// int oldIndent = EditorGUI.indentLevel;
|
||||
// Rect controlRect = new Rect(rect);
|
||||
// controlRect.width = 40;
|
||||
// controlRect.height = EditorGUIUtility.singleLineHeight;
|
||||
// EditorGUI.indentLevel = 0;
|
||||
// EditorGUI.LabelField(controlRect, m_editorUtils.GetContent("SpawnerListActive"));
|
||||
// controlRect.x = rect.x + 40;
|
||||
// controlRect.width = 10;
|
||||
// listEntry.m_isActiveInStamper = EditorGUI.Toggle(controlRect, listEntry.m_isActiveInStamper);
|
||||
// controlRect.width = 40;
|
||||
// EditorGUI.LabelField(controlRect, m_editorUtils.GetContent("BiomeActive"));
|
||||
// controlRect.x = rect.x + 40;
|
||||
// controlRect.width = 10;
|
||||
// listEntry.m_isActiveInBiome = EditorGUI.Toggle(controlRect, listEntry.m_isActiveInBiome);
|
||||
// controlRect.x = rect.x + 60;
|
||||
// controlRect.width = 70;
|
||||
// controlRect.height = EditorGUIUtility.singleLineHeight;
|
||||
// EditorGUI.LabelField(controlRect, m_editorUtils.GetContent("SpawnerListAutoAssignPrototypes"));
|
||||
// controlRect.x = rect.x + 125;
|
||||
// controlRect.width = 10;
|
||||
// listEntry.m_autoAssignPrototypes = EditorGUI.Toggle(controlRect, listEntry.m_autoAssignPrototypes);
|
||||
// controlRect.width = 26;
|
||||
// controlRect.x = rect.x + rect.width - 30;
|
||||
// int controlID = EditorGUIUtility.GetControlID(FocusType.Passive);
|
||||
// if (GUI.Button(controlRect, " "))
|
||||
// {
|
||||
// EditorGUIUtility.ShowObjectPicker<SpawnerSettings>(listEntry.m_spawnerSettings, false, "l:GaiaManagerSpawner", controlID);
|
||||
// }
|
||||
// controlRect.width = rect.width - 160;
|
||||
// controlRect.x = rect.x + 150;
|
||||
// listEntry.m_spawnerSettings = (SpawnerSettings)EditorGUI.ObjectField(controlRect, listEntry.m_spawnerSettings, typeof(SpawnerSettings), false);
|
||||
|
||||
// string commandName = Event.current.commandName;
|
||||
// if (commandName == "ObjectSelectorUpdated")
|
||||
// {
|
||||
// if (controlID == EditorGUIUtility.GetObjectPickerControlID())
|
||||
// {
|
||||
// listEntry.m_spawnerSettings = (SpawnerSettings)EditorGUIUtility.GetObjectPickerObject();
|
||||
// if (window != null)
|
||||
// {
|
||||
// window.Repaint();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else if (commandName == "ObjectSelectorClosed")
|
||||
// {
|
||||
// if (controlID == EditorGUIUtility.GetObjectPickerControlID())
|
||||
// {
|
||||
// listEntry.m_spawnerSettings = (SpawnerSettings)EditorGUIUtility.GetObjectPickerObject();
|
||||
// }
|
||||
// }
|
||||
|
||||
// EditorGUI.indentLevel = oldIndent;
|
||||
//}
|
||||
|
||||
public static void DrawListElement(Rect rect, BiomeSpawnerListEntry listEntry, EditorUtils m_editorUtils, EditorWindow window = null)
|
||||
{
|
||||
int oldIndent = EditorGUI.indentLevel;
|
||||
Rect controlRect = new Rect(rect);
|
||||
EditorGUI.indentLevel = 0;
|
||||
controlRect.height = EditorGUIUtility.singleLineHeight;
|
||||
controlRect.width = 12;
|
||||
EditorGUI.LabelField(controlRect, m_editorUtils.GetContent("StamperActive"));
|
||||
controlRect.x = rect.x + 12;
|
||||
controlRect.width = 20;
|
||||
listEntry.m_isActiveInStamper = EditorGUI.Toggle(controlRect, listEntry.m_isActiveInStamper);
|
||||
controlRect.x = controlRect.x + 20;
|
||||
controlRect.width = 12;
|
||||
EditorGUI.LabelField(controlRect, m_editorUtils.GetContent("BiomeActive"));
|
||||
controlRect.x = controlRect.x + 12;
|
||||
controlRect.width = 15;
|
||||
listEntry.m_isActiveInBiome = EditorGUI.Toggle(controlRect, listEntry.m_isActiveInBiome);
|
||||
controlRect.x = controlRect.x + 20;
|
||||
controlRect.width = 12;
|
||||
EditorGUI.LabelField(controlRect, m_editorUtils.GetContent("AutoAssignPrototypes"));
|
||||
controlRect.x = controlRect.x + 12;
|
||||
controlRect.width = 15;
|
||||
listEntry.m_autoAssignPrototypes = EditorGUI.Toggle(controlRect, listEntry.m_autoAssignPrototypes);
|
||||
controlRect.x = rect.x + 10;
|
||||
controlRect.width = 20;
|
||||
controlRect.x = rect.x + rect.width - 20;
|
||||
int controlID = EditorGUIUtility.GetControlID(FocusType.Passive);
|
||||
if (GUI.Button(controlRect, " "))
|
||||
{
|
||||
EditorGUIUtility.ShowObjectPicker<SpawnerSettings>(listEntry.m_spawnerSettings, false, "l:" + GaiaConstants.gaiaManagerSpawnerLabel, controlID);
|
||||
}
|
||||
controlRect.width = rect.width - 100;
|
||||
controlRect.x = rect.x + 100;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
listEntry.m_spawnerSettings = (SpawnerSettings)EditorGUI.ObjectField(controlRect, listEntry.m_spawnerSettings, typeof(SpawnerSettings), false);
|
||||
|
||||
string commandName = Event.current.commandName;
|
||||
if (commandName == "ObjectSelectorUpdated")
|
||||
{
|
||||
if (controlID == EditorGUIUtility.GetObjectPickerControlID())
|
||||
{
|
||||
//Triggers when the custom picker object was updated
|
||||
listEntry.m_spawnerSettings = (SpawnerSettings)EditorGUIUtility.GetObjectPickerObject();
|
||||
listEntry.m_spawnerSettings.RefreshGUID();
|
||||
if (window != null)
|
||||
{
|
||||
window.Repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (commandName == "ObjectSelectorClosed")
|
||||
{
|
||||
if (controlID == EditorGUIUtility.GetObjectPickerControlID())
|
||||
{
|
||||
//Triggers when the custom picker object was closed
|
||||
listEntry.m_spawnerSettings = (SpawnerSettings)EditorGUIUtility.GetObjectPickerObject();
|
||||
listEntry.m_spawnerSettings.RefreshGUID();
|
||||
}
|
||||
}
|
||||
if(EditorGUI.EndChangeCheck())
|
||||
{
|
||||
//Triggers when the user drags and drops a spawner settings file into the slot
|
||||
listEntry.m_spawnerSettings.RefreshGUID();
|
||||
}
|
||||
|
||||
EditorGUI.indentLevel = oldIndent;
|
||||
}
|
||||
|
||||
public static void DrawListElement_AdvancedTab(Rect rect, BiomeSpawnerListEntry listEntry, EditorUtils m_editorUtils)
|
||||
{
|
||||
int oldIndent = EditorGUI.indentLevel;
|
||||
EditorGUI.indentLevel = 0;
|
||||
|
||||
Rect labelRect = rect;
|
||||
//260 is the total width of the controls at the end of each row
|
||||
labelRect.width = rect.width - 280;
|
||||
labelRect.height = EditorGUIUtility.singleLineHeight;
|
||||
|
||||
EditorGUI.LabelField(labelRect, listEntry.m_spawnerSettings.name);
|
||||
|
||||
EditorGUIUtility.AddCursorRect(labelRect, MouseCursor.Zoom);
|
||||
if (labelRect.Contains(Event.current.mousePosition) && Event.current.clickCount > 0)
|
||||
{
|
||||
Selection.activeObject = listEntry.m_spawnerSettings;
|
||||
EditorGUIUtility.PingObject(Selection.activeObject);
|
||||
}
|
||||
|
||||
labelRect.x = rect.width - 230;
|
||||
labelRect.width = 110f;
|
||||
|
||||
EditorGUI.LabelField(labelRect, m_editorUtils.GetContent("SpawnerListAutoAssignPrototypes"));
|
||||
|
||||
labelRect.x = rect.width - 130f;
|
||||
labelRect.width = 20f;
|
||||
|
||||
listEntry.m_autoAssignPrototypes = EditorGUI.Toggle(labelRect, listEntry.m_autoAssignPrototypes);
|
||||
|
||||
labelRect.x = rect.width - 80f;
|
||||
labelRect.width = 100f;
|
||||
if (GUI.Button(labelRect, m_editorUtils.GetContent("AdvancedTabAddSpawner")))
|
||||
{
|
||||
Spawner newSpawner = listEntry.m_spawnerSettings.CreateSpawner(listEntry.m_autoAssignPrototypes);
|
||||
Selection.activeGameObject = newSpawner.gameObject;
|
||||
}
|
||||
|
||||
|
||||
EditorGUI.indentLevel = oldIndent;
|
||||
}
|
||||
|
||||
public static void DrawListElementInStamper(Rect rect, BiomeSpawnerListEntry listEntry, EditorUtils m_editorUtils)
|
||||
{
|
||||
int oldIndent = EditorGUI.indentLevel;
|
||||
Rect controlRect = new Rect(rect);
|
||||
controlRect.width = 40;
|
||||
controlRect.height = EditorGUIUtility.singleLineHeight;
|
||||
EditorGUI.indentLevel = 0;
|
||||
EditorGUI.LabelField(controlRect, "Active");
|
||||
controlRect.x = rect.x + 40;
|
||||
controlRect.width = 10;
|
||||
listEntry.m_isActiveInStamper = EditorGUI.Toggle(controlRect, listEntry.m_isActiveInStamper);
|
||||
controlRect.width = rect.width - 70;
|
||||
controlRect.x = rect.x + 70;
|
||||
listEntry.m_spawnerSettings = (SpawnerSettings)EditorGUI.ObjectField(controlRect, listEntry.m_spawnerSettings, typeof(SpawnerSettings), false);
|
||||
EditorGUI.indentLevel = oldIndent;
|
||||
}
|
||||
|
||||
public static void DrawListElementInBiome(Rect rect, BiomeSpawnerListEntry listEntry, EditorUtils m_editorUtils)
|
||||
{
|
||||
int oldIndent = EditorGUI.indentLevel;
|
||||
Rect controlRect = new Rect(rect);
|
||||
controlRect.width = 40;
|
||||
controlRect.height = EditorGUIUtility.singleLineHeight;
|
||||
EditorGUI.indentLevel = 0;
|
||||
EditorGUI.LabelField(controlRect, "Active");
|
||||
controlRect.x = rect.x + 40;
|
||||
controlRect.width = 10;
|
||||
listEntry.m_isActiveInBiome = EditorGUI.Toggle(controlRect, listEntry.m_isActiveInBiome);
|
||||
controlRect.width = rect.width - 70;
|
||||
controlRect.x = rect.x + 70;
|
||||
listEntry.m_spawnerSettings = (SpawnerSettings)EditorGUI.ObjectField(controlRect, listEntry.m_spawnerSettings, typeof(SpawnerSettings), false);
|
||||
EditorGUI.indentLevel = oldIndent;
|
||||
}
|
||||
|
||||
public static GUIContent PropertyCount(string key, List<BiomeSpawnerListEntry> list, EditorUtils editorUtils)
|
||||
{
|
||||
GUIContent content = editorUtils.GetContent(key);
|
||||
content.text += " [" + list.Count + "]";
|
||||
return content;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 968fa80c60c6a5a42ab7114ff230ec0f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Gaia
|
||||
{
|
||||
/// <summary>
|
||||
/// This class only exists to change the displayed name from "Spawner" to "World Biome Masks" on the component.
|
||||
/// </summary>
|
||||
[CustomEditor(typeof(WorldBiomeMasks))]
|
||||
public class WorldBiomeMasksEditor : SpawnerEditor
|
||||
{
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cf26408c3c4cf35408a18408f266a499
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Gaia
|
||||
{
|
||||
/// <summary>
|
||||
/// This class only exists to change the displayed name from "Spawner" to "World Generator" on the component.
|
||||
/// </summary>
|
||||
[CustomEditor(typeof(WorldDesigner))]
|
||||
public class WorldDesignerEditor : SpawnerEditor
|
||||
{
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 44f7726ac5af60c4a970bcdf7f860674
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,4 @@
|
||||
/// <summary>
|
||||
/// This file is being replaced with WorldDesignerEditor.cs and is just left here for upwards compatibility to "disable" this file in earlier Gaia installations
|
||||
/// </summary>
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 054d1dcb815a71148a42b4b1b71733e4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in new issue
Block a user