コード例 #1
0
        public static void Run <T>(Func <GameEngineListener, GameBootOptions, T> make) where T : Game
        {
            GameBootOptions bootOptions = null;

            var bootProfileSelector = Resources.Load <GameBootProfileSelector>("BootProfileSelector");

            if (bootProfileSelector != null)
            {
                if (bootProfileSelector.NeedsSanitizing)
                {
                    throw new InvalidDataException("Game could not be initialized because BootProfileSelector contains invalid data.");
                }
                else if (bootProfileSelector.NeedsSynchronization)
                {
                    Debug.LogWarning("Game may not behave as expected due to mismatched scripting define symbols!");
                }

                if (bootProfileSelector.ActiveIndex >= 0)
                {
                    bootOptions = (GameBootOptions)bootProfileSelector.Profiles[bootProfileSelector.ActiveIndex].BootOptions;
                }
            }

            Resources.UnloadAsset(bootProfileSelector);

            var gameObject = new GameObject("EngineListener")
            {
                hideFlags = HideFlags.HideAndDontSave
            };

            UnityObject.DontDestroyOnLoad(gameObject);

            var engineListener = gameObject.AddComponent <GameEngineListener>();

            make(engineListener, bootOptions);
        }
コード例 #2
0
 public GameBootProfile()
 {
     _id                     = "profile";
     bootOptions             = null;
     _scriptingDefineSymbols = new string[0];
 }