コード例 #1
0
        //------------------------------------------------------------------------/
        // Methods
        //------------------------------------------------------------------------/
        /// <summary>
        /// Dispatches the event onto the given target
        /// </summary>
        /// <returns></returns>
        public bool Dispatch()
        {
            if (!hasType)
            {
                return(false);
            }

            if (eventInstance == null)
            {
                eventInstance = StratusEvent.Instantiate(type, eventData);
            }

            switch (scope)
            {
            case StratusEvent.Scope.GameObject:
                foreach (var target in targets)
                {
                    if (target)
                    {
                        target.Dispatch(eventInstance, type.Type);
                    }
                }
                break;

            case StratusEvent.Scope.Scene:
                StratusScene.Dispatch(eventInstance, type.Type);
                break;
            }
            return(true);
        }
コード例 #2
0
ファイル: ScenePool.cs プロジェクト: r2d2m/StratusFramework
        /// <summary>
        /// Closes all scenes in the editor
        /// </summary>
        public void CloseAll(StratusScene.SceneCallback onClosed = null)
        {
            StratusScene.Unload(scenes, onClosed);

            //foreach (var scene in this.scenes)
            //  scene.Close();
        }
コード例 #3
0
ファイル: ScenePool.cs プロジェクト: r2d2m/StratusFramework
        /// <summary>
        /// Opens all scenes in the editor
        /// </summary>
        public void OpenAll(StratusScene.SceneCallback onOpened = null)
        {
            StratusScene.Load(scenes, onOpened);

            //foreach (var scene in this.scenes)
            //  scene.Add();
        }
コード例 #4
0
        protected override void SetPauseMechanism()
        {
            StratusScene.Connect <PauseEvent>(this.OnPauseEvent);
            gameObject.Connect <PauseEvent>(this.OnPauseEvent);

            StratusScene.Connect <ResumeEvent>(this.OnResumeEvent);
            gameObject.Connect <ResumeEvent>(this.OnResumeEvent);
        }
コード例 #5
0
 private void RemoveAllNotes()
 {
     ObjectNote[] notes = StratusScene.GetComponentsInAllActiveScenes <ObjectNote>();
     foreach (var note in notes)
     {
         Undo.DestroyObjectImmediate(note);
     }
     StratusDebug.Log($"Removed {notes.Length} notes!");
 }
コード例 #6
0
        //------------------------------------------------------------------------/
        // Messages
        //------------------------------------------------------------------------/
        private void Awake()
        {
            // Optionally, subscribe to scene-wide events
            if (scope == StratusEvent.Scope.Scene)
            {
                StratusScene.Connect <StateEvent>(this.OnStateEvent);
            }

            // Always subscribe to specific requests
            gameObject.Connect <StateEvent>(this.OnStateEvent);

            AddCommonRecorders();
        }
コード例 #7
0
        private void Subscribe()
        {
            switch (scope)
            {
            case StratusEvent.Scope.GameObject:
                this.gameObject.Connect(this.OnEvent, this.type);
                break;

            case StratusEvent.Scope.Scene:
                StratusScene.Connect(this.OnEvent, this.type);
                break;
            }

            connected = true;
        }
コード例 #8
0
 protected override void OnInitializeState()
 {
     behaviours = StratusScene.GetComponentsInAllActiveScenes <T>();
 }
コード例 #9
0
 private static void AddCurrentBehaviours()
 {
     StratusManagedBehaviour[] behaviours = StratusScene.GetComponentsInAllActiveScenes <StratusManagedBehaviour>();
     StratusDebug.Log($"Adding {behaviours.Length} behaviours");
     StratusManagedBehaviourSystem.behaviours.AddRange(behaviours);
 }
コード例 #10
0
 /// <summary>
 /// Closes/unloads the scene in the editor
 /// </summary>
 /// <returns>True if the operation succeeded</returns>
 public void Close()
 {
     StratusScene.Unload(this);
 }
コード例 #11
0
 /// <summary>
 /// Opens/loads the scene in the editor, adding it to the current list of scenes
 /// </summary>
 /// <param name="mode"></param>
 public void Add()
 {
     StratusScene.Load(this);
 }
コード例 #12
0
 /// <summary>
 /// Unloads this scene (asynchronously)
 /// </summary>
 public void Unload(StratusScene.SceneCallback onFinished = null)
 {
     StratusScene.Unload(this, onFinished);
 }
コード例 #13
0
 /// <summary>
 /// Loads this scene
 /// </summary>
 /// <param name="mode"></param>
 public void Load(LoadSceneMode mode, StratusScene.SceneCallback onFinished = null)
 {
     StratusScene.Load(this, mode, onFinished);
 }
コード例 #14
0
 public void DispatchToScene() => StratusScene.Dispatch(this, GetType());
コード例 #15
0
 //------------------------------------------------------------------------/
 // Messages
 //------------------------------------------------------------------------/
 protected override void OnAwake()
 {
     StratusScene.Connect <StratusPauseEvent>(this.OnPauseEvent);
     StratusScene.Connect <StratusResumeEvent>(this.OnResumeEvent);
 }