C# Class Terrarium.Game.PopulationData

Exibir arquivo Open project: eugeniomiro/Terrarium Class Usage Examples

Public Methods

Method Description
AddToTotals ( DataSet &totalsData, DataSet newData ) : void

Add up reporting totals so that a cumulative report can be given to the user via a dialog or other method.

BeginTick ( int tickNumber, System.Guid guid ) : void

Begins a game engine tick indicating the tick number and the world state GUID.

Close ( ) : void

Closes the PopulationData class and stops in any progress or pending connections.

CountOrganism ( string speciesName, PopulationChangeReason reason ) : void

Counts a new organism and adds it to the reporting data.

CountOrganism ( string speciesName, PopulationChangeReason reason, int count ) : void

Counts a new organism and adds it to the current dataset.

CreateReportDataSet ( ) : DataSet

Creates a dataset in the form that the reporting server is expecting.

Data ( ) : DataSet

Get the current reporting data.

EndTick ( int tickNumber ) : void

Ends a game tick.

FillReportTable ( DataTable totalsOnlyTable, System.Guid peerStateGuid, int tickNumber ) : void

Fill the dataset with data in the format expected by the reporting server.

GetCurrentReportingStats ( System.Guid peerGuid, int tick ) : DataSet

Gets a dataset of the current reporting statistics. This data can be used to update datagrids, charts, or other reporting facilities.

InitWebService ( ) : void

Initializes the web service proxies. These are dynamically generated and so this method only generates them one time to improve memory and performance.

IsReportingTick ( int tickNumber ) : bool

Determines if the current tick is a reporting tick. We only report data every so often, and a report tick is the tick when we report data.

NullToZero ( object value ) : Int32

Helper function to convert DBNull to 0

PopulationData ( bool reportData, Terrarium.Forms.TerrariumLed led ) : System

Creates a new PopulationData class that can be used to report data and update a status LED.

UncountOrganism ( string speciesName, PopulationChangeReason reason ) : void

Counts a new organism and removes it from the data.

UncountOrganism ( string speciesName, PopulationChangeReason reason, int count ) : void

Counts a new organism and removes it from the reporting data.

Private Methods

Method Description
ReportData ( DataSet newData, System.Guid peerStateGuid ) : void

Attemps to report data to the central server.

ReportServiceCallback ( IAsyncResult asyncResult ) : void

Callback method used by the reporting service methods to enable Async reporting.

ResetData ( ) : void

Resets the data in the PopulationData class to initial values.

addValues ( object value1, object value2 ) : Int32

Helper function to add two database values together.

Method Details

AddToTotals() public method

Add up reporting totals so that a cumulative report can be given to the user via a dialog or other method.
public AddToTotals ( DataSet &totalsData, DataSet newData ) : void
totalsData System.Data.DataSet The current totals data.
newData System.Data.DataSet The new data to be added.
return void

BeginTick() public method

Begins a game engine tick indicating the tick number and the world state GUID.
public BeginTick ( int tickNumber, System.Guid guid ) : void
tickNumber int The current tick number.
guid System.Guid The world state GUID.
return void

Close() public method

Closes the PopulationData class and stops in any progress or pending connections.
public Close ( ) : void
return void

CountOrganism() public method

Counts a new organism and adds it to the reporting data.
public CountOrganism ( string speciesName, PopulationChangeReason reason ) : void
speciesName string The name of the species to add.
reason PopulationChangeReason The reason for bing added.
return void

CountOrganism() public method

Counts a new organism and adds it to the current dataset.
public CountOrganism ( string speciesName, PopulationChangeReason reason, int count ) : void
speciesName string The name of the species being added.
reason PopulationChangeReason The reason for being added.
count int The number to add.
return void

CreateReportDataSet() public method

Creates a dataset in the form that the reporting server is expecting.
public CreateReportDataSet ( ) : DataSet
return System.Data.DataSet

Data() public method

Get the current reporting data.
public Data ( ) : DataSet
return System.Data.DataSet

EndTick() public method

Ends a game tick.
public EndTick ( int tickNumber ) : void
tickNumber int The tick number. Should always be the same as the call to BeginTick.
return void

FillReportTable() public method

Fill the dataset with data in the format expected by the reporting server.
public FillReportTable ( DataTable totalsOnlyTable, System.Guid peerStateGuid, int tickNumber ) : void
totalsOnlyTable System.Data.DataTable A datatable in the reporting server format.
peerStateGuid System.Guid The current world state GUID.
tickNumber int The current tick number.
return void

GetCurrentReportingStats() public method

Gets a dataset of the current reporting statistics. This data can be used to update datagrids, charts, or other reporting facilities.
public GetCurrentReportingStats ( System.Guid peerGuid, int tick ) : DataSet
peerGuid System.Guid The world state GUID for this peer.
tick int The current tick number.
return System.Data.DataSet

InitWebService() public method

Initializes the web service proxies. These are dynamically generated and so this method only generates them one time to improve memory and performance.
public InitWebService ( ) : void
return void

IsReportingTick() public method

Determines if the current tick is a reporting tick. We only report data every so often, and a report tick is the tick when we report data.
public IsReportingTick ( int tickNumber ) : bool
tickNumber int The current tick number.
return bool

NullToZero() public static method

Helper function to convert DBNull to 0
public static NullToZero ( object value ) : Int32
value object The value to check.
return System.Int32

PopulationData() public method

Creates a new PopulationData class that can be used to report data and update a status LED.
public PopulationData ( bool reportData, Terrarium.Forms.TerrariumLed led ) : System
reportData bool Should data be reported to the server.
led Terrarium.Forms.TerrariumLed An LED used to indicate status.
return System

UncountOrganism() public method

Counts a new organism and removes it from the data.
public UncountOrganism ( string speciesName, PopulationChangeReason reason ) : void
speciesName string The name of the species the data is for.
reason PopulationChangeReason The reason the creature is being removed.
return void

UncountOrganism() public method

Counts a new organism and removes it from the reporting data.
public UncountOrganism ( string speciesName, PopulationChangeReason reason, int count ) : void
speciesName string The name of the species the data is for.
reason PopulationChangeReason The reason for removing.
count int The number to remove.
return void