예제 #1
0
        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;
        }
예제 #2
0
        protected override void Awake()
        {
            base.Awake();

            gameState = Engine.GetService <IStateManager>();
            player    = Engine.GetService <IScriptPlayer>();
        }
예제 #3
0
        public virtual UniTask InitializeServiceAsync()
        {
            scriptPlayer  = Engine.GetService <IScriptPlayer>();
            cameraManager = Engine.GetService <ICameraManager>();

            return(UniTask.CompletedTask);
        }
예제 #4
0
 private void Awake()
 {
     version      = EngineVersion.LoadFromResources();
     player       = Engine.GetService <IScriptPlayer>();
     audioManager = Engine.GetService <IAudioManager>();
     stateManager = Engine.GetService <IStateManager>();
 }
예제 #5
0
 public OptionSelectCmd(List <string> options, string headerText, IScriptPlayer owner, OptionBoxHandler handler)
 {
     this.options    = options;
     this.handler    = handler;
     this.headerText = headerText;
     this.owner      = owner;
 }
예제 #6
0
        protected override void Awake()
        {
            base.Awake();

            scriptPlayer    = Engine.GetService <IScriptPlayer>();
            titleScriptName = Engine.GetConfiguration <ScriptsConfiguration>().TitleScript;
        }
예제 #7
0
        protected override void Awake ()
        {
            base.Awake();

            scriptManager = Engine.GetService<IScriptManager>();
            titleScriptName = scriptManager.Configuration.TitleScript;
            scriptPlayer = Engine.GetService<IScriptPlayer>();
        }
예제 #8
0
        /// <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);
        }
예제 #9
0
        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);
        }
예제 #10
0
        protected override void Awake()
        {
            base.Awake();
            this.AssertRequiredObjects(content);

            continueInput = Engine.GetService <IInputManager>().GetContinue();
            scriptPlayer  = Engine.GetService <IScriptPlayer>();

            CharacterManager = Engine.GetService <ICharacterManager>();
        }
예제 #11
0
 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;
 }
예제 #12
0
        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;
 }
예제 #15
0
        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();
        }
예제 #16
0
        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;
            }
        }
예제 #17
0
 /// <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;
 }
예제 #18
0
 /// <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;
 }
예제 #19
0
파일: Unit.cs 프로젝트: arcticnw/Wildmen
 /// <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>();
        }
예제 #21
0
 public TextPrinterManager(TextPrintersConfiguration config, CameraConfiguration cameraConfig, IScriptPlayer scriptPlayer)
     : base(config, cameraConfig)
 {
     this.scriptPlayer = scriptPlayer;
 }
예제 #22
0
 public static void CreateAndQueue(List <string> options, string headerText, IScriptPlayer owner, OptionBoxHandler handler) => InformativeAnimationsQueue.Instance.AddAnimation(new OptionSelectCmd(options, headerText, owner, handler));
예제 #23
0
 public static OptionSelectCmd CreateCommand(List <string> options, string headerText, IScriptPlayer owner, OptionBoxHandler handler) => new OptionSelectCmd(options, headerText, owner, handler);