// ------------------------------------------------------------------- // AddSprite // ------------------------------------------------------------------- public void AddSprite(int[] coords, SystemEvent ev) { if (!Sprites.ContainsKey(ev.Pages[0].Graphic)) { Sprites[ev.Pages[0].Graphic] = new Dictionary <int[], Sprites>(new IntArrayComparer()); } if (ev.Pages[0].Graphic.IsTileset()) { int[] texture = new int[] { (int)ev.Pages[0].Graphic.Options[(int)SystemGraphic.OptionsEnum.TilesetX], (int)ev.Pages[0].Graphic.Options[(int)SystemGraphic.OptionsEnum.TilesetY], (int)ev.Pages[0].Graphic.Options[(int)SystemGraphic.OptionsEnum.TilesetWidth], (int)ev.Pages[0].Graphic.Options[(int)SystemGraphic.OptionsEnum.TilesetHeight] }; if (!Sprites[ev.Pages[0].Graphic].ContainsKey(texture)) { Sprites[ev.Pages[0].Graphic][texture] = new Sprites(); } Sprites[ev.Pages[0].Graphic][texture].Add(coords, new Sprite(ev.Pages[0].GraphicDrawType, new int[] { 0, 0 }, 0)); } else { int frames = (int)ev.Pages[0].Graphic.Options[(int)SystemGraphic.OptionsEnum.Frames]; int index = (int)ev.Pages[0].Graphic.Options[(int)SystemGraphic.OptionsEnum.Index]; MapEditor.LoadSystemGraphic(ev.Pages[0].Graphic, WANOK.MapEditor.GraphicsDevice); int width = MapEditor.TexCharacters[ev.Pages[0].Graphic].Width / frames; int height = MapEditor.TexCharacters[ev.Pages[0].Graphic].Height / ((int)ev.Pages[0].Graphic.Options[(int)SystemGraphic.OptionsEnum.Diagonal] == 0 ? 4 : 8); int[] texture = new int[] { (index % frames) * width, (index / frames) * height, width, height }; if (!Sprites[ev.Pages[0].Graphic].ContainsKey(texture)) { Sprites[ev.Pages[0].Graphic][texture] = new Sprites(); } Sprites[ev.Pages[0].Graphic][texture].Add(coords, new Sprite(ev.Pages[0].GraphicDrawType, new int[] { 0, 0 }, 0)); } }
// ------------------------------------------------------------------- // LoadEventSpriteTexture // ------------------------------------------------------------------- public void LoadSpriteTexture(SystemGraphic graphic) { if (!graphic.IsTileset()) { MapEditor.LoadSystemGraphic(graphic, Device); } }