Implement dictionaries

This commit is contained in:
Melledy
2025-10-28 00:41:30 -07:00
parent 1bf87715b5
commit 38d44f7a71
4 changed files with 75 additions and 1 deletions

View File

@@ -37,6 +37,9 @@ public class GameData {
@Getter private static DataTable<MallShopDef> MallShopDataTable = new DataTable<>();
@Getter private static DataTable<MallGemDef> MallGemDataTable = new DataTable<>();
@Getter private static DataTable<DictionaryTabDef> DictionaryTabDataTable = new DataTable<>();
@Getter private static DataTable<DictionaryEntryDef> DictionaryEntryDataTable = new DataTable<>();
@Getter private static DataTable<WorldClassDef> WorldClassDataTable = new DataTable<>();
@Getter private static DataTable<GuideGroupDef> GuideGroupDataTable = new DataTable<>();
@Getter private static DataTable<StoryDef> StoryDataTable = new DataTable<>();

View File

@@ -0,0 +1,28 @@
package emu.nebula.data.resources;
import emu.nebula.data.BaseDef;
import emu.nebula.data.GameData;
import emu.nebula.data.ResourceType;
import emu.nebula.data.ResourceType.LoadPriority;
import lombok.Getter;
@Getter
@ResourceType(name = "DictionaryEntry.json", loadPriority = LoadPriority.LOW)
public class DictionaryEntryDef extends BaseDef {
private int Id;
private int Tab;
private int Index;
@Override
public int getId() {
return Id;
}
@Override
public void onLoad() {
var dictionary = GameData.getDictionaryTabDataTable().get(this.getTab());
if (dictionary != null) {
dictionary.getEntries().add(this);
}
}
}

View File

@@ -0,0 +1,26 @@
package emu.nebula.data.resources;
import java.util.ArrayList;
import java.util.List;
import emu.nebula.data.BaseDef;
import emu.nebula.data.ResourceType;
import lombok.Getter;
@Getter
@ResourceType(name = "DictionaryTab.json")
public class DictionaryTabDef extends BaseDef {
private int Id;
private List<DictionaryEntryDef> entries;
public DictionaryTabDef() {
this.entries = new ArrayList<>();
}
@Override
public int getId() {
return Id;
}
}