ChivalryServerLauncher/source/model/Game.Base.pas

74 lines
1.3 KiB
ObjectPascal
Raw Normal View History

unit Game.Base;
interface
uses
System.Classes;
type
TCustomGame = class(TInterfacedPersistent)
private
FLocation: string;
FLoaded: Boolean;
protected
procedure Notify(const APropertyName: string); virtual;
procedure DoLoad; virtual; abstract;
procedure DoSave; virtual; abstract;
public
class function GameName: string; virtual; abstract;
class function AutoDetect: TCustomGame; virtual;
constructor Create(const ALocation: string); virtual;
procedure Load; virtual;
procedure Save; virtual;
property Loaded: Boolean read FLoaded;
property Location: string read FLocation;
end;
TCustomGameClass = class of TCustomGame;
implementation
uses
System.Bindings.Helper,
System.SysUtils;
{ TCustomGame }
constructor TCustomGame.Create(const ALocation: string);
begin
inherited Create;
FLocation := IncludeTrailingPathDelimiter(ALocation);
end;
class function TCustomGame.AutoDetect: TCustomGame;
begin
Result := nil;
end;
procedure TCustomGame.Load;
begin
DoLoad;
FLoaded := True;
end;
procedure TCustomGame.Save;
begin
DoSave;
end;
procedure TCustomGame.Notify(const APropertyName: string);
begin
TBindings.Notify(Self, APropertyName);
end;
end.