コード例 #1
0
 public static void Terminate(bool isPlayMode)
 {
     FirebaseEditorDispatcher.ListenToPlayState(false);
     if (!isPlayMode)
     {
         FirebaseEditorDispatcher.StopEditorUpdate();
     }
 }
コード例 #2
0
 internal static void Terminate()
 {
     if (FirebaseHandler.firebaseHandler != null)
     {
         FirebaseEditorDispatcher.Terminate(FirebaseHandler.firebaseHandler.IsPlayMode);
         FirebaseHandler.firebaseHandler.StopMonoBehaviour();
     }
     FirebaseHandler.firebaseHandler = null;
 }
コード例 #3
0
        public static void StopEditorUpdate()
        {
            Type editorApplicationType = FirebaseEditorDispatcher.EditorApplicationType;

            if (editorApplicationType != null)
            {
                FieldInfo field = editorApplicationType.GetField("update");
                if (FirebaseEditorDispatcher.< > f__mg$cache1 == null)
                {
                    FirebaseEditorDispatcher.< > f__mg$cache1 = new Action(FirebaseEditorDispatcher.Update);
                }
                FirebaseEditorDispatcher.AddRemoveCallbackToField(field, FirebaseEditorDispatcher.< > f__mg$cache1, null, false, null);
            }
        }
コード例 #4
0
        public static void StartEditorUpdate()
        {
            Type editorApplicationType = FirebaseEditorDispatcher.EditorApplicationType;

            if (editorApplicationType != null)
            {
                FieldInfo field = editorApplicationType.GetField("update");
                if (FirebaseEditorDispatcher.< > f__mg$cache0 == null)
                {
                    FirebaseEditorDispatcher.< > f__mg$cache0 = new Action(FirebaseEditorDispatcher.Update);
                }
                FirebaseEditorDispatcher.AddRemoveCallbackToField(field, FirebaseEditorDispatcher.< > f__mg$cache0, null, true, "Firebase failed to register for editor update calls. Most Firebase features will fail, as callbacks will notwork properly. This is caused by being unable to resolvethe necessary fields from the UnityEditor.dll.");
            }
        }
コード例 #5
0
 private static void PlayModeStateChanged()
 {
     if (!FirebaseHandler.DefaultInstance.IsPlayMode && FirebaseEditorDispatcher.EditorIsPlaying)
     {
         FirebaseEditorDispatcher.StopEditorUpdate();
         FirebaseHandler.DefaultInstance.StartMonoBehaviour();
         FirebaseHandler.DefaultInstance.IsPlayMode = true;
     }
     else if (FirebaseHandler.DefaultInstance.IsPlayMode && !FirebaseEditorDispatcher.EditorIsPlayingOrWillChangePlaymode)
     {
         FirebaseHandler.DefaultInstance.StopMonoBehaviour();
         FirebaseEditorDispatcher.StartEditorUpdate();
         FirebaseHandler.DefaultInstance.IsPlayMode = false;
     }
 }
コード例 #6
0
 private FirebaseHandler()
 {
     if (Application.isEditor)
     {
         this.IsPlayMode = FirebaseEditorDispatcher.EditorIsPlaying;
         FirebaseEditorDispatcher.ListenToPlayState(true);
     }
     else
     {
         this.IsPlayMode = true;
     }
     if (this.IsPlayMode)
     {
         this.StartMonoBehaviour();
     }
     else
     {
         FirebaseEditorDispatcher.StartEditorUpdate();
     }
 }
コード例 #7
0
        public static void ListenToPlayState(bool start = true)
        {
            Type editorApplicationType = FirebaseEditorDispatcher.EditorApplicationType;

            if (editorApplicationType != null)
            {
                EventInfo @event = editorApplicationType.GetEvent("playModeStateChanged");
                if (@event != null)
                {
                    Type type = Type.GetType("UnityEditor.PlayModeStateChange, UnityEditor");
                    if (type != null)
                    {
                        MethodInfo methodInfo = typeof(FirebaseEditorDispatcher).GetMethod("PlayModeStateChangedWithArg", BindingFlags.Static | BindingFlags.NonPublic);
                        methodInfo = methodInfo.MakeGenericMethod(new Type[]
                        {
                            type
                        });
                        Delegate handler = Delegate.CreateDelegate(@event.EventHandlerType, null, methodInfo);
                        if (start)
                        {
                            @event.AddEventHandler(null, handler);
                        }
                        else
                        {
                            @event.RemoveEventHandler(null, handler);
                        }
                        return;
                    }
                }
                FieldInfo field = editorApplicationType.GetField("playmodeStateChanged");
                if (FirebaseEditorDispatcher.< > f__mg$cache2 == null)
                {
                    FirebaseEditorDispatcher.< > f__mg$cache2 = new Action(FirebaseEditorDispatcher.PlayModeStateChanged);
                }
                Action callback = FirebaseEditorDispatcher.< > f__mg$cache2;
                FirebaseEditorDispatcher.AddRemoveCallbackToField(field, callback, null, start, null);
            }
        }
コード例 #8
0
 private static void PlayModeStateChangedWithArg <T>(T t)
 {
     FirebaseEditorDispatcher.PlayModeStateChanged();
 }