Ignore:
Timestamp:
Jun 21, 2024, 12:44:53 PM (5 months ago)
Author:
chronos
Message:
  • Modified: Remove U prefix from unit names.
  • Modified: Use TFormEx for all forms for code simplification.
File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Forms/FormClient.pas

    r316 r317  
    1 unit UFormClient;
     1unit FormClient;
    22
    33interface
     
    55uses
    66  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
    7   UGame, LCLType, Menus, ActnList, ComCtrls, dateutils, XMLConf, DOM, Math,
    8   UGeometry, UGameClient, UGameProtocol, Threading, UPlayer, UClientGUI, UFormMain;
     7  Game, LCLType, Menus, ActnList, ComCtrls, dateutils, XMLConf, DOM, Math,
     8  Geometry, GameClient, GameProtocol, Threading, Player, ClientGUI,
     9  FormEx, Generics.Collections;
    910
    1011const
     
    1819  { TFormClient }
    1920
    20   TFormClient = class(TForm)
     21  TFormClient = class(TFormEx)
    2122    ASurrender: TAction;
    2223    AGameEndTurn: TAction;
     
    9394    procedure DoClientDestroy(Sender: TObject);
    9495  public
    95     FormMain: TFormMain;
    9696    procedure LoadConfig(Config: TXmlConfig; Path: string);
    9797    procedure SaveConfig(Config: TXmlConfig; Path: string);
     
    101101  end;
    102102
    103 var
    104   FormClient: TFormClient;
     103  TFormClients = class(TObjectList<TFormClient>)
     104  end;
    105105
    106106const
     
    111111
    112112uses
    113   UCore, UFormMove;
     113  Core, FormMove;
    114114
    115115resourcestring
     
    321321  if RedrawPending and not Drawing then begin
    322322    Drawing := True;
    323     if not Core.DevelMode then RedrawPending := False;
     323    if not Core.Core.DevelMode then RedrawPending := False;
    324324    TimerPeriod := (9 * TimerPeriod + (Now - LastTimerTime)) / 10;
    325325    LastTimerTime := Now;
     
    327327    StatusBar1.Panels[1].Text := IntToStr(Trunc(DrawDuration / OneMillisecond)) + ' / ' +
    328328      IntToStr(Trunc(TimerPeriod / OneMillisecond)) + ' ms' +
    329       ' ' + IntToStr(Core.Game.Map.CellLinks.Count);
     329      ' ' + IntToStr(Core.Core.Game.Map.CellLinks.Count);
    330330    NewCaption := 'xTactics';
    331     if Assigned(Core.Game.CurrentPlayer) then
    332       NewCaption := Core.Game.CurrentPlayer.Name + ' - ' + STurn + ' ' + IntToStr(Core.Game.TurnCounter) + ' - ' + NewCaption;
     331    if Assigned(Core.Core.Game.CurrentPlayer) then
     332      NewCaption := Core.Core.Game.CurrentPlayer.Name + ' - ' + STurn + ' ' + IntToStr(Core.Core.Game.TurnCounter) + ' - ' + NewCaption;
    333333    Caption := NewCaption;
    334334    Drawing := False;
     
    350350    FClient.OnNextPlayer := DoNextPlayer;
    351351    FClient.View.DestRect := TRect.CreateBounds(TPoint.Create(0, 0), TPoint.Create(PaintBox1.Width, PaintBox1.Height));
    352     FClient.CellGridVisible := Core.CellGridVisible;
    353     FClient.UnitShapeVisible := Core.UnitShapeVisible;
     352    FClient.CellGridVisible := Core.Core.CellGridVisible;
     353    FClient.UnitShapeVisible := Core.Core.UnitShapeVisible;
    354354  end;
    355355  Redraw;
     
    399399begin
    400400  if AToolBarBigIcons.Checked then begin
    401     ToolBar1.Images := Core.ImageListLarge;
    402     ToolBar1.ButtonWidth := Core.ImageListLarge.Width + 7;
    403     ToolBar1.ButtonHeight := Core.ImageListLarge.Height + 6;
    404     ToolBar1.Width := Core.ImageListLarge.Width + 10;
    405     ToolBar1.Height := Core.ImageListLarge.Height + 10;
     401    ToolBar1.Images := Core.Core.ImageListLarge;
     402    ToolBar1.ButtonWidth := Core.Core.ImageListLarge.Width + 7;
     403    ToolBar1.ButtonHeight := Core.Core.ImageListLarge.Height + 6;
     404    ToolBar1.Width := Core.Core.ImageListLarge.Width + 10;
     405    ToolBar1.Height := Core.Core.ImageListLarge.Height + 10;
    406406  end else begin
    407     ToolBar1.Images := Core.ImageListSmall;
    408     ToolBar1.ButtonWidth := Core.ImageListSmall.Width + 7;
    409     ToolBar1.ButtonHeight := Core.ImageListSmall.Height + 6;
    410     ToolBar1.Width := Core.ImageListSmall.Width + 10;
    411     ToolBar1.Height := Core.ImageListSmall.Height + 10;
     407    ToolBar1.Images := Core.Core.ImageListSmall;
     408    ToolBar1.ButtonWidth := Core.Core.ImageListSmall.Width + 7;
     409    ToolBar1.ButtonHeight := Core.Core.ImageListSmall.Height + 6;
     410    ToolBar1.Width := Core.Core.ImageListSmall.Width + 10;
     411    ToolBar1.Height := Core.Core.ImageListSmall.Height + 10;
    412412  end;
    413413  ToolBar1.Visible := AToolBarVisible.Checked;
     
    433433  TimerPeriod := 0;
    434434  LastTimerTime := Now;
    435   Core.CoolTranslator1.TranslateComponentRecursive(Self);
    436435end;
    437436
    438437procedure TFormClient.AZoomAllExecute(Sender: TObject);
    439438begin
    440   with Core, Game, Client, View do begin
     439  with Core.Core, Game, Client, View do begin
    441440    ZoomAll;
    442441  end;
     
    512511procedure TFormClient.FormClose(Sender: TObject; var CloseAction: TCloseAction);
    513512begin
    514   SaveConfig(Core.XMLConfig1, 'FormClient');
    515   Core.PersistentForm.Save(Self);
     513  SaveConfig(Core.Core.XMLConfig1, 'FormClient');
    516514end;
    517515
     
    529527begin
    530528  if (Key = EscapeKey) or (Key = ControlKey) then
    531   if Assigned(Core.Game.CurrentPlayer) then begin
     529  if Assigned(Core.Core.Game.CurrentPlayer) then begin
    532530    Client.View.SelectedCell := nil;
    533531    Redraw;
     
    538536begin
    539537  SetToolbarHints;
    540   LoadConfig(Core.XMLConfig1, 'FormClient');
    541   Core.PersistentForm.Load(Self);
    542   Core.ThemeManager1.UseTheme(Self);
     538  LoadConfig(Core.Core.XMLConfig1, 'FormClient');
    543539  UpdateInterface;
    544540  Redraw;
     
    585581    Cell := nil;
    586582    OldCell := Client.View.FocusedCell;
    587     with Core.Game do
     583    with Core.Core.Game do
    588584      if Assigned(Client.ControlPlayer) then begin
    589585        if Map.Cyclic then begin
     
    619615  if (Abs(StartMousePoint.X - X) < Trunc(Screen.PixelsPerInch * MouseMinDiff)) and
    620616  (Abs(StartMousePoint.Y - Y) < Trunc(Screen.PixelsPerInch * MouseMinDiff)) then begin
    621     if Core.Game.Running and (Core.Game.CurrentPlayer.Mode = pmHuman) and
    622     (Core.Game.CurrentPlayer = Client.ControlPlayer) then begin
     617    if Core.Core.Game.Running and (Core.Core.Game.CurrentPlayer.Mode = pmHuman) and
     618    (Core.Core.Game.CurrentPlayer = Client.ControlPlayer) then begin
    623619      Client.View.SelectCell(TPoint.Create(X, Y), Client.ControlPlayer, Shift);
    624620      Redraw;
Note: See TracChangeset for help on using the changeset viewer.