Aetheria/Assets/Scripts/CultCache/Editor/AetheriaDatabaseView.cs
Meta Vens f568a7d14f Cut RethinkDB
Remove the vendored RethinkDb driver and its Linq provider, the Rethink
backing store, the already-stubbed RethinkConnection, the Rethink test
window, and the Rethink-only Remotion.Linq and Logging.Abstractions DLLs.
The database editor now works only on GameData/AetherDB.msgpack, with a
Save button replacing the dead Connect UI and broken JSON export.
RethinkTable becomes DatabaseCategory, which only groups editor entries.

Economy.Server still references Rethink; it was already unbuildable and
is handled separately.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-11 21:48:45 +02:00

43 lines
No EOL
1.9 KiB
C#

using System;
using System.IO;
using UnityEditor;
using UnityEngine;
public class AetheriaDatabaseView : DatabaseListView
{
// Singleton to avoid multiple instances of window.
private static DatabaseListView _instance;
public static DatabaseListView Instance => _instance ? _instance : GetWindow<AetheriaDatabaseView>();
[MenuItem("Window/Aetheria/Database Tools")]
static void Init() => Instance.Show();
private void Awake()
{
_instance = this;
}
protected override string FilePath => new DirectoryInfo(Application.dataPath).Parent.CreateSubdirectory("GameData").FullName;
protected override DatabaseEntryGroup[] Groupers => new DatabaseEntryGroup[]
{
new DatabaseEntryGroup<SimpleCommodityData,SimpleCommodityCategory>(
data => data.Category,
category => Enum.GetName(typeof(SimpleCommodityCategory), category),
(data, category) => data.Category = category ),
new DatabaseEntryGroup<CompoundCommodityData, CompoundCommodityCategory>(
data => data.Category,
category => Enum.GetName(typeof(CompoundCommodityCategory), category),
(data, category) => data.Category = category ),
new DatabaseEntryGroup<GearData, HardpointType>(
data => data.HardpointType,
type => Enum.GetName(typeof(HardpointType), type),
(data, type) => data.Hardpoint = type),
new DatabaseEntryGroup<GearData, Guid>(
data => data.Manufacturer,
factionID => factionID == Guid.Empty ? "Default" : cultCache.Get<Faction>(factionID).ShortName,
(data, faction) => data.Manufacturer = faction),
new DatabaseEntryGroup<HullData, HullType>(
data => data.HullType,
type => Enum.GetName(typeof(HullType), type),
(data, type) => data.HullType = type)
};
}