// ------------------------------------------------------------------- // AddMountain // ------------------------------------------------------------------- public bool AddMountain(int[] coords, int newId, Mountain newMountain) { bool modified = false; int height = WANOK.GetCoordsPixelHeight(coords); object[] before = ContainsMountain(height, coords); // Remplacing if (before == null) { modified = true; } else { int beforeId = (int)before[0]; Mountain beforeMountain = (Mountain)before[1]; if (beforeId != newId) { modified = true; } Mountains[height].Remove(coords, beforeId, height); } if (!Mountains.ContainsKey(height)) { Mountains[height] = new Mountains(); } Mountains[height].Add(coords, newId, newMountain, height); SystemTileset tileset = MapEditor.GetMapTileset(); object[] reliefTop = tileset.ReliefTop[tileset.Reliefs.IndexOf(newId)]; switch ((DrawType)reliefTop[0]) { case DrawType.Floors: AddFloor(new int[] { coords[0], coords[1] + newMountain.SquareHeight, coords[2] + newMountain.PixelHeight, coords[3] }, (int[])reliefTop[1]); break; case DrawType.Autotiles: int id = ((int[])reliefTop[1])[0]; if (id > 0) { AddAutotile(new int[] { coords[0], coords[1] + newMountain.SquareHeight, coords[2] + newMountain.PixelHeight, coords[3] }, id, true); } break; } return(modified); }
// ------------------------------------------------------------------- // UpdatePage // ------------------------------------------------------------------- public void UpdatePage(int i) { conditionsPanel1.InitializeListParameters(Control.Model.Pages[i].ConditionsTree.Tree); graphicControl1.InitializeListParameters(Control.Model.Pages[i].Graphic, MapEditor.GetMapTileset().Graphic); graphicControl1.GetComboBox().SelectedIndex = (int)Control.Model.Pages[i].GraphicDrawType; foreach (EventTrigger trigger in Enum.GetValues(typeof(EventTrigger))) { RadiosTrigger[trigger].Checked = false; } RadiosTrigger[Control.Model.Pages[i].Trigger].Checked = true; CommandsView.Nodes.Clear(); AddCommandNodes(Control.Model.Pages[i].CommandsTree, CommandsView.Nodes); // Move page tabControl1.TabPages[i].Controls.Clear(); tabControl1.TabPages[i].Controls.Add(panel1); panel1.Controls.Clear(); panel1.Controls.Add(tableLayoutMainPage); }