Changeset 213 for trunk/Forms/UFormClient.pas
- Timestamp:
- May 24, 2018, 9:25:17 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.