public Inventory(zzio.db.MappedDB mappedDB, Savegame?savegame = null) { this.mappedDB = mappedDB; if (savegame == null) { return; } var maxIndex = savegame.inventory.Max(i => i.atIndex); cards = Enumerable.Repeat <InventoryCard?>(null, (int)maxIndex + 1).ToList(); foreach (var card in savegame.inventory) { var atIndex = card.atIndex; if (atIndex < 0 || atIndex >= cards.Count) { throw new ArgumentOutOfRangeException("Save inventory card index is not valid"); } cards[(int)atIndex] = card; } foreach (var fairy in cards.OfType <InventoryFairy>()) { Update(fairy); if (fairy.slotIndex >= 0) { fairySlots[fairy.slotIndex] = fairy; } } Count = cards.NotNull().Count(); }
public UIPreloader(ITagContainer diContainer) { world = diContainer.GetTag <DefaultEcs.World>(); mappedDb = diContainer.GetTag <zzio.db.MappedDB>(); Btn000 = Preload(out var tsBtn000, "btn000", isFont: false); Btn001 = Preload(out var tsBtn001, "btn001", isFont: false); Btn002 = Preload(out var tsBtn002, "btn002", isFont: false); Sld000 = Preload(out var tsSld000, "sld000", isFont: false); Tit000 = Preload(out var tsTit000, "tit000", isFont: false); Cur000 = Preload(out var tsCur000, "cur000", isFont: false); Dnd000 = Preload(out var tsDnd000, "dnd000", isFont: false); Wiz000 = Preload(out var tsWiz000, "wiz000", isFont: false); Itm000 = Preload(out var tsItm000, "itm000", isFont: false); Spl000 = Preload(out var tsSpl000, "spl000", isFont: false); Lne000 = Preload(out var tsLne000, "lne000", isFont: false); Fnt000 = Preload(out var tsFnt000, "fnt000", isFont: true, lineHeight: 14f, charSpacing: 1f); Fnt001 = Preload(out var tsFnt001, "fnt001", isFont: true, charSpacing: 1f); Fnt002 = Preload(out var tsFnt002, "fnt002", isFont: true, lineHeight: 17f, charSpacing: 1f, lineOffset: 2f); Fnt003 = Preload(out var tsFnt003, "fnt003", isFont: true, lineHeight: 14f, charSpacing: 1f); Fnt004 = Preload(out var tsFnt004, "fnt004", isFont: true, lineHeight: 14f, charSpacing: 1f); Fsp000 = Preload(out var tsFsp000, "fsp000", isFont: true); Inf000 = Preload(out var tsInf000, "inf000", isFont: false); Log000 = Preload(out var tsLog000, "log000", isFont: false); Cls000 = Preload(out var tsCls000, "cls000", isFont: false); Cls001 = Preload(out var tsCls001, "cls001", isFont: false); Map000 = Preload(out var tsMap000, "map000", isFont: false); tsFnt000.Alternatives.Add(tsFnt001); tsFnt000.Alternatives.Add(tsFnt002); tsFnt000.Alternatives.Add(tsFsp000); tsFnt000.Alternatives.Add(tsItm000); tsFnt000.Alternatives.Add(tsCls000); tsFnt000.Alternatives.Add(tsFnt003); tsFnt000.Alternatives.Add(tsLog000); tsFnt000.Alternatives.Add(tsCls001); tsFnt000.Alternatives.Add(tsFnt004); tsFnt001.Alternatives.Add(tsFnt002); tsFnt001.Alternatives.Add(tsInf000); tsFnt001.Alternatives.Add(tsFnt000); tsFnt002.Alternatives.Add(tsFnt001); tsFnt002.Alternatives.Add(tsInf000); tsFnt002.Alternatives.Add(tsFsp000); tsFnt002.Alternatives.Add(tsItm000); tsFnt002.Alternatives.Add(tsCls000); tsFnt002.Alternatives.Add(tsCls001); tsFnt003.Alternatives.Add(tsFnt001); tsFnt003.Alternatives.Add(tsFnt002); tsFnt003.Alternatives.Add(tsFsp000); tsFnt003.Alternatives.Add(tsItm000); tsFnt003.Alternatives.Add(tsFnt000); tsFnt003.Alternatives.Add(tsFnt000); tsFnt003.Alternatives.Add(tsLog000); tsFnt003.Alternatives.Add(tsCls001); tsFnt003.Alternatives.Add(tsFnt004); }
public NPC(ITagContainer diContainer) : base(diContainer.GetTag <DefaultEcs.World>(), CreateEntityContainer, useBuffer: true) { worldCollider = diContainer.GetTag <WorldCollider>(); scene = diContainer.GetTag <Scene>(); mappedDB = diContainer.GetTag <zzio.db.MappedDB>(); sceneLoadSubscription = World.Subscribe <messages.SceneLoaded>(HandleSceneLoaded); setNpcModifierSubscription = World.Subscribe <zzio.GSModSetNPCModifier>(HandleSetNpcModifier); }
private zzio.db.MappedDB LoadDatabase() { var mappedDb = new zzio.db.MappedDB(); var resourcePool = GetTag <IResourcePool>(); for (int i = 1; i <= MaxDatabaseModule; i++) { using var tableStream = resourcePool.FindAndOpen($"Data/_fb0x0{i}.fbs"); if (tableStream == null) { continue; } var table = new zzio.db.Table(); table.Read(tableStream); mappedDb.AddTable(table); } return(mappedDb); }
public BehaviourCollectable(ITagContainer diContainer) : base(diContainer.GetTag <DefaultEcs.World>(), CreateEntityContainer, useBuffer: false) { game = diContainer.GetTag <Game>(); playerLocationLazy = new Lazy <Location>(() => game.PlayerEntity.Get <Location>()); mappedDb = diContainer.GetTag <zzio.db.MappedDB>(); }