Class Game
- Namespace
- FrameOfReference
- Assembly
- FrameOfReference.dll
Represents a running instance of the game
public class Game : GameBase, IDisposable
- Inheritance
-
Game
- Implements
- Inherited Members
- Extension Methods
Constructors
Game()
Creates a new game instance
public Game()
Properties
CurrentPresenter
The currently active presenter
[LuaHide]
public Presenter? CurrentPresenter { get; }
Property Value
CurrentSession
The current game session
[LuaHide]
public Session? CurrentSession { get; }
Property Value
CurrentState
The current state of the game
[LuaHide]
public GameState CurrentState { get; }
Property Value
GuiManager
Manages all GUI dialogs displayed in the game
public GuiManager GuiManager { get; }
Property Value
Methods
ApplyGraphicsSettings()
Called when graphics settings from an external source need to be applied to the Engine
protected override void ApplyGraphicsSettings()
BuildEngineConfig(bool)
Called to generate an EngineConfig based on external settings
protected override EngineConfig BuildEngineConfig(bool fullscreen)
Parameters
fullscreen
boolShall the configuration be generated for fullscreen mode?
Returns
Debug()
Called when the debug form is to be displayed
[LuaHide]
public override void Debug()
Dispose(bool)
To be called by Dispose() and the object destructor.
protected override void Dispose(bool disposing)
Parameters
disposing
booltrue
if called manually and not by the garbage collector.
GetSavegameNames()
Lists the names of all stored Sessions.
public IEnumerable<string> GetSavegameNames()
Returns
Initialize()
To be called after the window is ready and the Engine needs to be set up
protected override bool Initialize()
Returns
- bool
true
if the initialization worked,false
if it failed an the app must be closed
LoadDialog(string)
Loads and displays a new dialog.
[LuaGlobal(Description = "Loads and displays a new dialog.")]
public DialogRenderer LoadDialog(string name)
Parameters
name
stringThe XML file to load from.
Returns
- DialogRenderer
The newly created dialog.
LoadMap(string)
Loads a game map into CurrentSession and switches the CurrentState to InGame
public void LoadMap(string name)
Parameters
name
stringThe name of the map to load
LoadMenu(string)
Loads a map into FrameOfReference.Game._menuUniverse and switches the CurrentState to Menu
public void LoadMenu(string name)
Parameters
name
stringThe name of the map to load
LoadModalDialog(string)
Loads and displays a new modal (exclusivly focused) dialog.
[LuaGlobal(Description = "Loads and displays a new modal (exclusivly focused) dialog.")]
public DialogRenderer LoadModalDialog(string name)
Parameters
name
stringThe XML file to load from.
Returns
- DialogRenderer
The newly created dialog.
LoadSavegame(string)
Loads a savegame from user's profile to replace the CurrentSession.
public void LoadSavegame(string name)
Parameters
name
stringThe name of the savegame to load.
LoadSplashDialog(string)
Loads a new exclusive displayed splash-screen dialog.
[LuaGlobal(Description = "Loads a new exclusive displayed splash-screen dialog.")]
public DialogRenderer LoadSplashDialog(string name)
Parameters
name
stringThe XML file to load from
Returns
- DialogRenderer
The newly created dialog.
Remarks
Calling this method will close all other DialogRenderers.
ModifyMap(string)
Loads a game map into CurrentSession and switches the CurrentState to Modify
public void ModifyMap(string name)
Parameters
name
stringThe name of the map to load
NewLua()
Creates a new LuaInterface.Lua instance with commonly used objects preloaded.
[LuaHide]
public override Lua NewLua()
Returns
- Lua
Render(double)
Called when the next frame needs to be rendered.
protected override void Render(double elapsedTime)
Parameters
elapsedTime
doubleThe number of seconds that have passed since this method was last called.
ResetEngine()
Resets the Engine
protected override void ResetEngine()
Run()
Shows the window and runs the render loop until Exit() is called.
[LuaHide]
public override void Run()
SaveSavegame(string)
Saves the CurrentSession as a savegame stored in the user's profile.
public void SaveSavegame(string name)
Parameters
name
stringThe name of the savegame to write.
SwitchToGame()
Switches the game to in-game mode
public void SwitchToGame()
Remarks
If CurrentState is already InGame, nothing will happen. Loading may take a while, subsequent calls will be a bit faster because the Engine cache will still be hot
SwitchToMenu()
Switches to the main menu
public void SwitchToMenu()
Remarks
If CurrentState is already Menu, nothing will happen. Loading will take a while on first call, subsequent calls will be very fast, because FrameOfReference.Game._menuUniverse is preserved
SwitchToModify()
Switches the game to map modification mode
public void SwitchToModify()
Remarks
If CurrentState is already Modify, nothing will happen. Loading may take a while, subsequent calls will be a bit faster because the Engine cache will still be hot
TogglePause()
Toggles CurrentState between InGame and Pause
public void TogglePause()
Remarks
When called while CurrentState is neither InGame nor Pause nothing happens