C# Class PlayerAction, tf_client

Inheritance: MonoBehaviour
显示文件 Open project: wids-eria/tf_client Class Usage Examples

Public Properties

Property Type Description
allowPerformance bool
controlsAreaHeight float
cost int
dialogConfirmButtonDo GUIContent
dialogLongDescription string
effectPrefab GameObject
hasServerAPIPoint bool
icon UnityEngine.Texture2D
inputMode InputMode
notificationMessage string
tooltip string

Protected Properties

Property Type Description
downloadTilesCoroutine DownloadTilesInRegionCoroutine
m_actionProgress float
m_tileModifications ResourceTileModification

Private Properties

Property Type Description

Public Methods

Method Description
DisplayControls ( ) : void

Configure the dialog

DoAction ( GUIButtonBase, button ) : void
DoIt ( object selection ) : void

Perform the action.

IsPermittedOnResourceTile ( ResourceTile, tile ) : bool

Determines whether this action is permitted on the specified tile.

OnEnable ( ) : void

Raises the enable event.

OnGUI ( ) : void

Display loading icon as needed

Start ( ) : void
UpdateMask ( ) : void

Updates the mask.

UpdateSelectionHighlighter ( ) : void

Updates the selection highlighter.

Protected Methods

Method Description
BeginGUIArea ( ) : void

Begins the GUI area.

CalculateCost ( ResourceTileLite, tiles ) : int

Calculates the cost of performing this action on the given tiles

ConcludeActionOnResourceTiles ( ResourceTileSelection, selection ) : void

Concludes the action on resource tiles.

DisplayControlsContents ( ) : void

Displays the controls contents.

DisplayPaintSelectionControlGroup ( ) : void

Displays the paint selection control group.

DoItButton ( ) : void

The button to perform the action.

DoResourceCalculations ( ResourceTileSelection, selection ) : bool
EndGUIArea ( ) : void

Ends the GUI area.

GetActionJson ( ) : string

Gets JSON representation for the action.

Creates a JSON object for use with god mode.

GetActionJson ( object mods ) : string
GetDoItWWW ( ResourceTileSelection, selection ) : WWW

Gets the do it WWW.

GetEffectSpawnLocationsFromResourceTiles ( ResourceTileSelection, selection ) : Vector3[]

Gets the effect spawn locations from resource tiles.

Put ( ResourceTileSelection, selection ) : IEnumerator

Forces a put of resource tile modifications using god mode.

This is a temporary solution for implementing actions with no server API point, and can eventually be removed.

Refresh ( ) : IEnumerator
RefreshAfterActionFailed ( string errorMessage ) : IEnumerator

Refreshs after the action failed.

SendActionMessage ( ResourceTile, modifiedTiles ) : void

Sends out a message stating that an action was performed

SpawnEffectsAtLocations ( Vector3 spawnLocations ) : void

Spawns the effects at locations.

SubmitResourceTileSelection ( ResourceTileSelection, selection ) : void

Submits the resource tile selection.

NOTE: This may need a more sophisticated implementation if e.g., player action changes before server responds.

SubmitResourceTileSelectionToServerAPI ( ResourceTileSelection, selection ) : IEnumerator

Submits the resource tile selection to server API.

Method Details

BeginGUIArea() protected method

Begins the GUI area.
protected BeginGUIArea ( ) : void
return void

CalculateCost() protected method

Calculates the cost of performing this action on the given tiles
protected CalculateCost ( ResourceTileLite, tiles ) : int
tiles ResourceTileLite, /// Tiles. ///
return int

ConcludeActionOnResourceTiles() protected method

Concludes the action on resource tiles.
protected ConcludeActionOnResourceTiles ( ResourceTileSelection, selection ) : void
selection ResourceTileSelection, /// Tiles. ///
return void

DisplayControls() public method

Configure the dialog
public DisplayControls ( ) : void
return void

DisplayControlsContents() protected method

Displays the controls contents.
protected DisplayControlsContents ( ) : void
return void

DisplayPaintSelectionControlGroup() protected method

Displays the paint selection control group.
protected DisplayPaintSelectionControlGroup ( ) : void
return void

DoAction() public method

public DoAction ( GUIButtonBase, button ) : void
button GUIButtonBase,
return void

DoIt() public method

Perform the action.
public DoIt ( object selection ) : void
selection object /// The selection to which the action should be applied. ///
return void

DoItButton() protected method

The button to perform the action.
protected DoItButton ( ) : void
return void

DoResourceCalculations() protected method

protected DoResourceCalculations ( ResourceTileSelection, selection ) : bool
selection ResourceTileSelection,
return bool

EndGUIArea() protected method

Ends the GUI area.
protected EndGUIArea ( ) : void
return void

GetActionJson() protected method

Gets JSON representation for the action.
Creates a JSON object for use with god mode.
protected GetActionJson ( ) : string
return string

GetActionJson() protected method

protected GetActionJson ( object mods ) : string
mods object
return string

GetDoItWWW() protected method

Gets the do it WWW.
protected GetDoItWWW ( ResourceTileSelection, selection ) : WWW
selection ResourceTileSelection, /// The selection. ///
return WWW

GetEffectSpawnLocationsFromResourceTiles() protected method

Gets the effect spawn locations from resource tiles.
protected GetEffectSpawnLocationsFromResourceTiles ( ResourceTileSelection, selection ) : Vector3[]
selection ResourceTileSelection, /// Tiles. ///
return Vector3[]

IsPermittedOnResourceTile() public abstract method

Determines whether this action is permitted on the specified tile.
public abstract IsPermittedOnResourceTile ( ResourceTile, tile ) : bool
tile ResourceTile, /// The resource tile in question. ///
return bool

OnEnable() public method

Raises the enable event.
public OnEnable ( ) : void
return void

OnGUI() public method

Display loading icon as needed
public OnGUI ( ) : void
return void

Put() protected method

Forces a put of resource tile modifications using god mode.
This is a temporary solution for implementing actions with no server API point, and can eventually be removed.
protected Put ( ResourceTileSelection, selection ) : IEnumerator
selection ResourceTileSelection, /// The selection. ///
return IEnumerator

Refresh() protected method

protected Refresh ( ) : IEnumerator
return IEnumerator

RefreshAfterActionFailed() protected method

Refreshs after the action failed.
protected RefreshAfterActionFailed ( string errorMessage ) : IEnumerator
errorMessage string /// Error message. ///
return IEnumerator

SendActionMessage() protected method

Sends out a message stating that an action was performed
protected SendActionMessage ( ResourceTile, modifiedTiles ) : void
modifiedTiles ResourceTile,
return void

SpawnEffectsAtLocations() protected method

Spawns the effects at locations.
protected SpawnEffectsAtLocations ( Vector3 spawnLocations ) : void
spawnLocations Vector3 /// Spawn locations. ///
return void

Start() public method

public Start ( ) : void
return void

SubmitResourceTileSelection() protected method

Submits the resource tile selection.
NOTE: This may need a more sophisticated implementation if e.g., player action changes before server responds.
protected SubmitResourceTileSelection ( ResourceTileSelection, selection ) : void
selection ResourceTileSelection, /// The resource tile selection. ///
return void

SubmitResourceTileSelectionToServerAPI() protected method

Submits the resource tile selection to server API.
protected SubmitResourceTileSelectionToServerAPI ( ResourceTileSelection, selection ) : IEnumerator
selection ResourceTileSelection, /// The resource tile selection. ///
return IEnumerator

UpdateMask() public method

Updates the mask.
public UpdateMask ( ) : void
return void

UpdateSelectionHighlighter() public method

Updates the selection highlighter.
public UpdateSelectionHighlighter ( ) : void
return void

Property Details

allowPerformance public_oe property

public bool allowPerformance
return bool

controlsAreaHeight public_oe property

The height of the controls area.
public float controlsAreaHeight
return float

cost public_oe property

the base cost to perform the action; modify in GatherData if it is variable
public int cost
return int

dialogConfirmButtonDo public_oe property

Labels to appear on the submission button.
public GUIContent dialogConfirmButtonDo
return GUIContent

dialogLongDescription public_oe property

long description to appear under the question in the dialog
public string dialogLongDescription
return string

downloadTilesCoroutine protected_oe property

protected DownloadTilesInRegionCoroutine downloadTilesCoroutine
return DownloadTilesInRegionCoroutine

effectPrefab public_oe property

Prefab for the special effect to spawn, if any
public GameObject effectPrefab
return GameObject

hasServerAPIPoint public_oe property

Flag specifying whether or not the action has a server API point.
When this is false, the action uses a god mode implementation. It will eventually be removed once every action has an API point.
public bool hasServerAPIPoint
return bool

icon public_oe property

the icon associated with this action
public Texture2D,UnityEngine icon
return UnityEngine.Texture2D

inputMode public_oe property

The input mode.
public InputMode inputMode
return InputMode

m_actionProgress protected_oe property

The action progress.
protected float m_actionProgress
return float

m_tileModifications protected_oe property

The tile modifications wrapper.
protected ResourceTileModification m_tileModifications
return ResourceTileModification

notificationMessage public_oe property

public string notificationMessage
return string

tooltip public_oe property

description of what the action does
public string tooltip
return string