Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Microsoft.DirectX.Direct3D;
- using System.Drawing;
- using MapleLib.WzLib.WzProperties;
- namespace WzExplorer.Mapping
- {
- class MapList
- {
- private string desc, Name;
- private WzCanvasProperty Dot;
- private WzVectorProperty DotOrigin;
- private Texture texture;
- private Point Spot;
- private Point _position = Point.Empty;
- private bool canDraw;
- private int type;
- public Microsoft.DirectX.DirectInput.Device Mouse;
- public MapList(Microsoft.DirectX.Direct3D.Device DxDevice, Microsoft.DirectX.DirectInput.Device mouse, int type, WzVectorProperty Spot, WzVectorProperty baseOrigin)
- {
- this.Mouse = mouse;
- switch (type)
- {
- case 0:
- Dot = ((WzCanvasProperty)Mapper.obj.wz.GetObjectFromPath("Map.wz/MapHelper.img/worldMap/mapImage/0"));
- DotOrigin = ((WzVectorProperty)Dot["origin"]);
- break;
- case 1:
- Dot = ((WzCanvasProperty)Mapper.obj.wz.GetObjectFromPath("Map.wz/MapHelper.img/worldMap/mapImage/1"));
- DotOrigin = ((WzVectorProperty)Dot["origin"]);
- break;
- case 2:
- Dot = ((WzCanvasProperty)Mapper.obj.wz.GetObjectFromPath("Map.wz/MapHelper.img/worldMap/mapImage/2"));
- DotOrigin = ((WzVectorProperty)Dot["origin"]); ;
- break;
- case 3:
- Dot = ((WzCanvasProperty)Mapper.obj.wz.GetObjectFromPath("Map.wz/MapHelper.img/worldMap/mapImage/3"));
- DotOrigin = ((WzVectorProperty)Dot["origin"]);
- break;
- }
- this.Spot = calPOS(baseOrigin, Spot);
- this.type = type;
- this.texture = Texture.FromBitmap(DxDevice, Dot.PngProperty.PNG, Usage.Dynamic, Pool.Default);
- }
- private Point calPOS(WzVectorProperty baseOrigin, WzVectorProperty imageOrigin)
- {
- Point fix = new Point(baseOrigin.X.ToInt() + imageOrigin.X.ToInt() - DotOrigin.X.ToInt(), baseOrigin.Y.ToInt() + imageOrigin.Y.ToInt() - DotOrigin.Y.ToInt());
- return fix;
- }
- public void Update()
- {
- _position = Mapper.obj.pos;
- Mapper.obj.Text = "Pos: " + _position.X + "/ " + _position.Y;
- if (_position.X >= Spot.X && _position.X <= Spot.X + Dot.PngProperty.PNG.Width)
- {
- if (_position.Y >= Spot.Y && _position.Y <= Spot.Y + Dot.PngProperty.PNG.Height)
- {
- canDraw = true;
- return;
- }
- }
- canDraw = false;
- }
- public void StaticDraw()
- {
- Mapper.sprite.Draw2D(texture, new Point(0, 0), 0f, new Point(Spot.X, Spot.Y), Color.White);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement