public Map() { Id = Guid.NewGuid(); Layers = new List<MapLayer>(); CollisionLayer = new MapCollisionLayer(Width, Height); MapEvents = new List<Event>(); MapEnemies = new List<Enemy>(); MapNpcs = new List<Npc>(); MapObjects = new List<MapObject>(); MapMatrix = new MapMatrix(); }
public Map(int width, int height) { Id = Guid.NewGuid(); Width = width; Height = height; Layers = new List<MapLayer>(); CollisionLayer = new MapCollisionLayer(Width, Height); MapMatrix = new MapMatrix(width, height); MapEvents = new List<Event>(); MapEnemies = new List<Enemy>(); MapNpcs = new List<Npc>(); MapObjects = new List<MapObject>(); }
/// <summary> /// Initializes the control. /// </summary> protected override void Initialize() { Content = new ContentManager(Services, "Content"); SpriteBatch = new SpriteBatch(GraphicsDevice); basicEffect = new BasicEffect(GraphicsDevice); basicEffect.VertexColorEnabled = true; MaxCellSize = new Vector2(64, 64); SelectedIndex = -1; // Criando as linhas que separam visualmente os objetos Lines = Editor.SpriteCollection.Count + 1; if (Editor.SpriteCollection.Count * MaxCellSize.Y <= Parent.Height) { Dock = DockStyle.Fill; } else { Height = (int)Math.Ceiling(Editor.SpriteCollection.Count*MaxCellSize.Y); } Size = new Size(Parent.Width, Height); //this.Width = Parent.Width; SelectionMatrix = new MapMatrix(); SelectionMatrix.Width = 1; SelectionMatrix.Height = Lines; SelectionMatrix.Size = MaxCellSize; // Hook the idle event to constantly redraw our animation. Application.Idle += delegate { Invalidate(); }; }
/// <summary> /// Initializes the control. /// </summary> protected override void Initialize() { Content = new ContentManager(Services, "Content"); SpriteBatch = new SpriteBatch(GraphicsDevice); basicEffect = new BasicEffect(GraphicsDevice); basicEffect.VertexColorEnabled = true; MaxCellSize = new Vector2(Width / Columns, (Width / Columns) * 1.2f); SelectedIndex = -1; ScrollAmount = Vector2.Zero; // Criando as linhas que separam visualmente os objetos Lines = (int)Math.Ceiling((decimal)(Characters.Count / Columns)) + 1; var minLineCount = (int) Math.Ceiling(Height / (decimal) MaxCellSize.Y) + 1; SelectionMatrix = new MapMatrix { Width = Columns + 1, Height = Math.Max(Lines, minLineCount) }; Lines = SelectionMatrix.Height; SelectionMatrix.Size = MaxCellSize; // Hook the idle event to constantly redraw our animation. Application.Idle += delegate { Invalidate(); }; }