示例#1
0
        private IEnumerator DelayedActiveSceneChanged(Scene from, Scene to)
        {
            yield return(new WaitForSeconds(0.5f));

            // If any new cameras have been added to the config folder, render them
            // if(to.name == )

            CameraUtilities.ReloadCameras();

            if (ActiveSceneChanged != null)
            {
                if (_rootConfig.ProfileSceneChange)
                {
                    if (to.name == "GameCore" && _rootConfig.GameProfile != "")
                    {
                        _profileChanger.ProfileChange(_rootConfig.GameProfile);
                    }
                    else if (to.name == "MenuCore" && _rootConfig.MenuProfile != "")
                    {
                        _profileChanger.ProfileChange(_rootConfig.MenuProfile);
                    }
                }

                yield return(new WaitForSeconds(1.0f));

                // Invoke each activeSceneChanged event
                foreach (var func in ActiveSceneChanged?.GetInvocationList())
                {
                    try
                    {
                        func?.DynamicInvoke(from, to);
                    }
                    catch (Exception ex)
                    {
                        Logger.Log($"Exception while invoking ActiveSceneChanged:" +
                                   $" {ex.Message}\n{ex.StackTrace}", LogLevel.Error);
                    }
                }
            }
            if (to.name == "GameCore")
            {
                CameraUtilities.SetAllCameraCulling();
            }
        }
示例#2
0
        private IEnumerator DelayedActiveSceneChanged(Scene from, Scene to)
        {
            bool isRestart = isRestartingSong;

            isRestartingSong = false;


            if (!isRestart)
            {
                CameraUtilities.ReloadCameras();
            }

            IEnumerator waitForcam()
            {
                yield return(new WaitForSeconds(0.01f));

                while (Camera.main == null)
                {
                    yield return(new WaitForSeconds(0.05f));
                }
            }

            if (ActiveSceneChanged != null)
            {
                if (_rootConfig.ProfileSceneChange && !isRestart)
                {
                    if (to.name == "GameCore" && _rootConfig.GameProfile != "" && (!MultiplayerSession.ConnectedMultiplay || _rootConfig.MultiplayerProfile == ""))
                    {
                        _profileChanger.ProfileChange(_rootConfig.GameProfile);
                    }
                    else if ((to.name == "MenuCore" || to.name == "HealthWarning") && _rootConfig.MenuProfile != "" && (!MultiplayerSession.ConnectedMultiplay || _rootConfig.MultiplayerProfile == ""))
                    {
                        _profileChanger.ProfileChange(_rootConfig.MenuProfile);
                    }
                }

                yield return(waitForcam());

                // Invoke each activeSceneChanged event
                foreach (var func in ActiveSceneChanged?.GetInvocationList())
                {
                    try {
                        func?.DynamicInvoke(from, to);
                    } catch (Exception ex) {
                        Logger.Log($"Exception while invoking ActiveSceneChanged:" +
                                   $" {ex.Message}\n{ex.StackTrace}", LogLevel.Error);
                    }
                }
            }

            yield return(waitForcam());

            if (to.name == "GameCore" || to.name == "MenuCore" || to.name == "MenuViewControllers" || to.name == "HealthWarning")
            {
                CameraUtilities.SetAllCameraCulling();

                if (isRestart)
                {
                    yield return(new WaitForSeconds(0.1f));
                }
                _origin = GameObject.Find("LocalPlayerGameCore/Origin")?.transform;
            }
        }