public void OnMouseEnter() { if (GridState.MouseDown == true) { if (GridState.Draw == GridState.DrawState.Wall) { MyNode.IsWall = !MyNode.IsWall; StateHasChanged(); } else if (GridState.Draw == GridState.DrawState.Start) { GridState.Grid[GridState.StartNodeRow][GridState.StartNodeColumn].IsStart = false; MyNode.IsStart = true; GridState.StartNodeRow = MyNode.Row; GridState.StartNodeColumn = MyNode.Column; GridState.RerenderEventInvoke(new EventArgs()); } else if (GridState.Draw == GridState.DrawState.Finish) { GridState.Grid[GridState.FinishNodeRow][GridState.FinishNodeColumn].IsFinish = false; MyNode.IsFinish = true; GridState.FinishNodeRow = MyNode.Row; GridState.FinishNodeColumn = MyNode.Column; GridState.RerenderEventInvoke(new EventArgs()); } else if (GridState.Draw == GridState.DrawState.Weight) { if (MyNode.Weight != 2) { MyNode.Weight = 2; } else { MyNode.Weight = 0; } StateHasChanged(); } } }
public void OnMouseDown() { GridState.MouseDown = true; if (GridState.Draw == GridState.DrawState.Wall) { MyNode.IsFinish = false; MyNode.IsStart = false; MyNode.IsBomb = false; MyNode.Weight = 0; MyNode.IsWall = !MyNode.IsWall; StateHasChanged(); } else if (GridState.Draw == GridState.DrawState.Start) { MyNode.IsFinish = false; MyNode.IsWall = false; MyNode.IsBomb = false; MyNode.Weight = 0; GridState.Grid[GridState.StartNodeRow][GridState.StartNodeColumn].IsStart = false; MyNode.IsStart = true; GridState.StartNodeRow = MyNode.Row; GridState.StartNodeColumn = MyNode.Column; GridState.RerenderEventInvoke(new EventArgs()); } else if (GridState.Draw == GridState.DrawState.Finish) { MyNode.IsStart = false; MyNode.IsWall = false; MyNode.IsBomb = false; MyNode.Weight = 0; GridState.Grid[GridState.FinishNodeRow][GridState.FinishNodeColumn].IsFinish = false; MyNode.IsFinish = true; GridState.FinishNodeRow = MyNode.Row; GridState.FinishNodeColumn = MyNode.Column; GridState.RerenderEventInvoke(new EventArgs()); } else if (GridState.Draw == GridState.DrawState.Weight) { MyNode.IsFinish = false; MyNode.IsStart = false; MyNode.IsWall = false; MyNode.IsBomb = false; if (MyNode.Weight != 2) { MyNode.Weight = 2; } else { MyNode.Weight = 0; } StateHasChanged(); } else if (GridState.Draw == GridState.DrawState.Bomb) { MyNode.IsFinish = false; MyNode.IsStart = false; MyNode.IsWall = false; MyNode.Weight = 0; if (MyNode.IsBomb) { GridState.Bombs.Remove(MyNode); MyNode.IsBomb = false; MyNode.BombOrder = 0; } else { GridState.Bombs.Add(MyNode); MyNode.IsBomb = true; MyNode.BombOrder = GridState.Bombs.Count; } StateHasChanged(); } }