private static void HandleEngineInitialized() { if (!(Engine.Behaviour is RuntimeBehaviour)) { return; } if (configuration is null) { configuration = ProjectConfigurationProvider.LoadOrDefault <ScriptsConfiguration>(); } if (editorResources is null) { editorResources = EditorResources.LoadOrDefault(); } if (!configuration.HotReloadScripts) { return; } scriptManager = Engine.GetService <IScriptManager>(); player = Engine.GetService <IScriptPlayer>(); stateManager = Engine.GetService <IStateManager>(); player.OnPlay += HandleStartPlaying; }
protected override void Awake() { base.Awake(); gameState = Engine.GetService <IStateManager>(); player = Engine.GetService <IScriptPlayer>(); }
public virtual UniTask InitializeServiceAsync() { scriptPlayer = Engine.GetService <IScriptPlayer>(); cameraManager = Engine.GetService <ICameraManager>(); return(UniTask.CompletedTask); }
private void Awake() { version = EngineVersion.LoadFromResources(); player = Engine.GetService <IScriptPlayer>(); audioManager = Engine.GetService <IAudioManager>(); stateManager = Engine.GetService <IStateManager>(); }
public OptionSelectCmd(List <string> options, string headerText, IScriptPlayer owner, OptionBoxHandler handler) { this.options = options; this.handler = handler; this.headerText = headerText; this.owner = owner; }
protected override void Awake() { base.Awake(); scriptPlayer = Engine.GetService <IScriptPlayer>(); titleScriptName = Engine.GetConfiguration <ScriptsConfiguration>().TitleScript; }
protected override void Awake () { base.Awake(); scriptManager = Engine.GetService<IScriptManager>(); titleScriptName = scriptManager.Configuration.TitleScript; scriptPlayer = Engine.GetService<IScriptPlayer>(); }
/// <summary> /// Loads the provided script, preloads the script's commands and starts playing at the provided line and inline indexes or a label; /// when <paramref name="label"/> is provided, will ignore line and inline indexes. /// </summary> /// <param name="scriptName">Name (resource path) of the script to load and play.</param> /// <param name="startLineIndex">Line index to start playback from.</param> /// <param name="startInlineIndex">Command inline index to start playback from.</param> /// <param name="label">Name of a label within the script to start playback from.</param> public static async UniTask PreloadAndPlayAsync(this IScriptPlayer scriptPlayer, string scriptName, int startLineIndex = 0, int startInlineIndex = 0, string label = null) { var script = await Engine.GetService <IScriptManager>().LoadScriptAsync(scriptName); if (script is null) { throw new Exception($"Script player failed to start: script with name `{scriptName}` wasn't able to load."); } await scriptPlayer.PreloadAndPlayAsync(script, startLineIndex, startInlineIndex, label); }
protected override void Awake() { base.Awake(); startScriptName = Engine.GetService <IScriptManager>().StartGameScriptName; titleMenu = GetComponentInParent <TitleMenu>(); player = Engine.GetService <IScriptPlayer>(); stateManager = Engine.GetService <IStateManager>(); Debug.Assert(titleMenu && player != null); }
protected override void Awake() { base.Awake(); this.AssertRequiredObjects(content); continueInput = Engine.GetService <IInputManager>().GetContinue(); scriptPlayer = Engine.GetService <IScriptPlayer>(); CharacterManager = Engine.GetService <ICharacterManager>(); }
public virtual void Initialize(ScriptNavigatorPanel navigator, string scriptName, IScriptPlayer player) { this.navigator = navigator; this.scriptName = scriptName; this.player = player; name = "PlayScript: " + scriptName; SetLabel(scriptName); isInitialized = true; UIComponent.interactable = true; }
protected override void Awake() { stateManager = Engine.GetService <IStateManager>(); inputManager = Engine.GetService <IInputManager>(); uiManager = Engine.GetService <IUIManager>(); scriptPlayer = Engine.GetService <IScriptPlayer>(); base.Awake(); InitializeFontChangeConfiguration(); }
protected override void Awake() { base.Awake(); this.AssertRequiredObjects(inputField, summaryText, submitButton); scriptPlayer = Engine.GetService <IScriptPlayer>(); variableManager = Engine.GetService <ICustomVariableManager>(); stateManager = Engine.GetService <IStateManager>(); submitInput = Engine.GetService <IInputManager>().GetSubmit(); submitButton.interactable = false; }
public virtual void Initialize(ScriptNavigatorPanel navigator, Script script, IScriptPlayer player) { this.navigator = navigator; this.script = script; this.player = player; name = "PlayScript: " + script.Name; if (labelText) { labelText.text = script.Name; } isInitialized = true; UIComponent.interactable = true; }
public virtual async UniTask InitializeServiceAsync() { scriptPlayer = Engine.GetService <IScriptPlayer>(); cameraManager = Engine.GetService <ICameraManager>(); if (Configuration.EnableStateRollback) { scriptPlayer.AddPreExecutionTask(HandleCommandPreExecution); rollbackInput = Engine.GetService <IInputManager>().GetRollback(); if (rollbackInput != null) { rollbackInput.OnStart += HandleRollbackInputStart; } } SettingsState = await LoadSettingsAsync(); GlobalState = await LoadGlobalStateAsync(); }
private static void Initialize() { ScriptAssetPostprocessor.OnModified += HandleScriptModifiedAsync; Engine.OnInitializationFinished += HandleEngineInitialized; void HandleEngineInitialized() { if (!(Engine.Behaviour is RuntimeBehaviour)) { return; } if (configuration is null) { configuration = ProjectConfigurationProvider.LoadOrDefault <ScriptsConfiguration>(); } scriptManager = Engine.GetService <IScriptManager>(); player = Engine.GetService <IScriptPlayer>(); stateManager = Engine.GetService <IStateManager>(); player.OnPlay += HandleStartPlaying; } }
/// <summary> /// Creates a building of given entry at given tile with given owner /// </summary> /// <param id="entry">Db entry of the building</param> /// <param id="tile">Tile if the building</param> /// <param id="owner">Owner of the building</param> /// <returns>The created building</returns> public IScriptBuilding CreateBuilding(IScriptDbEntry entry, IScriptTile tile, IScriptPlayer owner) { Building bldg = new Building(); bldg.Initialize((EntryDb)entry, this, (Player)owner, (Tile)tile); bldg.InitializeGraphics(); SendData(Network.MakeServerMessage(MessageType.GameObjCreate, bldg)); return bldg; }
/// <summary> /// Creates a unit of given entry at given position with given owner /// </summary> /// <param id="entry">Db entry of the unit</param> /// <param id="position">Position if the unit</param> /// <param id="owner">Owner of the unit</param> /// <returns>The created unit</returns> public IScriptUnit CreateUnit(IScriptDbEntry entry, Vector2 position, IScriptPlayer owner) { Unit u = new Unit(); u.Initialize((EntryDb)entry, this, (Player)owner, position); u.InitializeGraphics(); u.CancelOrders(); SendData(Network.MakeServerMessage(MessageType.GameObjCreate, u)); return u; }
/// <summary> /// Sets owner of this unit /// </summary> /// <param id="newOwner">New owner of this unit</param> public void SetOwner(IScriptPlayer newOwner) { if (newOwner == null) return; if (newOwner == Owner) return; Owner.Unassign(this); Player newOwnerPlayer = (Player)newOwner; newOwnerPlayer.Assign(this); this.Owner = newOwnerPlayer; game.SendData(Network.MakeServerMessage(MessageType.GameObjUpdate, this)); }
protected override void Awake() { base.Awake(); player = Engine.GetService <IScriptPlayer>(); }
public TextPrinterManager(TextPrintersConfiguration config, CameraConfiguration cameraConfig, IScriptPlayer scriptPlayer) : base(config, cameraConfig) { this.scriptPlayer = scriptPlayer; }
public static void CreateAndQueue(List <string> options, string headerText, IScriptPlayer owner, OptionBoxHandler handler) => InformativeAnimationsQueue.Instance.AddAnimation(new OptionSelectCmd(options, headerText, owner, handler));
public static OptionSelectCmd CreateCommand(List <string> options, string headerText, IScriptPlayer owner, OptionBoxHandler handler) => new OptionSelectCmd(options, headerText, owner, handler);