public EditorApp( ImGuiRenderer imGuiRenderer, GameWindow gameWindow, IReadOnlyList <IWindow> windows, GameClock gameClock, WorldSystem worldSystem, EditTileMapState editTileMapState, IAssetsDatabase assetsDatabase ) { _imGuiRenderer = imGuiRenderer; _windows = windows; _gameClock = gameClock; _worldSystem = worldSystem; _editorAppState = editTileMapState; _assetsDatabase = assetsDatabase; _imGuiRenderer.RebuildFontAtlas(); var imGuiIo = ImGui.GetIO(); imGuiIo.ConfigWindowsMoveFromTitleBarOnly = true; imGuiIo.ConfigFlags |= ImGuiConfigFlags.DockingEnable; gameWindow.AllowUserResizing = true; _worldSystem.CreateNewWorld(); }
public TilePaletteWindow(ISubscriber subscriber, TileSettings tileSettings, IAssetsDatabase assetsDatabase) { _tileSettings = tileSettings; _assetsDatabase = assetsDatabase; subscriber.Subscribe <ComponentAddedMessage>(Handle); subscriber.Subscribe <ComponentRemovedMessage>(Handle); }
protected override WorldData CoreRead( AssetId assetId, byte[] content, IAssetsDatabase assetsDatabase, ISerializer serializer ) => serializer.Deserialize <WorldData>(content);
protected override Sprite CoreRead( AssetId assetId, byte[] content, IAssetsDatabase assetsDatabase, ISerializer serializer ) { var spriteData = serializer.Deserialize <SpriteData>(content); var texture = assetsDatabase.Load <Texture2D>(spriteData.TextureName); var textureRegion = new TextureRegion2D(texture, spriteData.Region); return(new Sprite(textureRegion)); }
public object Load(AssetId assetId, string assetPath, IAssetsDatabase assetsDatabase, ISerializer serializer) { using var fs = File.OpenRead(assetPath); var texture = Texture2D.FromStream(_graphicsDevice, fs); texture.Name = assetId; var data = new Color[texture.Width * texture.Height]; texture.GetData(data); for (var i = 0; i != data.Length; ++i) { data[i] = Color.FromNonPremultiplied(data[i].ToVector4()); } texture.SetData(data); return(texture); }
public HeroComponentsFactory(IAssetsDatabase assetsDatabase) { _assetsDatabase = assetsDatabase; }
protected abstract T CoreRead( AssetId assetId, byte[] content, IAssetsDatabase assetsDatabase, ISerializer serializer );
public object Load(AssetId assetId, string assetPath, IAssetsDatabase assetsDatabase, ISerializer serializer) { var fileContents = File.ReadAllBytes(assetPath); return(CoreRead(assetId, fileContents, assetsDatabase, serializer)); }