private void doubleBuffedPanel1_MouseClick(object sender, MouseEventArgs e) { if (!isPlayerRound) { return; } var x = (dragStartPos.X + baseX) / TileManager.CellSize; var y = (dragStartPos.Y + baseY) / TileManager.CellSize; if (stage == ControlStage.None) { if (mouseOnId <= 0) { return; } var targetUnit = battleManager.GetSam(mouseOnId); if (targetUnit.IsFinished || targetUnit.Camp != ConfigDatas.CampConfig.Indexer.Reborn) { return; } moveId = mouseOnId; EnterSelectMove(targetUnit); } else if (stage == ControlStage.SelectMove) { if (e.Button == MouseButtons.Left) //only left key { SelectAndMove(x, y); } else { moveId = 0; stage = ControlStage.None; savedPath = null; refreshAll.Fire(); } } else if (stage == ControlStage.AttackSelect) { if (e.Button == MouseButtons.Left)//only left key { var selectTarget = savedPath.Find(cell => cell.NowCell.X == x && cell.NowCell.Y == y); if (selectTarget != null) { var tileConfig = tileManager.GetTile(selectTarget.NowCell.X, selectTarget.NowCell.Y); if (tileConfig.Camp > 0) { DoAttack(attackId, tileConfig.UnitId); } } } else//右键取消攻击 { var atkUnit = battleManager.GetSam(attackId); AfterMove(atkUnit.X, atkUnit.Y); moveId = attackId; attackId = 0; refreshAll.Fire(); } } else if (stage == ControlStage.Decide) { battleMenu.Click(); } }