Exemplo n.º 1
0
 public static void Postfix()
 {
     if (ChameleonPlayer.isLocalPlayerChameleon())
     {
         HudManagerPatch.invisibleButton.lastUsed = DateTime.UtcNow.AddSeconds(-HudManagerPatch.invisibleButton.duration - HudManagerPatch.invisibleButton.cooldown + 15);
     }
 }
 public static void Postfix(IntroClass __instance)
 {
     if (ChameleonPlayer.isLocalPlayerChameleon())
     {
         var color = new Color(1, 1, 1, 1);
         __instance.field_Public_PENEIDJGGAF_0.Title.Text                   = "Chameleon";
         __instance.field_Public_PENEIDJGGAF_0.Title.Color                  = ChameleonPlayer.color;
         __instance.field_Public_PENEIDJGGAF_0.ImpostorText.Text            = "Use your [40ff52ff]invisibility[ffffffff] to find [ff0000ff]impostors";
         __instance.field_Public_PENEIDJGGAF_0.BackgroundBar.material.color = ChameleonPlayer.color;
     }
 }
 public static void Postfix(Hud __instance)
 {
     if (PlayerControl.LocalPlayer == null)
     {
         return;
     }
     if (GameData.currentGame.GameState != GameStates.Started)
     {
         updateGameSettingsText(__instance);
     }
     if (GameData.currentGame.GameState == GameStates.Started)
     {
         var localPlayer = PlayerController.GetLocalPlayer();
         if (ChameleonPlayer.isLocalPlayerChameleon())
         {
             if (MeetingHud.Instance != null)
             {
                 updateMeetingHud(MeetingHud.Instance, localPlayer);
             }
             if (invisibleButton == null)
             {
                 invisibleButton = new CustomButton(__instance, CustomGameOptions.invisibilityCooldown, CustomGameOptions.invisibilityDuration, "ChameleonMod.Assets.invisible.png");
             }
             localPlayer.PlayerControl.nameText.Color = ChameleonPlayer.color;
             if (!localPlayer.PlayerData.IsDead)
             {
                 setPositionInvisibleButton();
                 if (invisibleButton.isActive)
                 {
                     var activeTime = invisibleButton.ActiveTime();
                     if (activeTime == 0)
                     {
                         ChameleonPlayer.isInvisible = false;
                         sendRpcInvisible();
                         invisibleButton.isActive             = false;
                         invisibleButton.spriteRenderer.color = new Color(1f, 1f, 1f, 1f);
                     }
                     else
                     {
                         invisibleButton.textDuration.textRenderer.Text = ((int)Math.Ceiling(activeTime)).ToString();
                         invisibleButton.textDuration.gameObject.SetActive(true);
                     }
                 }
                 else
                 {
                     var useTime = invisibleButton.UseTime();
                     if (useTime == 0)
                     {
                         if (invisibleButton.Clicked())
                         {
                             ChameleonPlayer.isInvisible = true;
                             sendRpcInvisible();
                             invisibleButton.lastUsed             = DateTime.UtcNow;
                             invisibleButton.isActive             = true;
                             invisibleButton.spriteRenderer.color = new Color(0.75f, 0.75f, 0.75f, 0.75f);
                             invisibleButton.textDuration.gameObject.SetActive(true);
                         }
                         else
                         {
                             invisibleButton.textDuration.gameObject.SetActive(false);
                         }
                     }
                     else
                     {
                         invisibleButton.textDuration.textRenderer.Text = ((int)Math.Ceiling(useTime)).ToString();
                         invisibleButton.textDuration.gameObject.SetActive(true);
                     }
                 }
                 if (ChameleonPlayer.isInvisible)
                 {
                     setPlayerVisibility(localPlayer, 0.5f);
                 }
                 else
                 {
                     setPlayerVisibility(localPlayer, 1f);
                 }
             }
             else
             {
                 invisibleButton.gameObject.SetActive(false);
                 invisibleButton.textDuration.gameObject.SetActive(false);
             }
         }
         else
         {
             if (ChameleonPlayer.player != null && ChameleonPlayer.player.PlayerControl != null && !ChameleonPlayer.player.PlayerData.IsDead)
             {
                 if (ChameleonPlayer.isInvisible)
                 {
                     setPlayerVisibility(ChameleonPlayer.player, 0f);
                     ChameleonPlayer.player.PlayerControl.nameText.Color = new Color(ChameleonPlayer.player.PlayerControl.nameText.Color.r, ChameleonPlayer.player.PlayerControl.nameText.Color.g, ChameleonPlayer.player.PlayerControl.nameText.Color.b, 0f);
                 }
                 else
                 {
                     setPlayerVisibility(ChameleonPlayer.player, 1f);
                     ChameleonPlayer.player.PlayerControl.nameText.Color = new Color(ChameleonPlayer.player.PlayerControl.nameText.Color.r, ChameleonPlayer.player.PlayerControl.nameText.Color.g, ChameleonPlayer.player.PlayerControl.nameText.Color.b, 1f);
                 }
             }
         }
     }
     if (GameData.currentGame.GameState != GameStates.Started)
     {
         if (frame < 60)
         {
             frame++;
         }
         else
         {
             frame = 0;
             hideGameMenuSettings();
         }
     }
 }