Some code fragments showing how to do common actions.
Framework.PushCommand(new ChangeSceneCmd(<SceneName>));
Framework.App.Options.FullScreen = false;
Framework.PushCommand(new ApplyOptionsCmd());
class MyCustomCommand<T> : Command
{
public T Data;
public MyCustomCommand(T data) {
Data = data;
}
}
// execute on next Framework's Process()
// With injections
Framework.Dispatch(new MyCustomCommand<int>(42));
// Without injections
Framework.PushCommand(new MyCustomCommand<int>(42));
// delay execution for 3 frames
// With injections
Framework.Dispatch(new MyCustomCommand<int>(42), 3);
// Without injections
Framework.PushCommand(new MyCustomCommand<int>(42), 3);
// delay execution for 5 seconds
// With injections
Framework.Dispatch(new MyCustomCommand<int>(42), 5.0f);
// Without injections
Framework.PushCommand(new MyCustomCommand<int>(42), 5.0f);
// First bind it
CmdBinder.AddBinding<MyCustomCommand<int>>(OnCustomCommand);
// now implement a listener callback
void OnCustomCommand(Command c)
{
var cmd = c as MyCustomCommand<int>;
// cmd.Data = 42 here and you can use it as you wish...
}
CmdBinder.RemoveBinding<MyCustomCommand<int>>(OnCustomCommand);
Framework.Globals.PushObjectAsSingleton(new CustomDataModel());
Framework.Globals.PushObjectAsTransient("myCustomData", new CustomDataModel());
var myCustomData = Framework.Globals.ResolveSingleton<CustomDataModel>() as CustomDataModel;
var myCustomData = Framework.Globals.ResolveTransient<CustomDataModel>("myCustomData") as CustomDataModel;
var sceneView = GameObject.Find("SceneView").GetComponent<SceneView>() as SceneView;