Changeset 231 for trunk/UGameClient.pas


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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UGameClient.pas

    r223 r231  
    77uses
    88  Classes, SysUtils, UGame, Forms, fgl, UGameProtocol, UGameServer, UCommThread,
    9   UThreading, UCommFrame;
     9  UThreading, UCommFrame, UMap, UPlayer;
    1010
    1111type
     
    3232    procedure SetControlPlayer(AValue: TPlayer);
    3333    procedure SetForm(AValue: TForm);
    34     procedure SetGame(AValue: TGame);
    3534    procedure PlayerMove(CellFrom, CellTo: TPlayerCell; var CountOnce, CountRepeat: Integer;
    3635      Update: Boolean; var Confirm: Boolean);
    3736    procedure SetOnMove(AValue: TMoveEvent);
    3837  protected
     38    procedure SetGame(AValue: TGame); virtual;
    3939    procedure ReceiveCmd(Command: TCommand; DataOut, DataIn: TStream); virtual;
    4040    procedure DoTurnStartHandler(Sender: TObject); virtual;
     
    4747  public
    4848    Name: string;
    49     View: TView;
    5049    LocalServer: TServer;
    5150    RemoteAddress: string;
     
    5453    Protocol: TGameProtocolClient;
    5554    procedure DoChange;
    56     constructor Create;
     55    constructor Create; virtual;
    5756    destructor Destroy; override;
    5857    property ControlPlayer: TPlayer read FControlPlayer write SetControlPlayer;
     
    8180implementation
    8281
     82uses
     83  UClientGUI;
     84
    8385{ TClients }
    8486
    8587function TClients.New(Name: string): TClient;
    8688begin
    87   Result := TClient.Create;
     89  Result := TClientGUI.Create;
    8890  Result.Game := Game;
    8991  Result.Name := Name;
     
    115117  if FGame = AValue then Exit;
    116118  FGame := AValue;
    117   View.Game := AValue;
    118119end;
    119120
     
    233234  CommFrame := TCommFrame.Create(nil);
    234235  FControlPlayer := nil;
    235   View := TView.Create;
    236236  Protocol := TGameProtocolClient.Create;
    237237  Protocol.OnTurnStart := DoTurnStartHandler;
     
    245245  Form := nil;
    246246  ControlPlayer := nil;
    247   FreeAndNil(View);
    248247  FreeAndNil(Protocol);
    249248  FreeAndNil(CommThread);
Note: See TracChangeset for help on using the changeset viewer.