예제 #1
0
        // Token: 0x0600113E RID: 4414 RVA: 0x0004BDB0 File Offset: 0x00049FB0
        private void OnLoad()
        {
            RoR2Application.UnitySystemConsoleRedirector.Redirect();
            PhysicalFileSystem physicalFileSystem = new PhysicalFileSystem();

            RoR2Application.fileSystem   = new SubFileSystem(physicalFileSystem, physicalFileSystem.ConvertPathFromInternal(Application.dataPath), true);
            RoR2Application.cloudStorage = RoR2Application.fileSystem;
            Func <bool> func = RoR2Application.loadSteamworksClient;

            if (func == null || !func())
            {
                Application.Quit();
                return;
            }
            UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/Rewired Input Manager"));
            ReInput.ControllerConnectedEvent += RoR2Application.AssignNewController;
            foreach (ControllerType controllerType in new ControllerType[]
            {
                ControllerType.Keyboard,
                ControllerType.Mouse,
                ControllerType.Joystick
            })
            {
                Controller[] controllers = ReInput.controllers.GetControllers(controllerType);
                if (controllers != null)
                {
                    for (int j = 0; j < controllers.Length; j++)
                    {
                        RoR2Application.AssignNewController(controllers[j]);
                    }
                }
            }
            this.stateManager.Initialize();
            UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/UI/MPEventSystemManager"));
            UnityEngine.Object.Instantiate <GameObject>(this.networkManagerPrefab);
            if (!RoR2Application.noAudio)
            {
                if (UnityEngine.Object.FindObjectOfType <AkInitializer>())
                {
                    Debug.LogError("Attempting to initialize wwise when AkInitializer already exists! This will cause a crash!");
                    return;
                }
                this.wwiseGlobalInstance = UnityEngine.Object.Instantiate <GameObject>(this.wwiseGlobalPrefab);
                UnityEngine.Object.Instantiate <GameObject>(this.audioManagerPrefab);
                this.wwiseGlobalInstance.GetComponent <AkInitializer>();
            }
            GameObject gameObject = new GameObject("Console");

            gameObject.AddComponent <SetDontDestroyOnLoad>();
            gameObject.AddComponent <Console>();
            SceneManager.sceneLoaded += delegate(Scene scene, LoadSceneMode loadSceneMode)
            {
                Debug.LogFormat("Loaded scene {0} loadSceneMode={1}", new object[]
                {
                    scene.name,
                    loadSceneMode
                });
            };
            SceneManager.sceneUnloaded += delegate(Scene scene)
            {
                Debug.LogFormat("Unloaded scene {0}", new object[]
                {
                    scene.name
                });
            };
            SceneManager.activeSceneChanged += delegate(Scene oldScene, Scene newScene)
            {
                Debug.LogFormat("Active scene changed from {0} to {1}", new object[]
                {
                    oldScene.name,
                    newScene.name
                });
            };
            SystemInitializerAttribute.Execute();
            UserProfile.LoadUserProfiles();
            if (RoR2Application.onLoad != null)
            {
                RoR2Application.onLoad();
                RoR2Application.onLoad = null;
            }
        }
예제 #2
0
        // Token: 0x0600140C RID: 5132 RVA: 0x00062108 File Offset: 0x00060308
        private void OnLoad()
        {
            RoR2Application.UnitySystemConsoleRedirector.Redirect();
            if (File.Exists("steam_appid.txt"))
            {
                try
                {
                    File.Delete("steam_appid.txt");
                }
                catch (Exception ex)
                {
                    Debug.Log(ex.Message);
                }
                if (File.Exists("steam_appid.txt"))
                {
                    Debug.Log("Cannot delete steam_appid.txt. Quitting...");
                    Application.Quit();
                    return;
                }
            }
            Config.ForUnity(Application.platform.ToString());
            this.steamworksClient = new Client(632360u);
            if (Client.RestartIfNecessary(632360u) || !this.steamworksClient.IsValid || !SteamApiValidator.IsValidSteamApiDll())
            {
                Debug.Log("Unable to initialize Facepunch.Steamworks.");
                Application.Quit();
                return;
            }
            if (!this.steamworksClient.App.IsSubscribed(632360u))
            {
                Debug.Log("Steam user not subscribed to app. Quitting...");
                Application.Quit();
                return;
            }
            RoR2Application.steamBuildId = TextSerialization.ToStringInvariant(this.steamworksClient.BuildId);
            this.steamworksAuthTicket    = this.steamworksClient.Auth.GetAuthSessionTicket();
            SteamworksEventManager.Init(this.steamworksClient);
            this.steamworksAvailability.MakeAvailable();
            PhysicalFileSystem physicalFileSystem = new PhysicalFileSystem();

            RoR2Application.fileSystem   = new SubFileSystem(physicalFileSystem, physicalFileSystem.ConvertPathFromInternal(Application.dataPath), true);
            RoR2Application.cloudStorage = RoR2Application.fileSystem;
            RoR2Application.cloudStorage = new SteamworksRemoteStorageFileSystem();
            UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/Rewired Input Manager"));
            ReInput.ControllerConnectedEvent += RoR2Application.AssignNewController;
            foreach (ControllerType controllerType in new ControllerType[]
            {
                ControllerType.Keyboard,
                ControllerType.Mouse,
                ControllerType.Joystick
            })
            {
                Controller[] controllers = ReInput.controllers.GetControllers(controllerType);
                if (controllers != null)
                {
                    for (int j = 0; j < controllers.Length; j++)
                    {
                        RoR2Application.AssignNewController(controllers[j]);
                    }
                }
            }
            this.stateManager.Initialize();
            UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/UI/MPEventSystemManager"));
            UnityEngine.Object.Instantiate <GameObject>(this.networkManagerPrefab);
            if (UnityEngine.Object.FindObjectOfType <AkInitializer>())
            {
                Debug.LogError("Attempting to initialize wwise when AkInitializer already exists! This will cause a crash!");
                return;
            }
            this.wwiseGlobalInstance = UnityEngine.Object.Instantiate <GameObject>(this.wwiseGlobalPrefab);
            UnityEngine.Object.Instantiate <GameObject>(this.audioManagerPrefab);
            GameObject gameObject = new GameObject("Console");

            gameObject.AddComponent <SetDontDestroyOnLoad>();
            gameObject.AddComponent <Console>();
            SceneManager.sceneLoaded += delegate(Scene scene, LoadSceneMode loadSceneMode)
            {
                Debug.LogFormat("Loaded scene {0} loadSceneMode={1}", new object[]
                {
                    scene.name,
                    loadSceneMode
                });
            };
            SceneManager.sceneUnloaded += delegate(Scene scene)
            {
                Debug.LogFormat("Unloaded scene {0}", new object[]
                {
                    scene.name
                });
            };
            SceneManager.activeSceneChanged += delegate(Scene oldScene, Scene newScene)
            {
                Debug.LogFormat("Active scene changed from {0} to {1}", new object[]
                {
                    oldScene.name,
                    newScene.name
                });
            };
            SystemInitializerAttribute.Execute();
            UserProfile.LoadUserProfiles();
            if (RoR2Application.onLoad != null)
            {
                RoR2Application.onLoad();
                RoR2Application.onLoad = null;
            }
        }