Esempio n. 1
0
        // Token: 0x060013FF RID: 5119 RVA: 0x00061E80 File Offset: 0x00060080
        private void Update()
        {
            if (RoR2Application.waitMsConVar.value >= 0)
            {
                Thread.Sleep(RoR2Application.waitMsConVar.value);
            }
            if (this.steamworksClient != null)
            {
                this.steamworksClient.Update();
            }
            Cursor.lockState = ((MPEventSystemManager.kbmEventSystem.isCursorVisible || MPEventSystemManager.combinedEventSystem.isCursorVisible) ? CursorLockMode.None : CursorLockMode.Locked);
            Cursor.visible   = false;
            if (RoR2Application.onUpdate != null)
            {
                RoR2Application.onUpdate();
            }
            Action action = Interlocked.Exchange <Action>(ref RoR2Application.onNextUpdate, null);

            if (action != null)
            {
                action();
            }
            RoR2Application.timeTimers.Update(Time.deltaTime);
            RoR2Application.unscaledTimeTimers.Update(Time.unscaledDeltaTime);
        }
Esempio n. 2
0
 // Token: 0x0600112E RID: 4398 RVA: 0x0004BB16 File Offset: 0x00049D16
 private void Start()
 {
     if (RoR2Application.instance == this && RoR2Application.onStart != null)
     {
         RoR2Application.onStart();
         RoR2Application.onStart = null;
     }
 }
Esempio n. 3
0
 // Token: 0x06001144 RID: 4420 RVA: 0x0004C07D File Offset: 0x0004A27D
 private static void AssignNewController(Controller controller)
 {
     ReInput.players.GetPlayer("PlayerMain").controllers.AddController(controller, false);
     if (controller.type == ControllerType.Joystick)
     {
         RoR2Application.AssignJoystickToAvailablePlayer(controller);
     }
 }
Esempio n. 4
0
            // Token: 0x06001150 RID: 4432 RVA: 0x0004C2E4 File Offset: 0x0004A4E4
            public override string GetString()
            {
                int num;
                int num2;
                int value;

                RoR2Application.NtQueryTimerResolution(out num, out num2, out value);
                return(TextSerialization.ToStringInvariant(value));
            }
        // Token: 0x06001A7D RID: 6781 RVA: 0x0007D4F8 File Offset: 0x0007B6F8
        private static void OnLobbyJoined(bool success)
        {
            SteamworksLobbyManager.awaitingJoin = false;
            if (success)
            {
                if (SteamworksLobbyManager.client.Lobby.CurrentLobbyData != null)
                {
                    string buildId = RoR2Application.GetBuildId();
                    string data    = SteamworksLobbyManager.client.Lobby.CurrentLobbyData.GetData("build_id");
                    if (buildId != data)
                    {
                        Debug.LogFormat("Lobby build_id mismatch, leaving lobby. Ours=\"{0}\" Theirs=\"{1}\"", new object[]
                        {
                            buildId,
                            data
                        });
                        SimpleDialogBox simpleDialogBox = SimpleDialogBox.Create(null);
                        simpleDialogBox.AddCancelButton(CommonLanguageTokens.ok, Array.Empty <object>());
                        simpleDialogBox.headerToken = new SimpleDialogBox.TokenParamsPair
                        {
                            token        = "STEAM_LOBBY_VERSION_MISMATCH_DIALOG_TITLE",
                            formatParams = Array.Empty <object>()
                        };
                        SimpleDialogBox.TokenParamsPair descriptionToken = default(SimpleDialogBox.TokenParamsPair);
                        descriptionToken.token = "STEAM_LOBBY_VERSION_MISMATCH_DIALOG_DESCRIPTION";
                        object[] formatParams = new string[]
                        {
                            buildId,
                            data
                        };
                        descriptionToken.formatParams    = formatParams;
                        simpleDialogBox.descriptionToken = descriptionToken;
                        SteamworksLobbyManager.client.Lobby.Leave();
                        return;
                    }
                }
                Debug.LogFormat("Steamworks lobby join succeeded. Lobby id = {0}", new object[]
                {
                    SteamworksLobbyManager.client.Lobby.CurrentLobby
                });
                SteamworksLobbyManager.OnLobbyChanged();
            }
            else
            {
                Debug.Log("Steamworks lobby join failed.");
                Console.instance.SubmitCmd(null, "steam_lobby_create_if_none", true);
            }
            Action <bool> action = SteamworksLobbyManager.onLobbyJoined;

            if (action == null)
            {
                return;
            }
            action(success);
        }
Esempio n. 6
0
            // Token: 0x0600114F RID: 4431 RVA: 0x0004C2A0 File Offset: 0x0004A4A0
            public override void SetString(string newValue)
            {
                int desiredResolution;

                if (TextSerialization.TryParseInvariant(newValue, out desiredResolution))
                {
                    int num;
                    RoR2Application.NtSetTimerResolution(desiredResolution, true, out num);
                    Debug.LogFormat("{0} set to {1}", new object[]
                    {
                        this.name,
                        num
                    });
                }
            }
Esempio n. 7
0
 // Token: 0x0600112D RID: 4397 RVA: 0x0004BAA4 File Offset: 0x00049CA4
 private void Awake()
 {
     if (RoR2Application.maxPlayers != 4 || (Application.genuineCheckAvailable && !Application.genuine))
     {
         RoR2Application.isModded = true;
     }
     this.stopwatch.Start();
     UnityEngine.Object.DontDestroyOnLoad(base.gameObject);
     if (RoR2Application.instance)
     {
         UnityEngine.Object.Destroy(base.gameObject);
         return;
     }
     RoR2Application.instance = this;
     if (!this.loaded)
     {
         this.OnLoad();
         this.loaded = true;
     }
 }
Esempio n. 8
0
 // Token: 0x06001143 RID: 4419 RVA: 0x0004C060 File Offset: 0x0004A260
 private static void AssignNewController(ControllerStatusChangedEventArgs args)
 {
     RoR2Application.AssignNewController(ReInput.controllers.GetController(args.controllerType, args.controllerId));
 }
Esempio n. 9
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;
            }
        }
Esempio n. 10
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;
            }
        }
        // Token: 0x06001A7A RID: 6778 RVA: 0x0007D3C4 File Offset: 0x0007B5C4
        private static void OnLobbyDataUpdated()
        {
            Lobby lobby = SteamworksLobbyManager.client.Lobby;

            SteamworksLobbyManager.newestLobbyData = (lobby.IsValid ? new SteamworksLobbyManager.LobbyData(lobby.CurrentLobbyData) : new SteamworksLobbyManager.LobbyData());
            SteamworksLobbyManager.UpdateOwnsLobby();
            SteamworksLobbyManager.UpdatePlayerCount();
            if (lobby.IsValid && !SteamworksLobbyManager.ownsLobby)
            {
                if (SteamworksLobbyManager.newestLobbyData.serverId.isValid)
                {
                    if (!GameNetworkManager.singleton.IsConnectedToServer(SteamworksLobbyManager.newestLobbyData.serverId) && RoR2Application.GetBuildId() == SteamworksLobbyManager.newestLobbyData.buildId)
                    {
                        GameNetworkManager.singleton.desiredHost = new GameNetworkManager.HostDescription(SteamworksLobbyManager.newestLobbyData.serverId);
                    }
                }
                else
                {
                    GameNetworkManager.singleton.desiredHost = GameNetworkManager.HostDescription.none;
                }
            }
            Action action = SteamworksLobbyManager.onLobbyDataUpdated;

            if (action == null)
            {
                return;
            }
            action();
        }
        // Token: 0x06001A5D RID: 6749 RVA: 0x0007CCB0 File Offset: 0x0007AEB0
        private static void OnLobbyChanged()
        {
            SteamworksLobbyManager.isInLobby = SteamworksLobbyManager.client.Lobby.IsValid;
            SteamworksLobbyManager.UpdateOwnsLobby();
            if (SteamworksLobbyManager.client.Lobby.CurrentLobbyData != null)
            {
                SteamworksLobbyManager.client.Lobby.CurrentLobbyData.SetData("total_max_players", TextSerialization.ToStringInvariant(RoR2Application.maxPlayers));
                SteamworksLobbyManager.client.Lobby.CurrentLobbyData.SetData("build_id", RoR2Application.GetBuildId());
            }
            SteamworksLobbyManager.UpdatePlayerCount();
            Action action = SteamworksLobbyManager.onLobbyChanged;

            if (action != null)
            {
                action();
            }
            SteamworksLobbyManager.OnLobbyDataUpdated();
        }