Changeset 203 for trunk/Forms


Ignore:
Timestamp:
May 18, 2018, 12:54:37 AM (7 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.
Location:
trunk/Forms
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormClient.lfm

    r202 r203  
    11object FormClient: TFormClient
    2   Left = 418
     2  Left = 662
    33  Height = 621
    4   Top = 253
     4  Top = 413
    55  Width = 775
    66  Caption = 'Client'
    77  ClientHeight = 621
    88  ClientWidth = 775
    9   DesignTimePPI = 120
     9  DesignTimePPI = 144
    1010  OnClose = FormClose
    1111  OnCreate = FormCreate
     
    1717  object StatusBar1: TStatusBar
    1818    Left = 0
    19     Height = 28
    20     Top = 593
     19    Height = 30
     20    Top = 591
    2121    Width = 775
    2222    Panels = <   
     
    3434  object ToolBar1: TToolBar
    3535    Left = 0
    36     Height = 593
     36    Height = 591
    3737    Top = 0
    3838    Width = 32
     
    7575  object PaintBox1: TPaintBox
    7676    Left = 32
    77     Height = 593
     77    Height = 591
    7878    Top = 0
    7979    Width = 743
     
    132132      ImageIndex = 0
    133133      OnExecute = AGameEndTurnExecute
     134      ShortCut = 16468
    134135    end
    135136  end
  • 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;
  • trunk/Forms/UFormMain.lfm

    r181 r203  
    11object FormMain: TFormMain
    2   Left = 447
     2  Left = 801
    33  Height = 621
    4   Top = 303
     4  Top = 352
    55  Width = 775
    66  Caption = 'xTactics'
    7   ClientHeight = 596
     7  ClientHeight = 587
    88  ClientWidth = 775
    9   DesignTimePPI = 120
     9  DesignTimePPI = 144
    1010  Menu = MainMenu1
    1111  OnClose = FormClose
     
    1313  OnDestroy = FormDestroy
    1414  OnShow = FormShow
    15   LCLVersion = '1.8.0.6'
     15  LCLVersion = '1.8.2.0'
    1616  WindowState = wsMaximized
    1717  object ToolBar1: TToolBar
     
    7777  object PanelMain: TPanel
    7878    Left = 0
    79     Height = 556
     79    Height = 547
    8080    Top = 40
    8181    Width = 775
     
    9292      object MenuItem2: TMenuItem
    9393        Action = Core.AGameNew
     94        Caption = 'New...'
    9495      end
    9596      object MenuItem3: TMenuItem
     
    99100        Action = Core.AGameRestart
    100101      end
    101       object MenuItem4: TMenuItem
    102         Action = Core.AGameEndTurn
    103       end
    104102      object MenuItem14: TMenuItem
    105103        Action = Core.AGameLoad
     
    110108      object MenuItem15: TMenuItem
    111109        Action = Core.AGameSave
     110        ShortCut = 16467
     111      end
     112      object MenuItem29: TMenuItem
     113        Action = Core.AGameSaveAs
     114        Caption = 'Save as'
     115        ShortCut = 24659
    112116      end
    113117      object MenuItem5: TMenuItem
  • trunk/Forms/UFormMain.pas

    r196 r203  
    4343    MenuItem27: TMenuItem;
    4444    MenuItem28: TMenuItem;
     45    MenuItem29: TMenuItem;
    4546    MenuItemLoadRecent: TMenuItem;
    4647    MenuItem3: TMenuItem;
    47     MenuItem4: TMenuItem;
    4848    MenuItem5: TMenuItem;
    4949    MenuItem6: TMenuItem;
Note: See TracChangeset for help on using the changeset viewer.