void SetCursor(CoreSpriteId cursorId) { var assets = Resolve <IAssetManager>(); var window = Resolve <IWindowManager>(); var config = assets.LoadCoreSpriteInfo(cursorId); _cursorId = cursorId; _hotspot = config?.Hotspot == null ? Vector2.Zero : window.GuiScale * new Vector2(config.Hotspot.X, config.Hotspot.Y); _dirty = true; }
void SetCursor(CoreSpriteId id) { var assets = Resolve <IAssetManager>(); var window = Resolve <IWindowManager>(); var texture = assets.LoadTexture(id); var config = assets.LoadCoreSpriteInfo(id); _cursorId = id; _size = new Vector2(texture.Width, texture.Height); _hotspot = config.Hotspot == null ? Vector2.Zero : window.GuiScale * new Vector2(config.Hotspot.X, config.Hotspot.Y); }
public static AlbionSprite Load(CoreSpriteId id, string exePath, CoreSpriteConfig config) { var resource = GetConfig(id, exePath, config, out var file); var bytes = LoadSection(file, resource); return(new AlbionSprite { Name = $"Core.{id}", Width = resource.Width, Height = resource.Height, UniformFrames = true, Frames = new[] { new AlbionSprite.Frame(0, 0, resource.Width, resource.Height) }, PixelData = bytes }); }
public static CoreSpriteConfig.BinaryResource GetConfig(CoreSpriteId id, string exePath, CoreSpriteConfig config, out string filename) { if (!Directory.Exists(exePath)) { throw new InvalidOperationException($"Search directory {exePath} does not exist"); } foreach (var file in Directory.EnumerateFiles(exePath, "*.*", SearchOption.AllDirectories)) { if (!file.EndsWith(".exe", StringComparison.InvariantCultureIgnoreCase)) { continue; } var hash = GetHash(file); if (config.Hashes.TryGetValue(hash, out var resources)) { filename = file; return(resources[(int)id]); } } throw new FileNotFoundException("No suitable main.exe file could be found."); }
public SetCursorEvent(CoreSpriteId cursorId) { CursorId = cursorId; }