//选择或变更图层 private void OnSelectGrid(Grid SelectGrid, MapFloor floor) { if (!SelectGrid.floors.Contains(floor)) { //添加到图层 SelectGrid.floors.Add(floor); floor.grids.Add(SelectGrid); } if (floor.belongArea is MonsterPursuitArea) { SelectGrid.areaId = floor.ID; //给怪物区加上areaid foreach (var mz in DataHelper.Instance.AllMonsterZoneData.floors.Values) { if (mz.X == SelectGrid.gridX && mz.Y == nImageGridNumY - SelectGrid.gridY) { (mz as MonsterFloor).PursuitId = floor.ID; } } } if (floor is Path) { Path _path = floor as Path; _path.OnDrawKeyPoint(SelectGrid); } }
//取消选择图层 private void CancelGrid(Grid SelectGrid, MapFloor floor) { if (SelectGrid.floors.Contains(floor)) { //取消选择 floor.grids.Remove(SelectGrid); SelectGrid.floors.Remove(floor); } }
//选择或变更图层 private void OnSelectGrid(Grid SelectGrid, MapFloor floor) { if (!SelectGrid.floors.Contains(floor)) { //添加到图层 SelectGrid.floors.Add(floor); floor.grids.Add(SelectGrid); } }
public override MapFloor AddMapFloor() { var floor = new MapFloor(this) { ID = AutoID, }; floor.Text = Text + floor.ID.ToString(); floors.Add(floor.ID, floor); return(floor); }
private void checkTrigger_CheckedChanged(object sender, EventArgs e) { if (checkTrigger.Checked) { checkObs.Checked = false; CurrentMapFloor = TriggerFloor; } else { checkObs.Checked = true; CurrentMapFloor = ObstructionFloor; } }
MapFloor FindMapFloor(TreeNode node) { var area = FindMapArea(node.Parent); if (area != null) { MapFloor floor = null; if (area.floors.TryGetValue(int.Parse(node.Name), out floor)) { return(floor); } } return(null); }
private void 打开图片ToolStripMenuItem_Click(object sender, EventArgs e) { DlgFileOpen.Filter = "png|*.png|jpg|*.jpg|bmp|*.bmp|所有文件|*.*"; DialogResult r = DlgFileOpen.ShowDialog(); if (r == DialogResult.OK) { if (File.Exists(DlgFileOpen.FileName)) { TheImage = Image.FromFile(DlgFileOpen.FileName); if (TheImage.Size != DisplayArea.Size) { MessageBox.Show($"导入图片必须是[{DisplayArea.Width}x{DisplayArea.Height}]像素大小!"); return; } //CurrentMapFloor = new MapFloor(CurrentMapArea); CurrentMapFloor = ObstructionFloor; XmlHelper.Instance.ImageFileName = DlgFileOpen.FileName; } } Invalidate(); }
public void AddMapFloor(MapFloor floor) { floors.Add(floor.ID, floor); _autoid = Math.Max(_autoid, floor.ID) + 1; }