private void dgvGameState_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0 || e.RowIndex >= dgvGameState.RowCount) { return; } if (e.ColumnIndex < 0 || e.ColumnIndex >= dgvGameState.Rows[e.RowIndex].Cells.Count) { return; } if (!(dgvGameState.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag is State selectedState)) { return; } if (selectedState.Equals(_model.CommittedState)) { NavigateEvent?.Invoke(sender, new BoardNavigationEventArgs { EventType = NavigationEventType.ClearMove, Selected = selectedState }); } else { NavigateEvent?.Invoke(sender, new BoardNavigationEventArgs { EventType = NavigationEventType.ShowHistory, Selected = selectedState }); } }
private void btnSaveEdits_Click(object sender, EventArgs e) { NavigateEvent?.Invoke(sender, new BoardNavigationEventArgs { EventType = NavigationEventType.Editor, Selected = _model.EditorState }); }
private void lstAvailableMoves_SelectedIndexChanged(object sender, EventArgs e) { if (!(lstAvailableMoves.SelectedItem is ProposedState ps)) { return; } if (!(ps.Action is GameAction ga)) { return; } moveListClicked = true; NavigateEvent?.Invoke(sender, new BoardNavigationEventArgs { EventType = NavigationEventType.ClearMove }); if (ga is GameTargetAction gta) { InputEvent?.Invoke(sender, new BoardLocationEventArgs { Location = ga.Location, MouseEvent = BoardMouseEventType.LeftDragStart }); InputEvent?.Invoke(sender, new BoardLocationEventArgs { Location = gta.Target, MouseEvent = BoardMouseEventType.LeftDragEnd }); } else { InputEvent?.Invoke(sender, new BoardLocationEventArgs { Location = ga.Location, MouseEvent = BoardMouseEventType.LeftClick }); } _model.SelectedVariation = ga.Size; RedrawBoard(); BoardEditorUpdate(); moveListClicked = false; }
public override void OnMove(AxisEventData eventData) { if (OverrideNavigation) { OnNavigate.Invoke(eventData); } else { DoMove(eventData); } }
private void btnImportBoard_Click(object sender, EventArgs e) { try { NavigateEvent?.Invoke(sender, new BoardNavigationEventArgs { EventType = NavigationEventType.LoadGame, Selected = StateSerializer.FromString(txtBoardData.Text.Trim()) }); } catch (Exception ex) { MessageBox.Show(this, ex.ToString(), "Unable to load board"); } }
private void btnNewGame_Click(object sender, EventArgs e) { if (_model.EditMode) { NavigateEvent?.Invoke(sender, new BoardNavigationEventArgs { EventType = NavigationEventType.ToggleEditMode }); } NavigateEvent?.Invoke(sender, new BoardNavigationEventArgs { EventType = NavigationEventType.NewGame, Selected = StateManager.Create() }); btnCommitMove.Select(); }
public void SendNavigateMessage(NavigateMessageArgs args) { NavigateEvent?.Invoke(this, args); }
private void btnCommitMove_Click(object sender, EventArgs e) { NavigateEvent?.Invoke(sender, new BoardNavigationEventArgs { EventType = NavigationEventType.CommitMove }); }
private void btnEditBoard_Click(object sender, EventArgs e) { NavigateEvent?.Invoke(sender, new BoardNavigationEventArgs { EventType = NavigationEventType.ToggleEditMode }); }