Changeset 213 for trunk/Forms
- Timestamp:
- May 24, 2018, 9:25:17 PM (7 years ago)
- Location:
- trunk/Forms
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormClient.lfm
r211 r213 52 52 object ToolButton6: TToolButton 53 53 Left = 1 54 Top = 3954 Top = 71 55 55 Action = AZoomIn 56 56 end 57 57 object ToolButton7: TToolButton 58 58 Left = 1 59 Top = 7159 Top = 103 60 60 Action = AZoomOut 61 61 end 62 62 object ToolButton8: TToolButton 63 63 Left = 1 64 Top = 1 0364 Top = 135 65 65 Action = AZoomAll 66 66 end 67 67 object ToolButton9: TToolButton 68 68 Left = 1 69 Top = 3469 Top = 66 70 70 Width = 32 71 71 AutoSize = True 72 72 Style = tbsDivider 73 end 74 object ToolButton1: TToolButton 75 Left = 1 76 Top = 34 77 Action = ASurrender 73 78 end 74 79 end … … 134 139 ShortCut = 16468 135 140 end 141 object ASurrender: TAction 142 Caption = 'Surrender' 143 ImageIndex = 4 144 OnExecute = ASurrenderExecute 145 end 136 146 end 137 147 object PopupMenuToolbar: TPopupMenu -
trunk/Forms/UFormClient.pas
r211 r213 19 19 20 20 TFormClient = class(TForm) 21 ASurrender: TAction; 21 22 AGameEndTurn: TAction; 22 23 AStatusBarVisible: TAction; … … 33 34 Timer1: TTimer; 34 35 ToolBar1: TToolBar; 36 ToolButton1: TToolButton; 35 37 ToolButton2: TToolButton; 36 38 ToolButton6: TToolButton; … … 40 42 procedure AGameEndTurnExecute(Sender: TObject); 41 43 procedure AStatusBarVisibleExecute(Sender: TObject); 44 procedure ASurrenderExecute(Sender: TObject); 42 45 procedure AToolBarBigIconsExecute(Sender: TObject); 43 46 procedure AToolBarVisibleExecute(Sender: TObject); … … 80 83 procedure DoClientChange(Sender: TObject); 81 84 procedure DoGameEnd(Sender: TObject); 85 procedure DoNextPlayer(Sender: TObject); 82 86 procedure DoTurnStart(Sender: TObject); 83 87 procedure DoMove(CellFrom, CellTo: TCell; var CountOnce, … … 103 107 resourcestring 104 108 STurn = 'turn'; 109 SSurrender = 'Surrender'; 110 SSurrenderQuestion = 'Do you want to surrender current game?'; 105 111 106 112 {$R *.lfm} … … 233 239 FClient.OnDestroy := DoClientDestroy; 234 240 FClient.OnGameEnd := DoGameEnd; 241 FClient.OnNextPlayer := DoNextPlayer; 235 242 FClient.View.DestRect := TRect.CreateBounds(TPoint.Create(0, 0), TPoint.Create(PaintBox1.Width, PaintBox1.Height)); 236 243 end; … … 248 255 end; 249 256 257 procedure TFormClient.DoNextPlayer(Sender: TObject); 258 begin 259 Redraw; 260 end; 261 250 262 procedure TFormClient.DoTurnStart(Sender: TObject); 251 263 begin 252 264 TurnActive := True; 253 Synchronize(UpdateInterface);254 Synchronize(Redraw);265 UpdateInterface; 266 Redraw; 255 267 end; 256 268 … … 290 302 ToolBar1.Visible := AToolBarVisible.Checked; 291 303 StatusBar1.Visible := AStatusBarVisible.Checked; 292 AGameEndTurn.Enabled := TurnActive; 304 AGameEndTurn.Enabled := Assigned(Client.ControlPlayer) and 305 Client.ControlPlayer.IsAlive and TurnActive; 306 ASurrender.Enabled := Assigned(Client.ControlPlayer) and 307 Client.ControlPlayer.IsAlive; 293 308 end; 294 309 … … 339 354 AStatusBarVisible.Checked := not AStatusBarVisible.Checked; 340 355 UpdateInterface; 356 end; 357 358 procedure TFormClient.ASurrenderExecute(Sender: TObject); 359 begin 360 if MessageDlg(SSurrender, SSurrenderQuestion, mtConfirmation, mbYesNo, 0) = 361 mrYes then begin 362 Client.Protocol.Surrender; 363 UpdateInterface; 364 end; 341 365 end; 342 366
Note:
See TracChangeset
for help on using the changeset viewer.