示例#1
0
        private static void CheckLevelEnterPlayModeForLoadingMainScene()
        {
            if (!ProjectEditorConfig.Instance.AutoTestLevelScenes)
            {
                return;
            }

            // No game exists
            var game = FindAllObjects.InScene <GameBase>().FirstOrDefault();

            if (game)
            {
                return;
            }

            // Found level helper
            var sceneRef = FindAllObjects.InScene <LevelSceneRefBase>();

            if (sceneRef.Length <= 0)
            {
                return;
            }

            ManagedLog.Log($"Loading main scene to test {SceneManager.GetActiveScene().name}");

            var testingScene = AssetDatabase.LoadAssetAtPath <SceneAsset>(SceneManager.GetActiveScene().path);

            GameWindow.TestLevel = AssetDatabase.LoadAssetAtPath <SceneAsset>(SceneManager.GetActiveScene().path);

            _asyncOperation = EditorSceneManager.LoadSceneAsyncInPlayMode(GameWindow.MainSceneAssetPath,
                                                                          new LoadSceneParameters(LoadSceneMode.Single));

            _asyncOperation.completed += OnloadComplete;

            void OnloadComplete(AsyncOperation obj)
            {
                game = FindAllObjects.InScene <GameBase>().FirstOrDefault();
                _asyncOperation.completed -= OnloadComplete;
                Assert.IsNotNull(game);

#if USING_SHAPES
                WorldLog.OnScreen($"Testing {testingScene.name}");
#endif
                new Operation(delay: 1f, action: () =>
                {
                    game.StartGame();
                }).Start();
            }
        }
示例#2
0
 private void LogOnScreen(string msg = "On Screen Log")
 {
     WorldLog.OnScreen(msg);
 }