Changeset 206 for trunk/UCore.pas


Ignore:
Timestamp:
May 21, 2018, 2:50:02 PM (6 years ago)
Author:
chronos
Message:
  • Added: New window to list all available actions with their keyboard shortcuts.
  • Fixed: Keyboard shortcuts didn't worked for FormClient docked into FormMain.
  • Fixed: Signal a turn start to first player if a game is loaded from a file.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UCore.pas

    r203 r206  
    1717  TCore = class(TDataModule)
    1818    AAbout: TAction;
     19    AShowKeyShortcuts: TAction;
    1920    AGameSave: TAction;
    2021    APlayersStats: TAction;
     
    2728    ApplicationInfo: TApplicationInfo;
    2829    ASettings: TAction;
    29     ActionList1: TActionList;
     30    ActionListMain: TActionList;
    3031    AExit: TAction;
    3132    AGameEnd: TAction;
     
    5556    procedure ASettingsExecute(Sender: TObject);
    5657    procedure AShowChartsExecute(Sender: TObject);
     58    procedure AShowKeyShortcutsExecute(Sender: TObject);
    5759    procedure AShowUnitMovesExecute(Sender: TObject);
    5860    procedure CoolTranslator1Translate(Sender: TObject);
     
    8183    procedure RedrawClients;
    8284    procedure UpdateOtherForms;
     85    procedure FormClientActions;
    8386  public
    8487    Game: TGame;
     
    109112
    110113uses
    111   UFormMain, UFormNew, UFormSettings, UFormAbout, UClientAI,
     114  UFormMain, UFormNew, UFormSettings, UFormAbout, UClientAI, UFormKeyShortcuts,
    112115  UFormHelp, UFormCharts, UFormUnitMoves, UFormPlayersStats;
    113116
     
    373376end;
    374377
     378procedure TCore.AShowKeyShortcutsExecute(Sender: TObject);
     379begin
     380  if not Assigned(FormKeyShortcuts) then FormKeyShortcuts := TFormKeyShortcuts.Create(nil);
     381  FormKeyShortcuts.Show;
     382end;
     383
    375384procedure TCore.AShowUnitMovesExecute(Sender: TObject);
    376385begin
     
    382391begin
    383392  UGame.InitStrings;
     393  CoolTranslator1.TranslateComponentRecursive(FormClient);
    384394end;
    385395
     
    409419  if Assigned(FormUnitMoves) then FreeAndNil(FormUnitMoves);
    410420  if Assigned(FormCharts) then FreeAndNil(FormCharts);
     421  if Assigned(FormKeyShortcuts) then FreeAndNil(FormKeyShortcuts);
    411422  FreeAndNil(FormClients);
    412423  FreeAndNil(StoredDimension);
     
    431442  Player: TPlayer;
    432443  NewClient: TClient;
     444  ServerClient: TServerClient;
    433445begin
    434446  GameLoaded := True;
     
    473485  RedrawClients;
    474486  UpdateOtherForms;
     487  UpdateActions;
     488  ServerClient := Server.Clients.SearchByPlayer(Game.CurrentPlayer);
     489  if Assigned(ServerClient) then ServerClient.TurnStart
     490    else raise Exception.Create('Server client for current player not found.');
    475491end;
    476492
     
    489505  if Assigned(FormUnitMoves) and FormUnitMoves.Visible then FormUnitMoves.ReloadList;
    490506  if Assigned(FormPlayersStats) and FormPlayersStats.Visible then FormPlayersStats.ReloadList;
     507end;
     508
     509procedure TCore.FormClientActions;
     510var
     511  Action: TAction;
     512  I: Integer;
     513begin
     514  for I := 0 to FormClient.ActionList1.ActionCount - 1 do begin
     515    Action := TAction.Create(FormMain);
     516    Action.Assign(TAction(FormClient.ActionList1.Actions[I]));
     517    Action.ActionList := FormMain.ActionList1;
     518  end;
    491519end;
    492520
     
    597625      LoadGame(LastOpenedList1.Items[0]);
    598626    ScaleDPI;
     627    FormClientActions;
    599628
    600629    if Game.FileName = '' then StartNewGame;
Note: See TracChangeset for help on using the changeset viewer.