2014-06-30 14:37:42 +00:00
|
|
|
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;
|
|
|
|
|
|
|
|
|
2014-06-30 21:41:54 +00:00
|
|
|
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;
|
2014-06-30 14:37:42 +00:00
|
|
|
property DisplayName: string read GetDisplayName;
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
IGameMapList = interface
|
|
|
|
['{E8552B4C-9447-4FAD-BB20-C5EB3AF07B0E}']
|
2014-07-02 14:54:01 +00:00
|
|
|
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;
|
2014-06-30 14:37:42 +00:00
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
2014-06-30 21:41:54 +00:00
|
|
|
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;
|
2014-06-30 14:37:42 +00:00
|
|
|
|
|
|
|
end.
|