public CustomButton(Hud __instance, float cd, float dur, String pathAsset) { gameObject = new GameObject(); gameObject.transform.SetParent(__instance.gameObject.transform, false); gameObject.transform.localPosition = new Vector3(0, 0); cooldown = cd; duration = dur; Stream myStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(pathAsset); byte[] byteArray = new byte[myStream.Length]; myStream.Read(byteArray, 0, (int)myStream.Length); texture = new Texture2D(2, 2, TextureFormat.ARGB32, false); var il2cppArray = (Il2CppStructArray <byte>)byteArray; iCall_LoadImage(texture.Pointer, il2cppArray.Pointer, false); spriteRenderer = gameObject.AddComponent <SpriteRenderer>(); spriteRenderer.sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f)); textDuration = new CustomText(__instance, -0.10f, 0.45f, "0", gameObject.transform); textDuration.textRenderer.scale = 2; textDuration.textRenderer.Centered = true; textDuration.gameObject.SetActive(true); lastUsed = DateTime.UtcNow.AddSeconds(-duration - cooldown + 15); }
public CustomText(Hud __instance, float x, float y, string text, Transform parent) { gameObject = new GameObject(); gameObject.transform.SetParent(parent); gameObject.transform.localPosition = new Vector3(x, y); textRenderer = UnityEngine.Object.Instantiate(__instance.TaskText, gameObject.transform); textRenderer.Text = text; }
public static void Postfix(HudManager __instance) { if (MeetingHud.Instance != null) { HudPatch.updateMeetingHUD(MeetingHud.Instance); } if (PlayerControl.AllPlayerControls.Count > 1 && PlayerControlPatch.Torch != null && PlayerControlPatch.isTorch(PlayerControl.LocalPlayer)) { PlayerControl.LocalPlayer.nameText.Color = new Color(1f, 0.37f, 0.125f, 1f); } }
public static void Postfix(HudManager __instance) { if (MeetingHud.Instance != null) { HudPatch.updateMeetingHUD(MeetingHud.Instance); } if (PlayerControl.AllPlayerControls.Count > 1 && PlayerControlPatch.Mayor != null && PlayerControlPatch.IsMayor(PlayerControl.LocalPlayer)) { PlayerControl.LocalPlayer.nameText.Color = new Color(0.44f, 0.31f, 0.66f, 1f); } }
public static void Postfix(HudManager __instance) { HUD = __instance; KillButton = __instance.KillButton; PlayerController.Update(); if (OOCJALPKPEP.Instance != null) { updateMeetingHUD(OOCJALPKPEP.Instance); } }
public static void updateGameSettingsText(Hud __instance) { if (__instance.GameSettings.Text.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries).Count() == 19) { GameSettingsText = __instance.GameSettings.Text; } if (GameSettingsText != null) { string append = String.Empty; append += $"Chameleon Duration: {CustomGameOptions.invisibilityDuration.ToString()}s\n"; append += $"Chameleon Cooldown: {CustomGameOptions.invisibilityCooldown.ToString()}s\n"; __instance.GameSettings.Text = GameSettingsText + append; } }
public static void UpdateGameSettingsText(PIEFJFEOGOL __instance) { if (__instance.GameSettings.Text.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries).Count() == 19) { GameSettingsText = __instance.GameSettings.Text; } if (GameSettingsText != null) { if (CustomGameOptions.showSheriff) { __instance.GameSettings.Text = GameSettingsText + "Show Sheriff: On" + "\n"; } else { __instance.GameSettings.Text = GameSettingsText + "Show Sheriff: Off" + "\n"; } __instance.GameSettings.Text += "Sheriff Kill Cooldown: " + CustomGameOptions.SheriffKillCD.ToString() + "s"; } }
public static void Postfix(PIEFJFEOGOL __instance) { KillButton = __instance.KillButton; if (OOCJALPKPEP.Instance != null) { updateOOCJALPKPEP(OOCJALPKPEP.Instance); } UpdateGameSettingsText(__instance); if (FFGALNAPKCD.AllPlayerControls.Count > 1 & PlayerControlPatch.Sheriff != null) { if (PlayerControlPatch.isSheriff(FFGALNAPKCD.LocalPlayer)) { FFGALNAPKCD.LocalPlayer.nameText.Color = new Color(1, (float)(204.0 / 255.0), 0, 1); if (FFGALNAPKCD.LocalPlayer.NDGFFHMFGIG.DLPCKPBIJOE) { KillButton.gameObject.SetActive(false); KillButton.isActive = false; } else { KillButton.gameObject.SetActive(true); KillButton.isActive = true; KillButton.SetCoolDown(PlayerControlPatch.SheriffKillTimer(), FFGALNAPKCD.GameOptions.IGHCIKIDAMO + 15.0f); PlayerControlPatch.closestPlayer = PlayerControlPatch.getClosestPlayer(FFGALNAPKCD.LocalPlayer); double dist = PlayerControlPatch.getDistBetweenPlayers(FFGALNAPKCD.LocalPlayer, PlayerControlPatch.closestPlayer); if (dist < KMOGFLPJLLK.JMLGACIOLIK[FFGALNAPKCD.GameOptions.DLIBONBKPKL]) { KillButton.SetTarget(PlayerControlPatch.closestPlayer); } if (Input.GetKeyInt(KeyCode.Q)) { KillButton.PerformKill(); } } } else if (FFGALNAPKCD.LocalPlayer.NDGFFHMFGIG.DAPKNDBLKIA) { if (FFGALNAPKCD.LocalPlayer.NDGFFHMFGIG.DLPCKPBIJOE) { KillButton.gameObject.SetActive(false); KillButton.isActive = false; } else { KillButton.gameObject.SetActive(true); KillButton.isActive = true; } } } if (counter < 30) { counter++; return; } counter = 0; if (GameOptionMenuPatch.showSheriffOption != null && GameOptionMenuPatch.SheriffCooldown != null) { var isOptionsMenuActive = GameObject.FindObjectsOfType <PHCKLDDNJNP>().Count != 0; GameOptionMenuPatch.showSheriffOption.gameObject.SetActive(isOptionsMenuActive); GameOptionMenuPatch.SheriffCooldown.gameObject.SetActive(isOptionsMenuActive); } }
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(); } } }