diff --git a/Assets/Database/Encounters/EncounterTables/Dialogs/Dialog_Set_0.asset b/Assets/Database/Encounters/EncounterTables/Dialogs/Dialog_Set_0.asset index ecfcf11..71f723d 100644 --- a/Assets/Database/Encounters/EncounterTables/Dialogs/Dialog_Set_0.asset +++ b/Assets/Database/Encounters/EncounterTables/Dialogs/Dialog_Set_0.asset @@ -12,7 +12,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: c47caaa92bb94eeca3e47dd86fd010cf, type: 3} m_Name: Dialog_Set_0 m_EditorClassIdentifier: Assembly-CSharp::Nox.Game.EncounterDialogOptionSet - id: Dialog_Set_1 + id: Dialog_Set_0 library: {fileID: 11400000, guid: 11b94daa76442834198b68996afe0013, type: 2} options: - text: diff --git a/Assets/Database/Encounters/EncounterTables/TestEncounterTable.asset b/Assets/Database/Encounters/EncounterTables/TestEncounterTable.asset index 8be37b7..f08aa33 100644 --- a/Assets/Database/Encounters/EncounterTables/TestEncounterTable.asset +++ b/Assets/Database/Encounters/EncounterTables/TestEncounterTable.asset @@ -15,43 +15,25 @@ MonoBehaviour: id: TestEncounterTable encounters: - k__BackingField: - internalId: adce0a09-6402-4c2e-b24a-db7c9c67e3e5 - id: test_quest_1 - name: Test Quest Stage I - description: An encounter like no other which leads to another encounter like - no other + internalId: 169489f1-892d-475b-8c32-fc760da28929 + id: simple_puzzle + name: Fix a Broken Cart + description: 'You encounter a broken cart. At a closer examination you chose + to:' + k__BackingField: + rid: 1352971465325281422 k__BackingField: difficulty: 0 k__BackingField: - icon: {fileID: 21300000, guid: ea02ea44fa86ee445be0f7ca82098b75, type: 3} + icon: {fileID: 0} encounterColor: {r: 0, g: 0, b: 0, a: 0} - encounterArt: {fileID: 21300000, guid: a9c4c7681315e25419b9381d28aa9d80, type: 3} - k__BackingField: {fileID: 11400000, guid: 9496570aa3d05624a9b8bbbf6009c453, type: 2} - k__BackingField: - rid: 1352971465325281411 - - k__BackingField: - internalId: adce0a09-6402-4c2e-b24a-db7c9c67e3e5 - id: test_quest_2 - name: Test Quest Stage II - description: An encounter like no other which should be now completed - k__BackingField: - difficulty: 0 - k__BackingField: - icon: {fileID: 21300000, guid: ea02ea44fa86ee445be0f7ca82098b75, type: 3} - encounterColor: {r: 0, g: 0, b: 0, a: 0} - encounterArt: {fileID: 21300000, guid: 819d7a244820ad84585a1de7566bf9d0, type: 3} - k__BackingField: {fileID: 11400000, guid: 9496570aa3d05624a9b8bbbf6009c453, type: 2} - k__BackingField: - rid: -2 + encounterArt: {fileID: 0} + k__BackingField: {fileID: 0} references: version: 2 RefIds: - - rid: -2 - type: {class: , ns: , asm: } - - rid: 1352971465325281411 - type: {class: QuestKind, ns: Jovian.EncounterSystem, asm: Jovian.EncounterSystem} + - rid: 1352971465325281422 + type: {class: PuzzleKind, ns: Jovian.EncounterSystem, asm: Jovian.EncounterSystem} data: - nextEncounter: - table: {fileID: 11400000} - internalId: adce0a09-6402-4c2e-b24a-db7c9c67e3e5 - questTitle: + puzzleId: borken_cart + difficultyClass: 1 diff --git a/Assets/Database/Encounters/EncounterTables/TestEncounterTable.asset.meta b/Assets/Database/Encounters/EncounterTables/TestEncounterTable.asset.meta index 5fa664d..b9603c9 100644 --- a/Assets/Database/Encounters/EncounterTables/TestEncounterTable.asset.meta +++ b/Assets/Database/Encounters/EncounterTables/TestEncounterTable.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 396a5409178bf0d4b938094eefe22cca +guid: 0d6735c0d1617b243a1f6c8c5070028c NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/Assets/Database/Encounters/EncounterTables/TestQuestTable.asset b/Assets/Database/Encounters/EncounterTables/TestQuestTable.asset new file mode 100644 index 0000000..4470fce --- /dev/null +++ b/Assets/Database/Encounters/EncounterTables/TestQuestTable.asset @@ -0,0 +1,62 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e480a30007b949679b8ca1e0e6088675, type: 3} + m_Name: TestQuestTable + m_EditorClassIdentifier: Assembly-CSharp::Nox.Game.EncounterTable + id: TestEncounterTable + encounters: + - k__BackingField: + internalId: adce0a09-6402-4c2e-b24a-db7c9c67e3e5 + id: test_quest_1 + name: Test Quest Stage I + description: An encounter like no other which leads to another encounter like + no other + k__BackingField: + rid: 1352971465325281417 + k__BackingField: + difficulty: 0 + k__BackingField: + icon: {fileID: 21300000, guid: ea02ea44fa86ee445be0f7ca82098b75, type: 3} + encounterColor: {r: 0, g: 0, b: 0, a: 0} + encounterArt: {fileID: 21300000, guid: a9c4c7681315e25419b9381d28aa9d80, type: 3} + k__BackingField: {fileID: 11400000, guid: 9496570aa3d05624a9b8bbbf6009c453, type: 2} + - k__BackingField: + internalId: 882ecaa9-29d9-452e-aa88-beb533f97882 + id: test_quest_2 + name: Test Quest Stage II + description: An encounter like no other which should be now completed + k__BackingField: + rid: 1352971465325281421 + k__BackingField: + difficulty: 0 + k__BackingField: + icon: {fileID: 21300000, guid: ea02ea44fa86ee445be0f7ca82098b75, type: 3} + encounterColor: {r: 0, g: 0, b: 0, a: 0} + encounterArt: {fileID: 21300000, guid: 819d7a244820ad84585a1de7566bf9d0, type: 3} + k__BackingField: {fileID: 11400000, guid: 9496570aa3d05624a9b8bbbf6009c453, type: 2} + references: + version: 2 + RefIds: + - rid: 1352971465325281417 + type: {class: QuestKind, ns: Jovian.EncounterSystem, asm: Jovian.EncounterSystem} + data: + nextEncounter: + table: {fileID: 11400000} + internalId: 882ecaa9-29d9-452e-aa88-beb533f97882 + questTitle: + - rid: 1352971465325281421 + type: {class: QuestKind, ns: Jovian.EncounterSystem, asm: Jovian.EncounterSystem} + data: + nextEncounter: + table: {fileID: 0} + internalId: + questTitle: diff --git a/Assets/Database/Encounters/EncounterTables/TestQuestTable.asset.meta b/Assets/Database/Encounters/EncounterTables/TestQuestTable.asset.meta new file mode 100644 index 0000000..5fa664d --- /dev/null +++ b/Assets/Database/Encounters/EncounterTables/TestQuestTable.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 396a5409178bf0d4b938094eefe22cca +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Database/Encounters/TestEncountersCollection.asset b/Assets/Database/Encounters/TestEncountersCollection.asset index 12767e5..28f2487 100644 --- a/Assets/Database/Encounters/TestEncountersCollection.asset +++ b/Assets/Database/Encounters/TestEncountersCollection.asset @@ -14,3 +14,4 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::Nox.Game.EncountersCollection encounterTables: - {fileID: 11400000, guid: 396a5409178bf0d4b938094eefe22cca, type: 2} + - {fileID: 11400000, guid: 0d6735c0d1617b243a1f6c8c5070028c, type: 2} diff --git a/Packages/com.jovian.encounter-system/Editor/EncounterBrowserWindow.cs b/Packages/com.jovian.encounter-system/Editor/EncounterBrowserWindow.cs index 3aea7ea..26c0b2f 100644 --- a/Packages/com.jovian.encounter-system/Editor/EncounterBrowserWindow.cs +++ b/Packages/com.jovian.encounter-system/Editor/EncounterBrowserWindow.cs @@ -16,8 +16,19 @@ namespace Jovian.EncounterSystem.Editor { public EncounterTable table; public int index; public IEncounter encounter; + public int depth; + + public bool IsTableHeader => encounter == null; } + private static readonly Color[] DepthColors = { + new(0.35f, 0.55f, 0.85f), // depth 0 — table headers (blue) + new(0.90f, 0.90f, 0.90f), // depth 1 — encounters under table (neutral) + new(0.70f, 0.90f, 0.55f), // depth 2 — chain step 1 (green) + new(0.95f, 0.80f, 0.45f), // depth 3 — chain step 2 (amber) + new(0.85f, 0.65f, 0.90f) // depth 4+ — deeper chain (violet) + }; + private readonly List allRecords = new(); private string searchText = string.Empty; private string kindFilter = AllKinds; @@ -27,6 +38,7 @@ namespace Jovian.EncounterSystem.Editor { private TreeView treeView; private VisualElement detailPane; private ToolbarMenu kindDropdown; + private VisualElement statusBanner; [MenuItem("Jovian/Encounters/Encounter Browser")] public static void Open() { @@ -69,8 +81,26 @@ namespace Jovian.EncounterSystem.Editor { } private void BuildSplit() { - var split = new TwoPaneSplitView(0, 280, TwoPaneSplitViewOrientation.Horizontal); - split.style.flexGrow = 1f; + statusBanner = new VisualElement { + style = { + paddingLeft = 10, + paddingRight = 10, + paddingTop = 8, + paddingBottom = 8, + marginBottom = 2, + flexDirection = FlexDirection.Column, + backgroundColor = new StyleColor(new Color(0.85f, 0.4f, 0.15f, 0.35f)), + display = DisplayStyle.None + } + }; + rootVisualElement.Add(statusBanner); + + var split = new VisualElement { + style = { + flexDirection = FlexDirection.Row, + flexGrow = 1f + } + }; rootVisualElement.Add(split); treeView = new TreeView { @@ -80,7 +110,10 @@ namespace Jovian.EncounterSystem.Editor { selectionType = SelectionType.Single }; treeView.selectionChanged += OnSelectionChanged; - treeView.style.flexGrow = 1f; + treeView.style.width = 280; + treeView.style.flexShrink = 0f; + treeView.style.borderRightWidth = 1; + treeView.style.borderRightColor = new StyleColor(new Color(0f, 0f, 0f, 0.4f)); split.Add(treeView); detailPane = new ScrollView(ScrollViewMode.Vertical) { @@ -97,7 +130,9 @@ namespace Jovian.EncounterSystem.Editor { alignItems = Align.Center, paddingLeft = 6, paddingRight = 6, - height = 22 + height = 22, + flexGrow = 1f, + flexShrink = 0f } }; @@ -125,6 +160,19 @@ namespace Jovian.EncounterSystem.Editor { }; row.Add(label); + var selectButton = new Button { + name = "select-button", + text = "Select", + style = { + marginLeft = 4, + marginRight = 0, + paddingLeft = 6, + paddingRight = 6, + display = DisplayStyle.None + } + }; + row.Add(selectButton); + return row; } @@ -132,9 +180,34 @@ namespace Jovian.EncounterSystem.Editor { var record = treeView.GetItemDataForIndex(index); var label = element.Q