C# Class HelloWorld.JsonDataService

Inheritance: IGameDataService
Show file Open project: Ivony/HelloWorld Class Usage Examples

Public Methods

Method Description
GetPlace ( Coordinate coordinate ) : HelloWorld.Place

获取一个地块对象

GetPlayer ( System.Guid userId ) : GamePlayer

获取一个玩家对象

GetUnits ( Coordinate coordinate ) : HelloWorld.Unit[]

获取指定地块所有单位

GetUnits ( GamePlayer player ) : HelloWorld.Unit[]

获取指定玩家所有单位

JsonDataService ( string dataRoot ) : System
Save ( GameDataItem dataItem ) : void

保存游戏数据对象

Private Methods

Method Description
IGameDataService ( ) : void

初始化游戏数据服务

InitializeUnits ( ) : void
RefreshUnitCahce ( Unit unit ) : void
Save ( HelloWorld.Place place ) : void

保存游戏地块对象

Save ( Unit unit ) : void

保存游戏单位对象

Method Details

GetPlace() public method

获取一个地块对象
public GetPlace ( Coordinate coordinate ) : HelloWorld.Place
coordinate Coordinate 地块坐标
return HelloWorld.Place

GetPlayer() public method

获取一个玩家对象
public GetPlayer ( System.Guid userId ) : GamePlayer
userId System.Guid 用户ID
return GamePlayer

GetUnits() public method

获取指定地块所有单位
public GetUnits ( Coordinate coordinate ) : HelloWorld.Unit[]
coordinate Coordinate 地块坐标
return HelloWorld.Unit[]

GetUnits() public method

获取指定玩家所有单位
public GetUnits ( GamePlayer player ) : HelloWorld.Unit[]
player GamePlayer 玩家对象
return HelloWorld.Unit[]

JsonDataService() public method

public JsonDataService ( string dataRoot ) : System
dataRoot string
return System

Save() public method

保存游戏数据对象
public Save ( GameDataItem dataItem ) : void
dataItem GameDataItem
return void