Ignore:
Timestamp:
May 18, 2018, 12:54:37 AM (6 years ago)
Author:
chronos
Message:
  • Fixed: Player turn start/end signaling from server to clients.
  • Added: Save action to save game without opening save dialog.
  • Fixed: Move dialog was not opened after new game was created.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormClient.pas

    r202 r203  
    7676    LastTimerTime: TDateTime;
    7777    TimerPeriod: TDateTime;
     78    TurnActive: Boolean;
    7879    procedure SetClient(AValue: TClient);
    7980    procedure DoClientChange(Sender: TObject);
    80     procedure DoOnMove(CellFrom, CellTo: TCell; var CountOnce,
     81    procedure DoTurnStart(Sender: TObject);
     82    procedure DoMove(CellFrom, CellTo: TCell; var CountOnce,
    8183      CountRepeat: Integer; Update: Boolean; var Confirm: Boolean);
    8284  public
    8385    procedure LoadConfig(Config: TXmlConfig; Path: string);
    8486    procedure SaveConfig(Config: TXmlConfig; Path: string);
    85     procedure ReloadView;
     87    procedure UpdateInterface;
    8688    procedure Redraw;
    8789    property Client: TClient read FClient write SetClient;
     
    103105{ TFormClient }
    104106
    105 procedure TFormClient.DoOnMove(CellFrom, CellTo: TCell; var CountOnce,
     107procedure TFormClient.DoMove(CellFrom, CellTo: TCell; var CountOnce,
    106108  CountRepeat: Integer; Update: Boolean; var Confirm: Boolean);
    107109var
     
    210212    FClient.Form := Self;
    211213    FClient.OnChange := DoClientChange;
    212     FClient.OnMove := DoOnMove;
     214    FClient.OnMove := DoMove;
     215    FClient.OnTurnStart := DoTurnStart();
    213216  end;
    214217  Redraw;
     
    218221begin
    219222  Redraw;
     223end;
     224
     225procedure TFormClient.DoTurnStart(Sender: TObject);
     226begin
     227  TurnActive := True;
     228  UpdateInterface;
    220229end;
    221230
     
    238247end;
    239248
    240 procedure TFormClient.ReloadView;
     249procedure TFormClient.UpdateInterface;
    241250begin
    242251  if AToolBarBigIcons.Checked then begin
     
    255264  ToolBar1.Visible := AToolBarVisible.Checked;
    256265  StatusBar1.Visible := AStatusBarVisible.Checked;
     266  AGameEndTurn.Enabled := TurnActive;
    257267end;
    258268
     
    295305begin
    296306  AToolBarBigIcons.Checked := not AToolBarBigIcons.Checked;
    297   ReloadView;
     307  UpdateInterface;
    298308end;
    299309
     
    301311begin
    302312  AStatusBarVisible.Checked := not AStatusBarVisible.Checked;
    303   ReloadView;
     313  UpdateInterface;
    304314end;
    305315
    306316procedure TFormClient.AGameEndTurnExecute(Sender: TObject);
    307 var
    308   P: TGameProtocolClient;
    309   P2: TCommPin;
    310 begin
    311   P := Client.Protocol;
    312   P2 := P.Pin;
     317begin
     318  TurnActive := False;
    313319  Client.Protocol.TurnEnd;
     320  UpdateInterface;
    314321end;
    315322
     
    317324begin
    318325  AToolBarVisible.Checked := not AToolBarVisible.Checked;
    319   ReloadView;
     326  UpdateInterface;
    320327end;
    321328
     
    370377  LoadConfig(Core.XMLConfig1, 'FormClient');
    371378  Core.PersistentForm.Load(Self);
    372   ReloadView;
     379  UpdateInterface;
    373380  Redraw;
    374381end;
Note: See TracChangeset for help on using the changeset viewer.