C# Class Epigene.GAME.GameManager

GMGame manager class to manage the game play via triggers. Current design is, that only one game is running. A Game state is not implemented. Instead we use messages going around informing all relevant objects about the changes in the game. Plus every object has its own state.
ファイルを表示 Open project: fi-content2-games-platform/FIcontent.Gaming.Enabler.phenomobilecharactermanager Class Usage Examples

Public Properties

Property Type Description
BalanceSheetAchievementMode bool
debugMode bool
hidTouch bool
mainGame MainGame
muteSfx bool
muteSoundBackground bool
offline bool
screenHeight int
screenWidth int
setTouch bool
standaloneBetaMode bool
standaloneSingleLevelMode bool
startAchievementsMode bool

Public Methods

Method Description
Add ( Epigene.GAME.ATrigger trigger ) : void

Adds the trigger to the current game. For smoothly "Remove trigger" execute "ATrigger.Repeat = 0;" Because that is a Remove, which can occur within trigger execution. Otherwise you get an error.

Add ( Epigene.GAME.GMGame newGame ) : void

Adds the trigger.

Add ( string gameName, Epigene.GAME.ATrigger trigger ) : void

Adds the trigger. For smoothly "Remove trigger" execute "ATrigger.Repeat = 0;" Because that is a Remove, which can occur within trigger execution. Otherwise you get an error.

AddDialogFromFile ( string fileName ) : void

Add DialogTriggers from json file

ClearEvents ( ) : void
Event ( string type, string eventId, string param = "" ) : void

Delegate events to registred functions

Get ( string name ) : Epigene.GAME.GMGame

Get an instance of the game if its exist

Load ( ) : bool

Load a game

LoadJSon ( string fileName ) : object>.Dictionary

Load settings from JSon file

LoadScene ( string level, bool _setTouch = false ) : void

Loads the scene.

LoadText ( string fileName ) : string

Load the specified fileName from the Resource directory as string

Pause ( string name ) : void

Pause or resume the current game.

Play ( string name ) : void

Pause or resume the current game.

RegisterEventHandler ( string eventType, EventFunction func, GameObject handler = null ) : void

Register a funtion handler to an event.

Remove ( string name ) : void

Removes the game specified by the name. If the name is "*" it will remove all games.

RemoveEventHandler ( string eventType, EventFunction func ) : void
RemoveTriggers ( ) : void

Remove all triggers from active game.

RemoveTriggers ( TriggerType type ) : void

/// Remove all trigger with given type ///

ResetEventHandler ( string eventId, string data ) : void
Save ( ) : bool

Save a game with it's state and triggers

SaveJSon ( object>.Dictionary data, string fileName ) : void

Save settings to JSon file Should be limitted for editor mode only. (file access)

Start ( string name ) : bool

Start the game. The next update will process triggers for this game only. If the game not exist, it will log warning and return false. If another game already started, it will NOT send stop(), but pause it, while set the new one as current game.

Stop ( string name ) : bool

Stop the specified name. If the name is empty string, it will stop the current game. If the name is "*" it will stop all games. If the name is specify one game, it will stop only that one. Errors will be logged as warning.

Update ( ) : void

Process triggers

Private Methods

Method Description
GameManager ( ) : UnityEngine

ctor

LoadEpigeneProperties ( ) : void

Method Details

Add() public method

Adds the trigger to the current game. For smoothly "Remove trigger" execute "ATrigger.Repeat = 0;" Because that is a Remove, which can occur within trigger execution. Otherwise you get an error.
public Add ( Epigene.GAME.ATrigger trigger ) : void
trigger Epigene.GAME.ATrigger
return void

Add() public method

Adds the trigger.
public Add ( Epigene.GAME.GMGame newGame ) : void
newGame Epigene.GAME.GMGame
return void

Add() public method

Adds the trigger. For smoothly "Remove trigger" execute "ATrigger.Repeat = 0;" Because that is a Remove, which can occur within trigger execution. Otherwise you get an error.
public Add ( string gameName, Epigene.GAME.ATrigger trigger ) : void
gameName string
trigger Epigene.GAME.ATrigger
return void

AddDialogFromFile() public method

Add DialogTriggers from json file
public AddDialogFromFile ( string fileName ) : void
fileName string
return void

ClearEvents() public method

public ClearEvents ( ) : void
return void

Event() public method

Delegate events to registred functions
public Event ( string type, string eventId, string param = "" ) : void
type string
eventId string
param string
return void

Get() public method

Get an instance of the game if its exist
public Get ( string name ) : Epigene.GAME.GMGame
name string Name of game
return Epigene.GAME.GMGame

Load() public method

Load a game
public Load ( ) : bool
return bool

LoadJSon() public static method

Load settings from JSon file
public static LoadJSon ( string fileName ) : object>.Dictionary
fileName string
return object>.Dictionary

LoadScene() public method

Loads the scene.
public LoadScene ( string level, bool _setTouch = false ) : void
level string Level.
_setTouch bool Optional Parameter, set it true if you need it true. else leave it blank
return void

LoadText() public static method

Load the specified fileName from the Resource directory as string
public static LoadText ( string fileName ) : string
fileName string File name and path realtive to Resource directory.
return string

Pause() public method

Pause or resume the current game.
public Pause ( string name ) : void
name string
return void

Play() public method

Pause or resume the current game.
public Play ( string name ) : void
name string
return void

RegisterEventHandler() public method

Register a funtion handler to an event.
public RegisterEventHandler ( string eventType, EventFunction func, GameObject handler = null ) : void
eventType string
func EventFunction
handler UnityEngine.GameObject
return void

Remove() public method

Removes the game specified by the name. If the name is "*" it will remove all games.
public Remove ( string name ) : void
name string Name.
return void

RemoveEventHandler() public method

public RemoveEventHandler ( string eventType, EventFunction func ) : void
eventType string
func EventFunction
return void

RemoveTriggers() public method

Remove all triggers from active game.
public RemoveTriggers ( ) : void
return void

RemoveTriggers() public method

/// Remove all trigger with given type ///
public RemoveTriggers ( TriggerType type ) : void
type TriggerType
return void

ResetEventHandler() public method

public ResetEventHandler ( string eventId, string data ) : void
eventId string
data string
return void

Save() public method

Save a game with it's state and triggers
public Save ( ) : bool
return bool

SaveJSon() public static method

Save settings to JSon file Should be limitted for editor mode only. (file access)
public static SaveJSon ( object>.Dictionary data, string fileName ) : void
data object>.Dictionary
fileName string
return void

Start() public method

Start the game. The next update will process triggers for this game only. If the game not exist, it will log warning and return false. If another game already started, it will NOT send stop(), but pause it, while set the new one as current game.
public Start ( string name ) : bool
name string Name.
return bool

Stop() public method

Stop the specified name. If the name is empty string, it will stop the current game. If the name is "*" it will stop all games. If the name is specify one game, it will stop only that one. Errors will be logged as warning.
public Stop ( string name ) : bool
name string Name of the game
return bool

Update() public method

Process triggers
public Update ( ) : void
return void

Property Details

BalanceSheetAchievementMode public_oe property

public bool BalanceSheetAchievementMode
return bool

debugMode public_oe property

debug mode switch use it for get additional info about the game like current story and dialog id in bubble.
public bool debugMode
return bool

hidTouch public_oe property

if device has HID driver or not
public bool hidTouch
return bool

mainGame public_oe property

Reference / link to the real game object which runs during the whole game. This is the entry point for the game.
public MainGame mainGame
return MainGame

muteSfx public_oe property

Muse music or sound for start
public bool muteSfx
return bool

muteSoundBackground public_oe property

public bool muteSoundBackground
return bool

offline public_oe property

public bool offline
return bool

screenHeight public_oe property

public int screenHeight
return int

screenWidth public_oe property

public int screenWidth
return int

setTouch public_oe property

public bool setTouch
return bool

standaloneBetaMode public_oe property

public bool standaloneBetaMode
return bool

standaloneSingleLevelMode public_oe property

public bool standaloneSingleLevelMode
return bool

startAchievementsMode public_oe property

public bool startAchievementsMode
return bool