ChivalryServerLauncher/source/model/Game.Intf.pas

90 lines
2.2 KiB
ObjectPascal

unit Game.Intf;
interface
uses
System.Generics.Collections;
type
IGameNetwork = interface
['{0B1445D2-E6B7-45FD-98CB-A76F01B9D4B8}']
function GetServerPort: Integer;
function GetPeerPort: Integer;
function GetQueryPort: Integer;
procedure SetServerPort(const Value: Integer);
procedure SetPeerPort(const Value: Integer);
procedure SetQueryPort(const Value: Integer);
property ServerPort: Integer read GetServerPort write SetServerPort;
property PeerPort: Integer read GetPeerPort write SetPeerPort;
property QueryPort: Integer read GetQueryPort write SetQueryPort;
end;
IGameName = interface
['{44A04A0D-BE01-42B7-8EF1-7EC5CC431B66}']
function GetServerName: string;
function GetMessageOfTheDay: string;
procedure SetServerName(const Value: string);
procedure SetMessageOfTheDay(const Value: string);
property ServerName: string read GetServerName write SetServerName;
property MessageOfTheDay: string read GetMessageOfTheDay write SetMessageOfTheDay;
end;
TGameMap = class(TObject)
private
FCategory: string;
FName: string;
FDisplayName: string;
protected
function GetDisplayName: string; virtual;
public
constructor Create(const AName: string; const ADisplayName, ACategory: string); overload;
constructor Create(AClone: TGameMap); overload;
property Category: string read FCategory;
property Name: string read FName;
property DisplayName: string read GetDisplayName;
end;
IGameMapList = interface
['{E8552B4C-9447-4FAD-BB20-C5EB3AF07B0E}']
function GetSupportedMapList: TList<TGameMap>;
function GetMapList: TList<TGameMap>;
end;
implementation
uses
System.StrUtils;
{ TGameMap }
constructor TGameMap.Create(const AName, ADisplayName, ACategory: string);
begin
inherited Create;
FName := AName;
FDisplayName := IfThen(Length(ADisplayName) > 0, ADisplayName, AName);
FCategory := ACategory;
end;
constructor TGameMap.Create(AClone: TGameMap);
begin
Create(AClone.Name, AClone.DisplayName, AClone.Category);
end;
function TGameMap.GetDisplayName: string;
begin
Result := FDisplayName;
end;
end.