private void btnOK_Click(object sender, EventArgs e) { int index = comboBox1.SelectedIndex; _spawnPoint.objectID = _templates[index].TypeID; if (ctrl != null) _spawnPoint.bytes = ctrl.GetObjectBytes(); if (_spawnPoint.objectID == -1) _spawnPoint = null; DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); }
public frmObjectDialog(int x, int y, SpawnPoint sp) { InitializeComponent(); _spawnPoint = sp; if (_spawnPoint == null) { _spawnPoint = new SpawnPoint(); _spawnPoint.objectID = -1; _spawnPoint.X = x; _spawnPoint.Y = y; } }
public Map(string fileName) { _dummy = new IGORR.Server.Logic.DummyMap(); font = ContentInterface.LoadFont("font"); _fileName = fileName; BinaryReader reader = new BinaryReader(File.OpenRead(_fileName)); int sizeX = reader.ReadInt32(); int sizeY = reader.ReadInt32(); tileSetName = reader.ReadString(); tileSet = ContentInterface.LoadTexture(tileSetName); /* int tpCount = reader.ReadInt32(); for (int x = 0; x < tpCount; x++) { TeleportPoint point = new TeleportPoint(); point.mapID = reader.ReadInt32(); point.X = reader.ReadInt32(); point.Y = reader.ReadInt32(); _teleportPoints.Add(point); } */ _layers = new Tile[3][,]; for (int layer = 0; layer < 3; layer++) { _layers[layer] = new Tile[sizeX, sizeY]; for (int x = 0; x < sizeX; x++) for (int y = 0; y < sizeY; y++) { int tileID=reader.ReadInt32(); if (tileID >= 0 && tileID * tileSize < tileSet.Width) _layers[layer][x, y] = new Tile(tileSet, new Rectangle(x * tileSize, y * tileSize, tileSize, tileSize), new Rectangle(tileID * tileSize, 0, tileSize, tileSize)); else _layers[layer][x, y] = null; } } _spawns = new SpawnPoint[sizeX, sizeY]; try { for (int x = 0; x < sizeX; x++) for (int y = 0; y < sizeY; y++) { int objectID = reader.ReadInt32(); if (objectID >= 0) { _spawns[x, y] = new SpawnPoint(); _spawns[x, y].objectID = objectID; _spawns[x, y].X = x; _spawns[x, y].Y = y; if (objectID > 0) { ObjectControl ctrl =ModuleManager.GetControl(objectID, reader); if (ctrl != null) _spawns[x, y].bytes = ctrl.GetObjectBytes(); //ModuleManager.SpawnByIdServer(_dummy, objectID, 0, Point.Zero, reader); } } else _spawns[x, y] = null; } } catch (Exception e) { System.Windows.Forms.MessageBox.Show("Error loading objects in the map, you can still continue though"); } reader.Close(); _teleportPoints.Clear(); }
private void btnRemove_Click(object sender, EventArgs e) { _spawnPoint = null; DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); }