Mark van Renswoude
9c720f5922
Changed: MapList now uses JSON format, preview filename parameter added Changed: cleaned up preview folder, no more duplicates Changed: version number now uses XE2's auto generated date numbers
135 lines
3.7 KiB
ObjectPascal
135 lines
3.7 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;
|
|
|
|
|
|
IGamePassword = interface
|
|
['{30BD2D9D-4249-4D49-8376-E8A2E4809CBA}']
|
|
function GetGamePassword: string;
|
|
function GetAdminPassword: string;
|
|
|
|
procedure SetGamePassword(const Value: string);
|
|
procedure SetAdminPassword(const Value: string);
|
|
|
|
property GamePassword: string read GetGamePassword write SetGamePassword;
|
|
property AdminPassword: string read GetAdminPassword write SetAdminPassword;
|
|
end;
|
|
|
|
|
|
TGameMap = class(TObject)
|
|
private
|
|
FCategory: string;
|
|
FName: string;
|
|
FDisplayName: string;
|
|
FPreviewName: string;
|
|
function GetPreviewName: string;
|
|
protected
|
|
function GetDisplayName: string; virtual;
|
|
|
|
property ActualDisplayName: string read FDisplayName;
|
|
property ActualPreviewName: string read FPreviewName;
|
|
public
|
|
constructor Create(const AName: string; const ADisplayName, ACategory: string; const APreviewName: string = ''); overload;
|
|
constructor Create(AClone: TGameMap); overload;
|
|
|
|
property Category: string read FCategory;
|
|
property Name: string read FName;
|
|
property DisplayName: string read GetDisplayName;
|
|
property PreviewName: string read GetPreviewName;
|
|
end;
|
|
|
|
|
|
IGameMapList = interface
|
|
['{E8552B4C-9447-4FAD-BB20-C5EB3AF07B0E}']
|
|
function GetPredefinedMapList: TEnumerable<TGameMap>;
|
|
function GetMapList: TEnumerable<TGameMap>;
|
|
|
|
function GetMapCount: Integer;
|
|
function GetMap(Index: Integer): TGameMap;
|
|
|
|
procedure AddMap(AMap: TGameMap);
|
|
procedure InsertMap(Index: Integer; AMap: TGameMap);
|
|
procedure DeleteMap(AIndex: Integer);
|
|
procedure RemoveMap(AMap: TGameMap);
|
|
procedure MoveMap(ASourceIndex, ATargetIndex: Integer);
|
|
|
|
property PredefinedMapList: TEnumerable<TGameMap> read GetPredefinedMapList;
|
|
property MapList: TEnumerable<TGameMap> read GetMapList;
|
|
|
|
property MapCount: Integer read GetMapCount;
|
|
property Map[Index: Integer]: TGameMap read GetMap;
|
|
end;
|
|
|
|
|
|
implementation
|
|
|
|
|
|
{ TGameMap }
|
|
constructor TGameMap.Create(const AName, ADisplayName, ACategory, APreviewName: string);
|
|
begin
|
|
inherited Create;
|
|
|
|
FName := AName;
|
|
FDisplayName := ADisplayName;
|
|
FCategory := ACategory;
|
|
FPreviewName := APreviewName
|
|
end;
|
|
|
|
|
|
constructor TGameMap.Create(AClone: TGameMap);
|
|
begin
|
|
Create(AClone.Name, AClone.ActualDisplayName, AClone.Category, AClone.ActualPreviewName);
|
|
end;
|
|
|
|
|
|
function TGameMap.GetDisplayName: string;
|
|
begin
|
|
if Length(FDisplayName) > 0 then
|
|
Result := FDisplayName
|
|
else
|
|
Result := FName;
|
|
end;
|
|
|
|
|
|
function TGameMap.GetPreviewName: string;
|
|
begin
|
|
if Length(FPreviewName) > 0 then
|
|
Result := FPreviewName
|
|
else
|
|
Result := FName;
|
|
end;
|
|
|
|
end.
|