Esempio n. 1
0
 // Token: 0x0600199F RID: 6559 RVA: 0x0006DE78 File Offset: 0x0006C078
 private SteamworksClientManager()
 {
     if (!Application.isEditor && 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...");
             this.Dispose();
             return;
         }
     }
     Config.ForUnity(Application.platform.ToString());
     this.steamworksClient = new Client(632360U);
     if (!this.steamworksClient.IsValid)
     {
         this.Dispose();
         return;
     }
     if (!Application.isEditor)
     {
         if (Client.RestartIfNecessary(632360U) || !this.steamworksClient.IsValid || !SteamApiValidator.IsValidSteamApiDll())
         {
             Debug.Log("Unable to initialize Facepunch.Steamworks.");
             this.Dispose();
             return;
         }
         if (!this.steamworksClient.App.IsSubscribed(632360U))
         {
             Debug.Log("Steam user not subscribed to app. Quitting...");
             this.Dispose();
             return;
         }
     }
     RoR2Application.steamBuildId = TextSerialization.ToStringInvariant(this.steamworksClient.BuildId);
     RoR2Application.onUpdate    += this.Update;
     RoR2Application.cloudStorage = new SteamworksRemoteStorageFileSystem();
     SteamworksLobbyManager.Init();
     SteamLobbyFinder.Init();
 }
Esempio n. 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;
            }
        }