First commit for private source control. Older commits available on Github.
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
using System.Collections.Generic;
|
||||
using BriarQueen.Data.Assets;
|
||||
using BriarQueen.Framework.Registries;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BriarQueen.Editor.Drawers.Registries
|
||||
{
|
||||
[CustomEditor(typeof(AssetRegistry))]
|
||||
public class AssetRegistryFill : UnityEditor.Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
DrawDefaultInspector();
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
if (GUILayout.Button("Discover AssetEntry Assets"))
|
||||
{
|
||||
Populate((AssetRegistry)target);
|
||||
}
|
||||
}
|
||||
|
||||
private static void Populate(AssetRegistry registry)
|
||||
{
|
||||
string[] guids = AssetDatabase.FindAssets("t:AssetEntry");
|
||||
|
||||
var scenes = new List<AssetEntry>();
|
||||
var levels = new List<AssetEntry>();
|
||||
var items = new List<AssetEntry>();
|
||||
var ui = new List<AssetEntry>();
|
||||
|
||||
foreach (string guid in guids)
|
||||
{
|
||||
string path = AssetDatabase.GUIDToAssetPath(guid);
|
||||
var entry = AssetDatabase.LoadAssetAtPath<AssetEntry>(path);
|
||||
|
||||
if (entry == null)
|
||||
continue;
|
||||
|
||||
switch (entry.EntryType)
|
||||
{
|
||||
case AssetEntry.AssetEntryType.Scene:
|
||||
scenes.Add(entry);
|
||||
break;
|
||||
|
||||
case AssetEntry.AssetEntryType.Level:
|
||||
levels.Add(entry);
|
||||
break;
|
||||
|
||||
case AssetEntry.AssetEntryType.Item:
|
||||
items.Add(entry);
|
||||
break;
|
||||
|
||||
case AssetEntry.AssetEntryType.UI:
|
||||
ui.Add(entry);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
scenes.Sort((a, b) => string.CompareOrdinal(a.name, b.name));
|
||||
levels.Sort((a, b) => string.CompareOrdinal(a.name, b.name));
|
||||
items.Sort((a, b) => string.CompareOrdinal(a.name, b.name));
|
||||
ui.Sort((a, b) => string.CompareOrdinal(a.name, b.name));
|
||||
|
||||
Undo.RecordObject(registry, "Discover AssetEntry Assets");
|
||||
registry.SetDiscoveredEntries(scenes, levels, items, ui);
|
||||
EditorUtility.SetDirty(registry);
|
||||
AssetDatabase.SaveAssets();
|
||||
|
||||
Debug.Log($"[AssetRegistry] Discovery complete. Scenes: {scenes.Count}, Levels: {levels.Count}, Items: {items.Count}, UI: {ui.Count}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2f49114100e741bb849cbdfb5fc457cc
|
||||
timeCreated: 1773602794
|
||||
@@ -0,0 +1,69 @@
|
||||
using System.Collections.Generic;
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using BriarQueen.Framework.Managers.Player.Data;
|
||||
using BriarQueen.Framework.Registries;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BriarQueen.Editor.Drawers.Registries
|
||||
{
|
||||
[CustomEditor(typeof(CodexRegistry))]
|
||||
public class CodexRegistryFill : UnityEditor.Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
DrawDefaultInspector();
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
if (GUILayout.Button("Discover Codex Entry Assets"))
|
||||
{
|
||||
Populate((CodexRegistry)target);
|
||||
}
|
||||
}
|
||||
|
||||
private static void Populate(CodexRegistry registry)
|
||||
{
|
||||
string[] guids = AssetDatabase.FindAssets("t:CodexEntrySo");
|
||||
|
||||
var books = new List<CodexEntrySo>();
|
||||
var clues = new List<CodexEntrySo>();
|
||||
var photos = new List<CodexEntrySo>();
|
||||
|
||||
foreach (string guid in guids)
|
||||
{
|
||||
string path = AssetDatabase.GUIDToAssetPath(guid);
|
||||
var entry = AssetDatabase.LoadAssetAtPath<CodexEntrySo>(path);
|
||||
|
||||
if (entry == null)
|
||||
continue;
|
||||
|
||||
switch (entry.EntryType)
|
||||
{
|
||||
case CodexType.BookEntry:
|
||||
books.Add(entry);
|
||||
break;
|
||||
|
||||
case CodexType.PuzzleClue:
|
||||
clues.Add(entry);
|
||||
break;
|
||||
|
||||
case CodexType.Photo:
|
||||
photos.Add(entry);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
books.Sort((a, b) => string.CompareOrdinal(a.name, b.name));
|
||||
clues.Sort((a, b) => string.CompareOrdinal(a.name, b.name));
|
||||
photos.Sort((a, b) => string.CompareOrdinal(a.name, b.name));
|
||||
|
||||
Undo.RecordObject(registry, "Discover Codex Assets");
|
||||
registry.SetDiscoveredEntries(books, clues, photos);
|
||||
EditorUtility.SetDirty(registry);
|
||||
AssetDatabase.SaveAssets();
|
||||
|
||||
Debug.Log($"[AssetRegistry] Discovery complete. Books: {books.Count}, Clues: {clues.Count}, Photos: {photos.Count}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 04adf387d1e94429a6c320005150cb90
|
||||
timeCreated: 1773921705
|
||||
69
Assets/Scripts/Editor/Drawers/Registries/ItemRegistryFill.cs
Normal file
69
Assets/Scripts/Editor/Drawers/Registries/ItemRegistryFill.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using System.Collections.Generic;
|
||||
using BriarQueen.Framework.Managers.Player.Data;
|
||||
using BriarQueen.Framework.Registries;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BriarQueen.Editor.Drawers.Registries
|
||||
{
|
||||
[CustomEditor(typeof(ItemRegistry))]
|
||||
public class ItemRegistryFill : UnityEditor.Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
DrawDefaultInspector();
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
if (GUILayout.Button("Discover Item Assets"))
|
||||
{
|
||||
Populate((ItemRegistry)target);
|
||||
}
|
||||
}
|
||||
|
||||
private static void Populate(ItemRegistry registry)
|
||||
{
|
||||
string[] guids = AssetDatabase.FindAssets("t:ItemDataSo");
|
||||
|
||||
var puzzleSlots = new List<ItemDataSo>();
|
||||
var pickupItems = new List<ItemDataSo>();
|
||||
var environmentInteractables = new List<ItemDataSo>();
|
||||
|
||||
foreach (string guid in guids)
|
||||
{
|
||||
string path = AssetDatabase.GUIDToAssetPath(guid);
|
||||
var entry = AssetDatabase.LoadAssetAtPath<ItemDataSo>(path);
|
||||
|
||||
if (entry == null)
|
||||
continue;
|
||||
|
||||
switch (entry.IdType)
|
||||
{
|
||||
case ItemDataSo.ItemIdType.PuzzleSlot:
|
||||
puzzleSlots.Add(entry);
|
||||
break;
|
||||
|
||||
case ItemDataSo.ItemIdType.Pickup:
|
||||
pickupItems.Add(entry);
|
||||
break;
|
||||
|
||||
case ItemDataSo.ItemIdType.Environment:
|
||||
environmentInteractables.Add(entry);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
puzzleSlots.Sort((a, b) => string.CompareOrdinal(a.name, b.name));
|
||||
pickupItems.Sort((a, b) => string.CompareOrdinal(a.name, b.name));
|
||||
environmentInteractables.Sort((a, b) => string.CompareOrdinal(a.name, b.name));
|
||||
|
||||
Undo.RecordObject(registry, "Discover Item Assets");
|
||||
registry.SetDiscoveredEntries(puzzleSlots, pickupItems, environmentInteractables);
|
||||
EditorUtility.SetDirty(registry);
|
||||
AssetDatabase.SaveAssets();
|
||||
|
||||
Debug.Log(
|
||||
$"[ItemRegistry] Discovery complete. Puzzle Slots: {puzzleSlots.Count}, Pickup Items: {pickupItems.Count}, Environment Interactables: {environmentInteractables.Count}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a9e6445d7af341b6995266514b666497
|
||||
timeCreated: 1773921699
|
||||
Reference in New Issue
Block a user