Changeset 231 for trunk/Forms


Ignore:
Timestamp:
Sep 19, 2018, 2:05:52 PM (6 years ago)
Author:
chronos
Message:
  • Modified: UGame unit was split to UPlayer, UMap and UClientGUI units to have better logical separation of game classes.
  • Modified: Drawing methods moved from TMap and TPlayerMap to TClientGUI. Generic TClient class and TComputer classes don't need have any drawing support.
Location:
trunk/Forms
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormCharts.pas

    r208 r231  
    3434
    3535uses
    36   UCore, UGame;
     36  UCore, UGame, UPlayer;
    3737
    3838resourcestring
  • trunk/Forms/UFormClient.pas

    r227 r231  
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
    99  UGame, LCLType, Menus, ActnList, ComCtrls, dateutils, XMLConf, DOM,
    10   UGeometry, UGameClient, UGameProtocol, UThreading;
     10  UGeometry, UGameClient, UGameProtocol, UThreading, UPlayer, UClientGUI;
    1111
    1212const
     
    6969    procedure Timer1Timer(Sender: TObject);
    7070  private
    71     FClient: TClient;
     71    FClient: TClientGUI;
    7272    TempBitmap: TBitmap;
    7373    StartMousePoint: TPoint;
     
    8080    TimerPeriod: TDateTime;
    8181    TurnActive: Boolean;
    82     procedure SetClient(AValue: TClient);
     82    procedure SetClient(AValue: TClientGUI);
    8383    procedure DoClientChange(Sender: TObject);
    8484    procedure DoGameEnd(Sender: TObject);
     
    9494    procedure UpdateInterface;
    9595    procedure Redraw;
    96     property Client: TClient read FClient write SetClient;
     96    property Client: TClientGUI read FClient write SetClient;
    9797  end;
    9898
     
    178178      TempBitmap.Canvas.Brush.Color := BackGroundColor; //clBackground; //PaintBox1.GetColorResolvingParent;
    179179      TempBitmap.Canvas.FillRect(0, 0, PaintBox1.Width, PaintBox1.Height);
    180       if Assigned(ControlPlayer) then ControlPlayer.Paint(TempBitmap.Canvas, View)
    181         else Core.Game.Map.Paint(TempBitmap.Canvas, View);
     180      Client.Paint(TempBitmap.Canvas, View);
    182181      PaintBox1.Canvas.Draw(0, 0, TempBitmap);
    183182    end else begin
     
    186185      PaintBox1.Canvas.FillRect(0, 0, PaintBox1.Width, PaintBox1.Height);
    187186      {$endif}
    188       if Assigned(ControlPlayer) then ControlPlayer.Paint(PaintBox1.Canvas, View)
    189         else Core.Game.Map.Paint(PaintBox1.Canvas, View);
     187      Client.Paint(PaintBox1.Canvas, View)
    190188    end;
    191189  end;
     
    227225end;
    228226
    229 procedure TFormClient.SetClient(AValue: TClient);
     227procedure TFormClient.SetClient(AValue: TClientGUI);
    230228begin
    231229  if FClient = AValue then Exit;
     
    474472    with Core.Game do
    475473      if Assigned(Client.ControlPlayer) then
    476         Cell := Client.ControlPlayer.PlayerMap.PosToCell(Client.View.CanvasToCellPos(TPoint.Create(X, Y)), Client.View);
     474        Cell := Client.ControlPlayer.PlayerMap.PosToCell(Client.View.CanvasToCellPos(TPoint.Create(X, Y)));
    477475        //else Cell := Client.Game.Map.PosToCell(Client.View.CanvasToCellPos(TPoint.Create(X, Y)), Client.View);
    478476    if Assigned(Cell) then begin
  • trunk/Forms/UFormNew.pas

    r229 r231  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   ComCtrls, Spin, ExtCtrls, ActnList, ExtDlgs, Menus, UGame, UGeometry,
    10   UGameServer, UServerList;
     9  ComCtrls, Spin, ExtCtrls, ActnList, ExtDlgs, Menus, UGame, UGeometry, UPlayer,
     10  UGameServer, UServerList, UMap;
    1111
    1212type
  • trunk/Forms/UFormPlayer.pas

    r188 r231  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   ColorBox, Menus, Spin, UGame;
     9  ColorBox, Menus, Spin, UGame, UPlayer;
    1010
    1111type
  • trunk/Forms/UFormPlayersStats.pas

    r208 r231  
    3939
    4040uses
    41   UCore;
     41  UCore, UPlayer;
    4242
    4343{$R *.lfm}
  • trunk/Forms/UFormUnitMoves.pas

    r228 r231  
    2929
    3030uses
    31   UGame, UCore;
     31  UGame, UCore, UPlayer;
    3232
    3333{$R *.lfm}
Note: See TracChangeset for help on using the changeset viewer.