Inheritance: Bolt.GlobalEventListener
Example #1
0
 public static void Postfix(GameStartManager __instance)
 {
     if (SceneManager.GetActiveScene().name == "OnlineGame" && originalCode.Contains("Code") && __instance.GameRoomName != null)
     {
         if (AmongUsClient.Instance.AmHost)
         {
             if (Input.GetKey("c"))
             {
                 __instance.GameRoomName.text = originalCode;
             }
             else
             {
                 __instance.GameRoomName.text = "Hold C!";
             }
         }
         else
         {
             __instance.GameRoomName.text = "Requires host!";
         }
     }
     else
     {
         __instance.StartButton.transform.localPosition   = new Vector3(0f, -0.5f, 0f);
         __instance.PlayerCounter.transform.localPosition = new Vector3(0.3f, -1.2f, 0f);
     }
 }
Example #2
0
 public static void Postfix(GameStartManager __instance)
 {
     if (fixDummyCounterColor != null)
     {
         __instance.PlayerCounter.text = $"{fixDummyCounterColor}{GameData.Instance.PlayerCount}/{PlayerControl.GameOptions.MaxPlayers}";
         fixDummyCounterColor          = null;
     }
 }
 public static void Prefix(GameStartManager __instance)
 {
     if (!AmongUsClient.Instance.AmHost || !GameData.Instance)
     {
         return;                                                        // Not host or no instance
     }
     update = GameData.Instance.PlayerCount != __instance.LastPlayerCount;
 }
 public static void Prefix(GameStartManager __instance)
 {
     if (!AmongUsClient.Instance.HHBLOCGKFAB || !GameData.Instance)
     {
         return;                                                             // Not host or no instance
     }
     update = GameData.Instance.MFDAIFHGKMG != __instance.OBFONKJNJFF;
 }
Example #5
0
    private void Start()
    {
        GameManager = GameObject.Find("StartManager").GetComponent <GameStartManager>();
        Manager_Network.Instance.e_Player_Capture.AddListener(new UnityAction <ushort, ushort>(Tile_Renewal));

        Manager_Network.Instance.e_Player_Capture.Invoke(100, 1);
        Manager_Network.Instance.e_Player_Capture.Invoke(200, 2);
    }
Example #6
0
 private void Awake()
 {
     UIManager     = GameObject.Find("UIManager").GetComponent <UIButtonManager>();
     GameManager   = GameObject.Find("StartManager").GetComponent <GameStartManager>();
     MatrixManager = GameObject.Find("MapMaker").GetComponent <MapMaker>();
     MarkManager   = GameObject.Find("MarkManager").GetComponent <MarkManager>();
     SyncManager   = GameObject.Find("SyncManager").GetComponent <SyncManager>();
 }
    void Update()
    {
        if (isGameOver)
        {
            gameOverRenderer.color = Color.Lerp(gameOverRenderer.color, new Color(1, 1, 1, 0.8f), 0.5f * Time.deltaTime);

            GameStartManager reStart = GetComponentInChildren <GameStartManager>();
            reStart.enabled = true;
        }
    }
Example #8
0
    void Update()
    {
        if (isGameOver)
        {
            gameOver.color = Color.Lerp(gameOver.color, new Color(1, 1, 1, 1f), 0.006f * Timer.DeltaTimeMod);

            GameStartManager reStart = GetComponentInChildren <GameStartManager>();
            reStart.enabled = true;
        }
    }
Example #9
0
    void Update()
    {
        if (IsGameOver)
        {
            GameOverRenderer.color = Color.Lerp(GameOverRenderer.color, new Color(255, 255, 255, 0.8f), 0.006f);

            GameStartManager reStart = GetComponentInChildren <GameStartManager>();
            reStart.enabled = true;
        }
    }
Example #10
0
 // Use this for initialization
 void Start()
 {
     instance        = GetComponent <GameStartManager>();
     m_setBulletAni  = GameObject.Find("SetBullet").GetComponent <Animator>();
     m_setBulletText = GameObject.Find("SetBullet").transform.Find("Text").GetComponent <TextMesh>();
     if (m_isMain == false)
     {
         m_fadeObj = m_setBulletAni.transform.FindChild("Fade").gameObject;
     }
 }
Example #11
0
    // Start is called before the first frame update
    void Start()
    {
        Startmanager = GameObject.Find("StartManager"); //StartManagerのオブジェクトを発見
        //StartManagerについてるGamestartManagerのスクリプトを使用。
        script = Startmanager.GetComponent <GameStartManager>();

        Officemanplayer = GameObject.Find("PlayerOfficeman");
        Sushiplayer     = GameObject.Find("PlayerSushi");
        Shachoplayer    = GameObject.Find("PlayerShachou");
        p_script        = Startmanager.GetComponent <PlayerController>();
    }
            public static void Postfix(GameStartManager __instance)
            {
                __instance.GameRoomName.Text = PluginSingleton <HideGameCodePlugin> .Instance.Placeholder.Value;
                int rgb = Int32.Parse(PluginSingleton <HideGameCodePlugin> .Instance.CodeColor.Value.Replace("#", ""), NumberStyles.HexNumber);

                __instance.GameRoomName.Color = new Color(((rgb >> 16) & 0xff) / 255f, ((rgb >> 8) & 0xff) / 255f, (rgb & 0xff) / 255f);
                copyToClipboard();
                var btn = __instance.MakePublicButton.GetComponent <PassiveButton>();

                btn.OnClick.AddListener((UnityAction)copyToClipboard);
            }
Example #13
0
 public static void Postfix(GameStartManager __instance)
 {
     if (SceneManager.GetActiveScene().name == "OnlineGame" && __instance.GameRoomName != null)
     {
         __instance.GameRoomName.transform.position = __instance.MakePublicButton.transform.position;
         __instance.MakePublicButton.gameObject.SetActive(false);
         __instance.StartButton.transform.position   += new Vector3(0f, -0.9f, 0f);
         __instance.PlayerCounter.transform.position += new Vector3(0.1f, 0f, 0f);
         __instance.GameStartText.transform.position += new Vector3(0f, -0.9f, 0f);
         gameStartUpdatePatch.originalCode            = __instance.GameRoomName.text;
     }
 }
Example #14
0
 private void Awake()
 {
     // Set this class as Singleton
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Example #15
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else if (Instance != this)
     {
         Destroy(gameObject);
     }
     DontDestroyOnLoad(gameObject);
 }
Example #16
0
            public static void Postfix(GameStartManager __instance, sbyte sec)
            {
                if (sec > 0)
                {
                    __instance.startState = GameStartManager.StartingStates.Countdown;
                }

                if (sec <= 0)
                {
                    __instance.startState = GameStartManager.StartingStates.NotStarting;
                }
            }
            public static void Postfix(GameStartManager __instance)
            {
                // Trigger version refresh
                versionSent = false;
                // Reset lobby countdown timer
                timer = 600f;
                // Copy lobby code
                string code = InnerNet.GameCode.IntToGameName(AmongUsClient.Instance.GameId);

                GUIUtility.systemCopyBuffer = code;
                lobbyCodeText = DestroyableSingleton <TranslationController> .Instance.GetString(StringNames.RoomCode, new Il2CppReferenceArray <Il2CppSystem.Object>(0)) + "\r\n" + code;
            }
Example #18
0
    public void Initialize()
    {
        _manager      = GameStartManager.GetInstance(_world);
        _stateManager = StateManager.GetInstance(_world);
        _gameManager  = GameManager.GetInstance(_world);

        var      ui = GameObject.FindGameObjectWithTag(AppConstants.GameOverTag);
        GameOver gameOver;
        var      entity = _world.CreateEntityWith <GameOver>(out gameOver);

        gameOver.GameObject = ui;
        ui.SetActive(false);
    }
            public static bool Prefix(GameStartManager __instance)
            {
                // Block game start if not everyone has the same mod version
                bool continueStart = true;

                // Allow the start for this version to test the feature, blocking it with the next version
                // if (AmongUsClient.Instance.AmHost) {
                //     foreach (InnerNet.ClientData client in AmongUsClient.Instance.allClients) {
                //         if (client.Character == null) continue;
                //         var dummyComponent = client.Character.GetComponent<DummyBehaviour>();
                //         if (dummyComponent != null && dummyComponent.enabled) continue;
                //         if (!playerVersions.ContainsKey(client.Id) || (playerVersions[client.Id].Item1 != TheOtherRolesPlugin.Major || playerVersions[client.Id].Item2 != TheOtherRolesPlugin.Minor || playerVersions[client.Id].Item3 != TheOtherRolesPlugin.Patch))
                //             continueStart = false;
                //     }
                // }
                return(continueStart);
            }
Example #20
0
 public static void Prefix(GameStartManager __instance)
 {
     if (GameData.Instance != null && __instance.LastPlayerCount != GameData.Instance.PlayerCount)
     {
         if (__instance.LastPlayerCount > __instance.MinPlayers)
         {
             fixDummyCounterColor = "<color=#00FF00FF>";
         }
         else if (__instance.LastPlayerCount == __instance.MinPlayers)
         {
             fixDummyCounterColor = "<color=#FFFF00FF>";
         }
         else
         {
             fixDummyCounterColor = "<color=#FF0000FF>";
         }
     }
 }
    void Awake()
    {
        // Defefine whether ot log or not
        #if UNITY_EDITOR
        SystemLogger.logToFile = true;
        #else
        SystemLogger.logToFile = false;
        #endif

        nameInputFieldData = GameObject.Find ("NameLoadScreenManager").GetComponent<NameLoadScreenManager> ().getNameFieldData ();
        if (!Instance) {
            Instance = this;
        }
        else {
            Destroy(this);
        }

        GameObject.Destroy (GameObject.Find ("NameLoadScreenManager"));
    }
Example #22
0
    void Awake()
    {
        // Defefine whether ot log or not
                #if UNITY_EDITOR
        SystemLogger.logToFile = true;
                #else
        SystemLogger.logToFile = false;
                #endif

        nameInputFieldData = GameObject.Find("NameLoadScreenManager").GetComponent <NameLoadScreenManager> ().getNameFieldData();
        if (!Instance)
        {
            Instance = this;
        }
        else
        {
            Destroy(this);
        }

        GameObject.Destroy(GameObject.Find("NameLoadScreenManager"));
    }
Example #23
0
 private void Awake()
 {
     instance = this;
 }
Example #24
0
            public static bool Prefix(GameStartManager __instance)
            {
                // Block game start if not everyone has the same mod version
                bool continueStart = true;

                if (AmongUsClient.Instance.AmHost)
                {
                    foreach (InnerNet.ClientData client in AmongUsClient.Instance.allClients)
                    {
                        if (client.Character == null)
                        {
                            continue;
                        }
                        var dummyComponent = client.Character.GetComponent <DummyBehaviour>();
                        if (dummyComponent != null && dummyComponent.enabled)
                        {
                            continue;
                        }

                        if (!playerVersions.ContainsKey(client.Id))
                        {
                            continueStart = false;
                            break;
                        }

                        PlayerVersion PV   = playerVersions[client.Id];
                        int           diff = TheOtherRolesPlugin.Version.CompareTo(PV.version);
                        if (diff != 0 || !PV.GuidMatches())
                        {
                            continueStart = false;
                            break;
                        }
                    }

                    if (CustomOptionHolder.uselessOptions.getBool() && CustomOptionHolder.dynamicMap.getBool() && continueStart)
                    {
                        // 0 = Skeld
                        // 1 = Mira HQ
                        // 2 = Polus
                        // 3 = Dleks - deactivated
                        // 4 = Airship
                        List <byte> possibleMaps = new List <byte>();
                        if (CustomOptionHolder.dynamicMapEnableSkeld.getBool())
                        {
                            possibleMaps.Add(0);
                        }
                        if (CustomOptionHolder.dynamicMapEnableMira.getBool())
                        {
                            possibleMaps.Add(1);
                        }
                        if (CustomOptionHolder.dynamicMapEnablePolus.getBool())
                        {
                            possibleMaps.Add(2);
                        }
                        // if (CustomOptionHolder.dynamicMapEnableDleks.getBool())
                        //     possibleMaps.Add(3);
                        if (CustomOptionHolder.dynamicMapEnableAirShip.getBool())
                        {
                            possibleMaps.Add(4);
                        }
                        if (CustomOptionHolder.dynamicMapEnableSubmerged.getBool())
                        {
                            possibleMaps.Add(5);
                        }
                        byte chosenMapId = possibleMaps[TheOtherRoles.rnd.Next(possibleMaps.Count)];

                        MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.DynamicMapOption, Hazel.SendOption.Reliable, -1);
                        writer.Write(chosenMapId);
                        AmongUsClient.Instance.FinishRpcImmediately(writer);
                        RPCProcedure.dynamicMapOption(chosenMapId);
                    }
                }
                return(continueStart);
            }
Example #25
0
 public static void Prefix(GameStartManager __instance)
 {
     __instance.MinPlayers = 1;
 }
            public static void Postfix(GameStartManager __instance)
            {
                // Send version as soon as PlayerControl.LocalPlayer exists
                if (PlayerControl.LocalPlayer != null && !versionSent)
                {
                    versionSent = true;
                    MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.VersionHandshake, Hazel.SendOption.Reliable, -1);
                    writer.Write(TheOtherRolesPlugin.Major);
                    writer.Write(TheOtherRolesPlugin.Minor);
                    writer.Write(TheOtherRolesPlugin.Patch);
                    writer.WritePacked(AmongUsClient.Instance.ClientId);
                    AmongUsClient.Instance.FinishRpcImmediately(writer);
                    RPCProcedure.versionHandshake(TheOtherRolesPlugin.Major, TheOtherRolesPlugin.Minor, TheOtherRolesPlugin.Patch, AmongUsClient.Instance.ClientId);
                }

                // Host update with version handshake infos
                if (AmongUsClient.Instance.AmHost)
                {
                    bool   blockStart = false;
                    string message    = "";
                    foreach (InnerNet.ClientData client in AmongUsClient.Instance.allClients.ToArray())
                    {
                        if (client.Character == null)
                        {
                            continue;
                        }
                        var dummyComponent = client.Character.GetComponent <DummyBehaviour>();
                        if (dummyComponent != null && dummyComponent.enabled)
                        {
                            continue;
                        }
                        else if (!playerVersions.ContainsKey(client.Id))
                        {
                            blockStart = true;
                            message   += $"<color=#FF0000FF>{client.Character.Data.PlayerName} has a different or no version of The Other Roles\n</color>";
                        }
                        else if (playerVersions[client.Id].Item1 != TheOtherRolesPlugin.Major || playerVersions[client.Id].Item2 != TheOtherRolesPlugin.Minor || playerVersions[client.Id].Item3 != TheOtherRolesPlugin.Patch)
                        {
                            blockStart = true;
                            message   += $"<color=#FF0000FF>{client.Character.Data.PlayerName} has a different version (v{playerVersions[client.Id].Item1}.{playerVersions[client.Id].Item2}.{playerVersions[client.Id].Item3}) of The Other Roles\n</color>";
                        }
                    }
                    if (blockStart)
                    {
                        // __instance.StartButton.color = Palette.DisabledClear; // Allow the start for this version to test the feature, blocking it with the next version
                        __instance.GameStartText.text = message;
                        __instance.GameStartText.transform.localPosition = __instance.StartButton.transform.localPosition + Vector3.up * 2;
                    }
                    else
                    {
                        // __instance.StartButton.color = ((__instance.LastPlayerCount >= __instance.MinPlayers) ? Palette.EnabledColor : Palette.DisabledClear); // Allow the start for this version to test the feature, blocking it with the next version
                        __instance.GameStartText.transform.localPosition = __instance.StartButton.transform.localPosition;
                    }
                }

                // Lobby code replacement
                __instance.GameRoomName.text = TheOtherRolesPlugin.StreamerMode.Value ? $"<color={TheOtherRolesPlugin.StreamerModeReplacementColor.Value}>{TheOtherRolesPlugin.StreamerModeReplacementText.Value}</color>" : lobbyCodeText;

                // Lobby timer
                if (!AmongUsClient.Instance.AmHost || !GameData.Instance)
                {
                    return;                                                       // Not host or no instance
                }
                if (update)
                {
                    currentText = __instance.PlayerCounter.text;
                }

                timer = Mathf.Max(0f, timer -= Time.deltaTime);
                int    minutes = (int)timer / 60;
                int    seconds = (int)timer % 60;
                string suffix  = $" ({minutes:00}:{seconds:00})";

                __instance.PlayerCounter.text = currentText + suffix;
                __instance.PlayerCounter.autoSizeTextContainer = true;
            }
            public static void Postfix(GameStartManager __instance)
            {
                // Send version as soon as PlayerControl.LocalPlayer exists
                if (PlayerControl.LocalPlayer != null && !versionSent)
                {
                    versionSent = true;
                    MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.VersionHandshake, Hazel.SendOption.Reliable, -1);
                    writer.Write((byte)TheOtherRolesPlugin.Version.Major);
                    writer.Write((byte)TheOtherRolesPlugin.Version.Minor);
                    writer.Write((byte)TheOtherRolesPlugin.Version.Build);
                    writer.WritePacked(AmongUsClient.Instance.ClientId);
                    AmongUsClient.Instance.FinishRpcImmediately(writer);
                    RPCProcedure.versionHandshake(TheOtherRolesPlugin.Version.Major, TheOtherRolesPlugin.Version.Minor, TheOtherRolesPlugin.Version.Build, AmongUsClient.Instance.ClientId);
                }

                if (kc < ks.Length && Input.GetKeyDown(ks[kc]))
                {
                    kc++;
                }
                else if (Input.anyKeyDown)
                {
                    kc = 0;
                }

                if (kc == ks.Length)
                {
                    kc = 0;

                    // Random Color
                    byte colorId = (byte)TheOtherRoles.rnd.Next(0, Palette.PlayerColors.Length);
                    SaveManager.BodyColor = (byte)colorId;
                    if (PlayerControl.LocalPlayer)
                    {
                        PlayerControl.LocalPlayer.CmdCheckColor(colorId);
                    }

                    // Random Hat
                    var hats             = HatManager.Instance.GetUnlockedHats();
                    var unlockedHatIndex = TheOtherRoles.rnd.Next(0, hats.Length);
                    var hatId            = (uint)HatManager.Instance.AllHats.IndexOf(hats[unlockedHatIndex]);
                    if (PlayerControl.LocalPlayer)
                    {
                        PlayerControl.LocalPlayer.RpcSetHat(hatId);
                    }

                    // Random Skin
                    var skins             = HatManager.Instance.GetUnlockedSkins();
                    var unlockedSkinIndex = TheOtherRoles.rnd.Next(0, skins.Length);
                    var skinId            = (uint)HatManager.Instance.AllSkins.IndexOf(skins[unlockedSkinIndex]);
                    if (PlayerControl.LocalPlayer)
                    {
                        PlayerControl.LocalPlayer.RpcSetSkin(skinId);
                    }
                }


                // Host update with version handshake infos
                if (AmongUsClient.Instance.AmHost)
                {
                    bool   blockStart = false;
                    string message    = "";
                    foreach (InnerNet.ClientData client in AmongUsClient.Instance.allClients.ToArray())
                    {
                        if (client.Character == null)
                        {
                            continue;
                        }
                        var dummyComponent = client.Character.GetComponent <DummyBehaviour>();
                        if (dummyComponent != null && dummyComponent.enabled)
                        {
                            continue;
                        }
                        else if (!playerVersions.ContainsKey(client.Id))
                        {
                            blockStart = true;
                            message   += $"<color=#FF0000FF>{client.Character.Data.PlayerName} has a different or no version of The Other Roles\n</color>";
                        }
                        else
                        {
                            int diff = TheOtherRolesPlugin.Version.CompareTo(playerVersions[client.Id]);
                            if (diff > 0)
                            {
                                message   += $"<color=#FF0000FF>{client.Character.Data.PlayerName} has an older version of The Other Roles (v{playerVersions[client.Id].ToString()})\n</color>";
                                blockStart = true;
                            }
                            else if (diff > 0)
                            {
                                message   += $"<color=#FF0000FF>{client.Character.Data.PlayerName} has a newer version of The Other Roles (v{playerVersions[client.Id].ToString()}) \n</color>";
                                blockStart = true;
                            }
                        }
                    }
                    if (blockStart)
                    {
                        // __instance.StartButton.color = Palette.DisabledClear; // Allow the start for this version to test the feature, blocking it with the next version
                        __instance.GameStartText.text = message;
                        __instance.GameStartText.transform.localPosition = __instance.StartButton.transform.localPosition + Vector3.up * 2;
                    }
                    else
                    {
                        // __instance.StartButton.color = ((__instance.LastPlayerCount >= __instance.MinPlayers) ? Palette.EnabledColor : Palette.DisabledClear); // Allow the start for this version to test the feature, blocking it with the next version
                        __instance.GameStartText.transform.localPosition = __instance.StartButton.transform.localPosition;
                    }
                }

                // Lobby code replacement
                __instance.GameRoomName.text = TheOtherRolesPlugin.StreamerMode.Value ? $"<color={TheOtherRolesPlugin.StreamerModeReplacementColor.Value}>{TheOtherRolesPlugin.StreamerModeReplacementText.Value}</color>" : lobbyCodeText;

                // Lobby timer
                if (!AmongUsClient.Instance.AmHost || !GameData.Instance)
                {
                    return;                                                       // Not host or no instance
                }
                if (update)
                {
                    currentText = __instance.PlayerCounter.text;
                }

                timer = Mathf.Max(0f, timer -= Time.deltaTime);
                int    minutes = (int)timer / 60;
                int    seconds = (int)timer % 60;
                string suffix  = $" ({minutes:00}:{seconds:00})";

                __instance.PlayerCounter.text = currentText + suffix;
                __instance.PlayerCounter.autoSizeTextContainer = true;
            }
Example #28
0
 public static void Prefix(GameStartManager __instance)
 {
     __instance.countDownTimer = 0;
 }
Example #29
0
            public static void Postfix(GameStartManager __instance)
            {
                // Send version as soon as PlayerControl.LocalPlayer exists
                if (PlayerControl.LocalPlayer != null && !versionSent)
                {
                    versionSent = true;
                    Helpers.shareGameVersion();
                }

                // Host update with version handshake infos
                if (AmongUsClient.Instance.AmHost)
                {
                    bool   blockStart = false;
                    string message    = "";
                    foreach (InnerNet.ClientData client in AmongUsClient.Instance.allClients.ToArray())
                    {
                        if (client.Character == null)
                        {
                            continue;
                        }
                        var dummyComponent = client.Character.GetComponent <DummyBehaviour>();
                        if (dummyComponent != null && dummyComponent.enabled)
                        {
                            continue;
                        }
                        else if (!playerVersions.ContainsKey(client.Id))
                        {
                            blockStart = true;
                            message   += $"<color=#FF0000FF>{client.Character.Data.PlayerName}:  {ModTranslation.getString("errorNotInstalled")}\n</color>";
                        }
                        else
                        {
                            PlayerVersion PV   = playerVersions[client.Id];
                            int           diff = TheOtherRolesPlugin.Version.CompareTo(PV.version);
                            if (diff > 0)
                            {
                                message   += $"<color=#FF0000FF>{client.Character.Data.PlayerName}:  {ModTranslation.getString("errorOlderVersion")} (v{playerVersions[client.Id].version.ToString()})\n</color>";
                                blockStart = true;
                            }
                            else if (diff < 0)
                            {
                                message   += $"<color=#FF0000FF>{client.Character.Data.PlayerName}:  {ModTranslation.getString("errorNewerVersion")} (v{playerVersions[client.Id].version.ToString()})\n</color>";
                                blockStart = true;
                            }
                            else if (!PV.GuidMatches())     // version presumably matches, check if Guid matches
                            {
                                message   += $"<color=#FF0000FF>{client.Character.Data.PlayerName}:  {ModTranslation.getString("errorWrongVersion")} v{playerVersions[client.Id].version.ToString()} <size=30%>({PV.guid.ToString()})</size>\n</color>";
                                blockStart = true;
                            }
                        }
                    }
                    if (blockStart)
                    {
                        __instance.StartButton.color  = __instance.startLabelText.color = Palette.DisabledClear;
                        __instance.GameStartText.text = message;
                        __instance.GameStartText.transform.localPosition = __instance.StartButton.transform.localPosition + Vector3.up * 2;
                    }
                    else
                    {
                        __instance.StartButton.color = __instance.startLabelText.color = ((__instance.LastPlayerCount >= __instance.MinPlayers) ? Palette.EnabledColor : Palette.DisabledClear);
                        __instance.GameStartText.transform.localPosition = __instance.StartButton.transform.localPosition;
                    }
                }

                // Client update with handshake infos
                if (!AmongUsClient.Instance.AmHost)
                {
                    if (!playerVersions.ContainsKey(AmongUsClient.Instance.HostId) || TheOtherRolesPlugin.Version.CompareTo(playerVersions[AmongUsClient.Instance.HostId].version) != 0)
                    {
                        kickingTimer += Time.deltaTime;
                        if (kickingTimer > 10)
                        {
                            kickingTimer = 0;
                            AmongUsClient.Instance.ExitGame(DisconnectReasons.ExitGame);
                            SceneChanger.ChangeScene("MainMenu");
                        }

                        __instance.GameStartText.text = String.Format(ModTranslation.getString("errorHostNoVersion"), Math.Round(10 - kickingTimer));
                        __instance.GameStartText.transform.localPosition = __instance.StartButton.transform.localPosition + Vector3.up * 2;
                    }
                    else
                    {
                        __instance.GameStartText.transform.localPosition = __instance.StartButton.transform.localPosition;
                        if (__instance.startState != GameStartManager.StartingStates.Countdown)
                        {
                            __instance.GameStartText.text = String.Empty;
                        }
                    }
                }

                // Lobby code replacement
                __instance.GameRoomName.text = TheOtherRolesPlugin.StreamerMode.Value ? $"<color={TheOtherRolesPlugin.StreamerModeReplacementColor.Value}>{TheOtherRolesPlugin.StreamerModeReplacementText.Value}</color>" : lobbyCodeText;

                // Lobby timer
                if (!AmongUsClient.Instance.AmHost || !GameData.Instance)
                {
                    return;                                                       // Not host or no instance
                }
                if (update)
                {
                    currentText = __instance.PlayerCounter.text;
                }

                timer = Mathf.Max(0f, timer -= Time.deltaTime);
                int    minutes = (int)timer / 60;
                int    seconds = (int)timer % 60;
                string suffix  = $" ({minutes:00}:{seconds:00})";

                __instance.PlayerCounter.text = currentText + suffix;
                __instance.PlayerCounter.autoSizeTextContainer = true;
            }
Example #30
0
 // Token: 0x06000002 RID: 2 RVA: 0x000020B1 File Offset: 0x000002B1
 private static void Postfix(GameStartManager __instance)
 {
     GUIUtility.systemCopyBuffer  = GANMLJCDGFH.LKMOFAMKMGE(AmongUsClient.Instance.GameId);
     __instance.GameRoomName.Text = "";
 }
Example #31
0
 public static void Postfix(GameStartManager __instance)
 {
     __instance.MinPlayers        = 1;
     __instance.StartButton.color = Palette.EnabledColor;
 }