Beispiel #1
0
        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;
        }
Beispiel #2
0
        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;
        }
Beispiel #3
0
        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;
        }
Beispiel #4
0
        //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;
        }