public void Add(MazeZone zone) { zoneList.Add(zone); }
/// <summary> /// On mouse down /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GlControl_MouseDown(object sender, MouseEventArgs e) { LastMousePos = e.Location; // No maze if (Maze == null) { return; } // Get maze coord Point coord = new Point((e.Location.X - Offset.X) / 25, (e.Location.Y - Offset.Y) / 25); if (!Maze.Contains(coord)) { return; } // Get the corresponding square Square block = Maze.GetSquare(coord); #region Middle button if (e.Button == MouseButtons.Middle) { LastMousePos = e.Location; Cursor = Cursors.SizeAll; return; } #endregion #region Left button else if (e.Button == MouseButtons.Left) { BlockCoord = coord; // Add wall if (WallBox.Checked) { if (block.Type == SquareType.Wall) { EditWallType = SquareType.Illusion; } else { EditWallType = SquareType.Wall; } block.Type = EditWallType; } else if (NoGhostsBox.Checked) { block.NoGhost = true; } else if (NoMonstersBox.Checked) { block.NoMonster = true; } #region Zone else if (ZoneBox.Checked) { CurrentZone = new MazeZone(); CurrentZone.Rectangle = new Rectangle(coord, new Size(1, 1)); } #endregion // Select object else { if (PreviewLoc.Coordinate == BlockCoord) { DragPreview = true; } } } #endregion #region Right button else if (e.Button == MouseButtons.Right) { if (WallBox.Checked) { block.Type = SquareType.Ground; } else if (NoGhostsBox.Checked) { block.NoGhost = false; } else if (NoMonstersBox.Checked) { block.NoMonster = false; } } #endregion }
static void XMLInfoEditor() { GUILayout.BeginHorizontal(); GUILayout.Label("MazeID"); maze.MazeID = GUILayout.TextField(maze.MazeID); GUILayout.Label("MazeName"); maze.MazeName = GUILayout.TextField(maze.MazeName); GUILayout.Label("BattleName"); maze.BattleName = GUILayout.TextField(maze.BattleName); GUILayout.Label("MazeStyle"); maze.MazeStyle = GUILayout.TextField(maze.MazeStyle); GUILayout.Label("MazeNpc"); maze.MazeNpc = GUILayout.TextField(maze.MazeNpc); GUILayout.EndHorizontal(); for (int i = 0; i < maze.zoneList.Count; i++) { GUILayout.BeginVertical(); ZoneScrollPos_ = GUILayout.BeginScrollView(ZoneScrollPos_, GUILayout.Width(200), GUILayout.Height(100)); GUILayout.Label("mfloor"); ((MazeZone)maze.zoneList[i]).Level = GUILayout.TextField(((MazeZone)maze.zoneList[i]).Level); GUILayout.Label("mEntrySceneID"); ((MazeZone)maze.zoneList[i]).EntrySceneID = GUILayout.TextField(((MazeZone)maze.zoneList[i]).EntrySceneID); GUILayout.Label("mEntryID"); ((MazeZone)maze.zoneList[i]).EntryID = GUILayout.TextField(((MazeZone)maze.zoneList[i]).EntryID); GUILayout.Label("MazeMonster"); ((MazeZone)maze.zoneList[i]).MazeMonster = GUILayout.TextField(((MazeZone)maze.zoneList[i]).MazeMonster); GUILayout.Label("MazeMonsterMaxNum"); ((MazeZone)maze.zoneList[i]).MazeMonsterMaxNum = GUILayout.TextField(((MazeZone)maze.zoneList[i]).MazeMonsterMaxNum); GUILayout.Label("MazeMonsterMinNum"); ((MazeZone)maze.zoneList[i]).MazeMonsterMinNum = GUILayout.TextField(((MazeZone)maze.zoneList[i]).MazeMonsterMinNum); GUILayout.Label("Rate"); ((MazeZone)maze.zoneList[i]).Rate = GUILayout.TextField(((MazeZone)maze.zoneList[i]).Rate); if (GUILayout.Button("Delete")) { maze.zoneList.RemoveAt(i); } GUILayout.EndScrollView(); GUILayout.EndVertical(); } GUILayout.BeginVertical(); if (GUILayout.Button("AddMzone")) { MazeZone mzone = new MazeZone(); mzone.EntrySceneID = sEntrySceneId; mzone.EntryID = sEntryId; mzone.Level = sfloor; mzone.MazeMonster = MazeMonster; mzone.MazeMonsterMaxNum = MazeMonsterMaxNum; mzone.MazeMonsterMinNum = MazeMonsterMinNum; mzone.Rate = rate; maze.Add(mzone); } if (GUILayout.Button("Save")) { CreateXml(maze); } GUILayout.EndVertical(); }
/// <summary> /// On mouse down /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GlControl_MouseDown(object sender, MouseEventArgs e) { LastMousePos = e.Location; // No maze if (Maze == null) return; // Get maze coord Point coord = new Point((e.Location.X - Offset.X) / 25, (e.Location.Y - Offset.Y) / 25); if (!Maze.Contains(coord)) return; // Get the corresponding square Square block = Maze.GetSquare(coord); #region Middle button if (e.Button == MouseButtons.Middle) { LastMousePos = e.Location; Cursor = Cursors.SizeAll; return; } #endregion #region Left button else if (e.Button == MouseButtons.Left) { BlockCoord = coord; // Add wall if (WallBox.Checked) { if (block.Type == SquareType.Wall) EditWallType = SquareType.Illusion; else EditWallType = SquareType.Wall; block.Type = EditWallType; } else if (NoGhostsBox.Checked) { block.NoGhost = true; } else if (NoMonstersBox.Checked) { block.NoMonster = true; } #region Zone else if (ZoneBox.Checked) { CurrentZone = new MazeZone(); CurrentZone.Rectangle = new Rectangle(coord, new Size(1, 1)); } #endregion // Select object else { if (PreviewLoc.Coordinate == BlockCoord) DragPreview = true; } } #endregion #region Right button else if (e.Button == MouseButtons.Right) { if (WallBox.Checked) { block.Type = SquareType.Ground; } else if (NoGhostsBox.Checked) { block.NoGhost = false; } else if (NoMonstersBox.Checked) { block.NoMonster = false; } } #endregion }