static void Postfix(CounterArea __instance) { // Hacker display saved colors on the admin panel bool showHackerInfo = Hacker.hacker != null && Hacker.hacker == PlayerControl.LocalPlayer && Hacker.hackerTimer > 0; if (players.ContainsKey(__instance.RoomType)) { List <Color> colors = players[__instance.RoomType]; for (int i = 0; i < __instance.KIFEIHAMMJC.Count; i++) { PoolableBehavior icon = __instance.KIFEIHAMMJC[i]; SpriteRenderer renderer = icon.GetComponent <SpriteRenderer>(); if (renderer != null) { if (defaultIcon == null) { defaultIcon = renderer.sprite; } if (showHackerInfo && colors.Count > i && Hacker.getAdminTableIconSprite() != null) { renderer.sprite = Hacker.getAdminTableIconSprite(); renderer.color = colors[i]; } else { renderer.sprite = defaultIcon; renderer.color = Color.white; } } } } }
static void Postfix(CounterArea __instance) { // Spy display saved colors on the admin panel if (Spy.spy == null || Spy.spy != PlayerControl.LocalPlayer) { return; } if (players.ContainsKey(__instance.RoomType)) { List <Color> colors = players[__instance.RoomType]; for (int i = 0; i < __instance.myIcons.Count; i++) { PoolableBehavior icon = __instance.myIcons[i]; SpriteRenderer renderer = icon.GetComponent <SpriteRenderer>(); if (renderer != null && colors.Count > i && Spy.getAdminTableIconSprite() != null) { renderer.sprite = Spy.getAdminTableIconSprite(); renderer.color = colors[i]; } } } }
static void Postfix(CounterArea __instance) { // Hacker display saved colors on the admin panel bool showHackerInfo = Hacker.hacker != null && Hacker.hacker == PlayerControl.LocalPlayer && Hacker.hackerTimer > 0; if (players.ContainsKey(__instance.RoomType)) { List <Color> colors = players[__instance.RoomType]; for (int i = 0; i < __instance.myIcons.Count; i++) { PoolableBehavior icon = __instance.myIcons[i]; SpriteRenderer renderer = icon.GetComponent <SpriteRenderer>(); if (renderer != null) { if (defaultMat == null) { defaultMat = renderer.material; } if (newMat == null) { newMat = UnityEngine.Object.Instantiate <Material>(defaultMat); } if (showHackerInfo && colors.Count > i) { renderer.material = newMat; var color = colors[i]; renderer.material.SetColor("_BodyColor", color); var id = Palette.PlayerColors.IndexOf(color); if (id < 0) { renderer.material.SetColor("_BackColor", color); } else { renderer.material.SetColor("_BackColor", Palette.ShadowColors[id]); } renderer.material.SetColor("_VisorColor", Palette.VisorColor); } else { renderer.material = defaultMat; } } } } }
public static void UpdateBlips(CounterArea area, List <int> colorMapping) { area.UpdateCount(colorMapping.Count); var icons = area.myIcons.ToArray(); colorMapping.Sort(); for (var i = 0; i < colorMapping.Count; i++) { var icon = icons[i]; var sprite = icon.GetComponent <SpriteRenderer>(); if (sprite != null) { PlayerControl.SetPlayerMaterialColors(colorMapping[i], sprite); } } }
public static void Postfix(CounterArea __instance) { if (!PlayerControl.LocalPlayer.Is(RoleEnum.Spy)) { return; } if (!AllRooms.ContainsKey(__instance.RoomType)) { return; } var list = AllRooms[__instance.RoomType]; for (int i = 0; i < __instance.myIcons.Count; i++) { var poolable = __instance.myIcons.ToArray()[i]; var rend = poolable.GetComponent <SpriteRenderer>(); if (rend != null && list.Count > i) { PlayerControl.SetPlayerMaterialColors(list[i], rend); } } }
public void Generate(MapAsset asset) { // Object GameObject counterObj = new GameObject(asset.name); counterObj.transform.SetParent(countObj.transform); counterObj.transform.localPosition = new Vector3( asset.x * MinimapGenerator.MAP_SCALE * 1.333f, (-asset.y * MinimapGenerator.MAP_SCALE) * 1.333f - 0.25f, -25.0f ); // Counter Area CounterArea counterArea = counterObj.AddComponent <CounterArea>(); counterArea.RoomType = ShipRoomBuilder.db[asset.id]; counterArea.MaxWidth = 5; counterArea.XOffset = 0.3f; counterArea.YOffset = 0.3f; counterArea.pool = countObj.GetComponent <ObjectPoolBehavior>(); count.CountAreas = AssetHelper.AddToArr(count.CountAreas, counterArea); }
static bool Prefix(MapCountOverlay __instance) { // Save colors for the Hacker __instance.HAHFHCCIEGH += Time.deltaTime; if (__instance.HAHFHCCIEGH < 0.1f) { return(false); } __instance.HAHFHCCIEGH = 0f; players = new Dictionary <SystemTypes, List <Color> >(); bool commsActive = false; foreach (PlayerTask task in PlayerControl.LocalPlayer.myTasks) { if (task.TaskType == TaskTypes.FixComms) { commsActive = true; } } if (!__instance.KGMLJDGMIND && commsActive) { __instance.KGMLJDGMIND = true; __instance.BackgroundColor.SetColor(Palette.JMELLHINKGM); __instance.SabotageText.gameObject.SetActive(true); return(false); } if (__instance.KGMLJDGMIND && !commsActive) { __instance.KGMLJDGMIND = false; __instance.BackgroundColor.SetColor(Color.green); __instance.SabotageText.gameObject.SetActive(false); } for (int i = 0; i < __instance.CountAreas.Length; i++) { CounterArea counterArea = __instance.CountAreas[i]; List <Color> roomColors = new List <Color>(); players.Add(counterArea.RoomType, roomColors); if (!commsActive) { PlainShipRoom plainShipRoom = ShipStatus.Instance.EMIBABGLHIO[counterArea.RoomType]; if (plainShipRoom != null && plainShipRoom.roomArea) { int num = plainShipRoom.roomArea.OverlapCollider(__instance.CGAANOHJEKD, __instance.BLDONECDJFJ); int num2 = num; for (int j = 0; j < num; j++) { Collider2D collider2D = __instance.BLDONECDJFJ[j]; if (!(collider2D.tag == "DeadBody")) { PlayerControl component = collider2D.GetComponent <PlayerControl>(); if (!component || component.IDOFAMCIJKE == null || component.IDOFAMCIJKE.GBPMEHJFECK || component.IDOFAMCIJKE.FGNJJFABIHJ) { num2--; } else if (component?.LNMJKMLHMIM?.material != null) { Color color = component.LNMJKMLHMIM.material.GetColor("_BodyColor"); if (Hacker.onlyColorType) { var id = Mathf.Max(0, Palette.CALCLMEEPGL.IndexOf(color)); color = Helpers.isLighterColor((byte)id) ? Palette.CALCLMEEPGL[7] : Palette.CALCLMEEPGL[6]; } roomColors.Add(color); } } else { DeadBody component = collider2D.GetComponent <DeadBody>(); if (component) { GameData.OFKOJOKOOAK OFKOJOKOOAK = GameData.Instance.GetPlayerById(component.ParentId); if (OFKOJOKOOAK != null) { var color = Palette.CALCLMEEPGL[OFKOJOKOOAK.JFHFMIKFHGG]; if (Hacker.onlyColorType) { color = Helpers.isLighterColor(OFKOJOKOOAK.JFHFMIKFHGG) ? Palette.CALCLMEEPGL[7] : Palette.CALCLMEEPGL[6]; } roomColors.Add(color); } } } } counterArea.UpdateCount(num2); } else { Debug.LogWarning("Couldn't find counter for:" + counterArea.RoomType); } } else { counterArea.UpdateCount(0); } } return(false); }
static bool Prefix(MapCountOverlay __instance) { adminTimer += Time.deltaTime; if (adminTimer > 0.1f) { UseAdminTime(); } // Save colors for the Hacker __instance.timer += Time.deltaTime; if (__instance.timer < 0.1f) { return(false); } __instance.timer = 0f; playerColors = new Dictionary <SystemTypes, List <Color> >(); if (MapOptions.restrictDevices > 0 && MapOptions.restrictAdmin) { if (OutOfTime == null) { OutOfTime = UnityEngine.Object.Instantiate(__instance.SabotageText, __instance.SabotageText.transform.parent); OutOfTime.text = ModTranslation.getString("restrictOutOfTime"); } if (TimeRemaining == null) { TimeRemaining = UnityEngine.Object.Instantiate(HudManager.Instance.TaskText, __instance.transform); TimeRemaining.alignment = TMPro.TextAlignmentOptions.BottomRight; TimeRemaining.transform.position = Vector3.zero; TimeRemaining.transform.localPosition = new Vector3(3.25f, 5.25f); TimeRemaining.transform.localScale *= 2f; TimeRemaining.color = Palette.White; } if (PlayerControl.LocalPlayer.isRole(RoleType.EvilHacker) || PlayerControl.LocalPlayer.isRole(RoleType.MimicA)) { TimeRemaining.gameObject.SetActive(false); } else { if (MapOptions.restrictAdminTime <= 0f) { __instance.BackgroundColor.SetColor(Palette.DisabledGrey); OutOfTime.gameObject.SetActive(true); TimeRemaining.gameObject.SetActive(false); if (clearedIcons == false) { foreach (CounterArea ca in __instance.CountAreas) { ca.UpdateCount(0); } clearedIcons = true; } return(false); } clearedIcons = false; OutOfTime.gameObject.SetActive(false); string timeString = TimeSpan.FromSeconds(MapOptions.restrictAdminTime).ToString(@"mm\:ss\.ff"); TimeRemaining.text = String.Format(ModTranslation.getString("timeRemaining"), timeString); //TimeRemaining.color = MapOptions.restrictAdminTime > 10f ? Palette.AcceptedGreen : Palette.ImpostorRed; TimeRemaining.gameObject.SetActive(true); } } bool commsActive = false; foreach (PlayerTask task in PlayerControl.LocalPlayer.myTasks) { if (task.TaskType == TaskTypes.FixComms) { commsActive = true; } } if (!__instance.isSab && commsActive) { __instance.isSab = true; __instance.BackgroundColor.SetColor(Palette.DisabledGrey); __instance.SabotageText.gameObject.SetActive(true); OutOfTime.gameObject.SetActive(false); return(false); } if (__instance.isSab && !commsActive) { __instance.isSab = false; __instance.BackgroundColor.SetColor(Color.green); __instance.SabotageText.gameObject.SetActive(false); OutOfTime.gameObject.SetActive(false); } for (int i = 0; i < __instance.CountAreas.Length; i++) { CounterArea counterArea = __instance.CountAreas[i]; List <Color> roomColors = new List <Color>(); playerColors.Add(counterArea.RoomType, roomColors); if (!commsActive) { PlainShipRoom plainShipRoom = ShipStatus.Instance.FastRooms[counterArea.RoomType]; if (plainShipRoom != null && plainShipRoom.roomArea) { int num = plainShipRoom.roomArea.OverlapCollider(__instance.filter, __instance.buffer); int num2 = num; for (int j = 0; j < num; j++) { Collider2D collider2D = __instance.buffer[j]; if (!(collider2D.tag == "DeadBody")) { PlayerControl component = collider2D.GetComponent <PlayerControl>(); if (!component || component.Data == null || component.Data.Disconnected || component.Data.IsDead) { num2--; } else if (component.isRole(RoleType.Puppeteer) && Puppeteer.stealthed) { num2--; } else if (component == Puppeteer.dummy && !Puppeteer.stealthed) { num2--; } else if (component?.MyRend?.material != null) { // Color color = component.myRend.material.GetColor("_BodyColor"); Color color = Palette.PlayerColors[component.Data.DefaultOutfit.ColorId]; if (Hacker.onlyColorType) { var id = Mathf.Max(0, Palette.PlayerColors.IndexOf(color)); color = Helpers.isLighterColor((byte)id) ? Palette.PlayerColors[7] : Palette.PlayerColors[6]; } roomColors.Add(color); } } else { DeadBody component = collider2D.GetComponent <DeadBody>(); if (component) { GameData.PlayerInfo playerInfo = GameData.Instance.GetPlayerById(component.ParentId); if (playerInfo != null) { var color = Palette.PlayerColors[playerInfo.Object.CurrentOutfit.ColorId]; if (Hacker.onlyColorType) { color = Helpers.isLighterColor(playerInfo.Object.CurrentOutfit.ColorId) ? Palette.PlayerColors[7] : Palette.PlayerColors[6]; } roomColors.Add(color); } } } } counterArea.UpdateCount(num2); } else { Debug.LogWarning("Couldn't find counter for:" + counterArea.RoomType); } } else { counterArea.UpdateCount(0); } } return(false); }
static void Postfix(CounterArea __instance) { // Hacker display saved colors on the admin panel bool showHackerInfo = Hacker.hacker != null && Hacker.hacker == PlayerControl.LocalPlayer && Hacker.hackerTimer > 0; if (playerColors.ContainsKey(__instance.RoomType)) { List <Color> colors = playerColors[__instance.RoomType]; List <Color> impostorColors = new List <Color>(); List <Color> mimicKColors = new List <Color>(); List <Color> deadBodyColors = new List <Color>(); foreach (var p in PlayerControl.AllPlayerControls) { // var color = p.myRend.material.GetColor("_BodyColor"); var color = Palette.PlayerColors[p.Data.DefaultOutfit.ColorId]; if (p.isImpostor()) { impostorColors.Add(color); if (p.isRole(RoleType.MimicK)) { mimicKColors.Add(color); } } else if (p.isDead()) { deadBodyColors.Add(color); } } for (int i = 0; i < __instance.myIcons.Count; i++) { PoolableBehavior icon = __instance.myIcons[i]; SpriteRenderer renderer = icon.GetComponent <SpriteRenderer>(); if (renderer != null) { if (defaultMat == null) { defaultMat = renderer.material; } if (newMat == null) { newMat = UnityEngine.Object.Instantiate <Material>(defaultMat); } if (showHackerInfo && colors.Count > i) { renderer.material = newMat; var color = colors[i]; renderer.material.SetColor("_BodyColor", color); var id = Palette.PlayerColors.IndexOf(color); if (id < 0) { renderer.material.SetColor("_BackColor", color); } else { renderer.material.SetColor("_BackColor", Palette.ShadowColors[id]); } renderer.material.SetColor("_VisorColor", Palette.VisorColor); } else if ((PlayerControl.LocalPlayer.isRole(RoleType.EvilHacker) && EvilHacker.canHasBetterAdmin) || PlayerControl.LocalPlayer.isRole(RoleType.MimicA)) { renderer.material = newMat; var color = colors[i]; if (impostorColors.Contains(color)) { if (mimicKColors.Contains(color)) { color = Palette.PlayerColors[3]; } else { color = Palette.ImpostorRed; } renderer.material.SetColor("_BodyColor", color); var id = Palette.PlayerColors.IndexOf(color); if (id < 0) { renderer.material.SetColor("_BackColor", color); } else { renderer.material.SetColor("_BackColor", Palette.ShadowColors[id]); } renderer.material.SetColor("_VisorColor", Palette.VisorColor); } else if (deadBodyColors.Contains(color)) { color = Palette.Black; renderer.material.SetColor("_BodyColor", color); var id = Palette.PlayerColors.IndexOf(color); if (id < 0) { renderer.material.SetColor("_BackColor", color); } else { renderer.material.SetColor("_BackColor", Palette.ShadowColors[id]); } renderer.material.SetColor("_VisorColor", Palette.VisorColor); } else { renderer.material = defaultMat; } } else { renderer.material = defaultMat; } } } } }
public static bool Prefix(MapCountOverlay __instance) { if (!PlayerControl.LocalPlayer.Is(RoleEnum.Spy)) { return(true); } __instance.timer += Time.deltaTime; if (__instance.timer < 0.1f) { return(false); } __instance.timer = 0f; AllRooms = new Dictionary <SystemTypes, List <int> >(); var task = PlayerControl.LocalPlayer.myTasks.ToArray() .FirstOrDefault(x => x.TaskType == TaskTypes.FixComms); var flag = task != null; if (!__instance.isSab && flag) { __instance.isSab = true; __instance.BackgroundColor.SetColor(Palette.DisabledGrey); __instance.SabotageText.gameObject.SetActive(true); return(false); } if (__instance.isSab && !flag) { __instance.isSab = false; __instance.BackgroundColor.SetColor(Color.green); __instance.SabotageText.gameObject.SetActive(false); } for (int i = 0; i < __instance.CountAreas.Length; i++) { CounterArea counterArea = __instance.CountAreas[i]; var colourList = new List <int>(); AllRooms.Add(counterArea.RoomType, colourList); if (!PlayerTask.PlayerHasTaskOfType <HudOverrideTask>(PlayerControl.LocalPlayer)) { PlainShipRoom plainShipRoom; if (ShipStatus.Instance.FastRooms.ContainsKey(counterArea.RoomType)) { plainShipRoom = ShipStatus.Instance.FastRooms[counterArea.RoomType]; if (!plainShipRoom.roomArea) { continue; } int num = plainShipRoom.roomArea.OverlapCollider(__instance.filter, __instance.buffer); int num2 = num; for (int j = 0; j < num; j++) { Collider2D collider2D = __instance.buffer[j]; if (!(collider2D.tag == "DeadBody")) { PlayerControl component = collider2D.GetComponent <PlayerControl>(); if (!component || component.Data == null || component.Data.Disconnected || component.Data.IsDead) { num2--; } else { colourList.Add(component.Data.ColorId); } } } counterArea.UpdateCount(num2); } else { Debug.LogWarning("Couldn't find counter for:" + counterArea.RoomType); } } else { counterArea.UpdateCount(0); } } return(false); }
static bool Prefix(MapCountOverlay __instance) { // Save colors for the Hacker __instance.timer += Time.deltaTime; if (__instance.timer < 0.1f) { return(false); } __instance.timer = 0f; players = new Dictionary <SystemTypes, List <Color> >(); bool commsActive = false; foreach (PlayerTask task in PlayerControl.LocalPlayer.myTasks) { if (task.TaskType == TaskTypes.FixComms) { commsActive = true; } } if (!__instance.isSab && commsActive) { __instance.isSab = true; __instance.BackgroundColor.SetColor(Palette.DisabledGrey); __instance.SabotageText.gameObject.SetActive(true); return(false); } if (__instance.isSab && !commsActive) { __instance.isSab = false; __instance.BackgroundColor.SetColor(Color.green); __instance.SabotageText.gameObject.SetActive(false); } for (int i = 0; i < __instance.CountAreas.Length; i++) { CounterArea counterArea = __instance.CountAreas[i]; List <Color> roomColors = new List <Color>(); players.Add(counterArea.RoomType, roomColors); if (!commsActive) { PlainShipRoom plainShipRoom = ShipStatus.Instance.FastRooms[counterArea.RoomType]; if (plainShipRoom != null && plainShipRoom.roomArea) { int num = plainShipRoom.roomArea.OverlapCollider(__instance.filter, __instance.buffer); int num2 = num; for (int j = 0; j < num; j++) { Collider2D collider2D = __instance.buffer[j]; if (!(collider2D.tag == "DeadBody")) { PlayerControl component = collider2D.GetComponent <PlayerControl>(); if (!component || component.Data == null || component.Data.Disconnected || component.Data.IsDead) { num2--; } else if (component?.myRend?.material != null) { Color color = component.myRend.material.GetColor("_BodyColor"); if (Hacker.onlyColorType) { var id = Mathf.Max(0, Palette.PlayerColors.IndexOf(color)); color = Helpers.isLighterColor((byte)id) ? Palette.PlayerColors[7] : Palette.PlayerColors[6]; } roomColors.Add(color); } } else { DeadBody component = collider2D.GetComponent <DeadBody>(); if (component) { GameData.PlayerInfo playerInfo = GameData.Instance.GetPlayerById(component.ParentId); if (playerInfo != null) { var color = Palette.PlayerColors[playerInfo.ColorId]; if (Hacker.onlyColorType) { color = Helpers.isLighterColor(playerInfo.ColorId) ? Palette.PlayerColors[7] : Palette.PlayerColors[6]; } roomColors.Add(color); } } } } counterArea.UpdateCount(num2); } else { Debug.LogWarning("Couldn't find counter for:" + counterArea.RoomType); } } else { counterArea.UpdateCount(0); } } return(false); }
static bool Prefix(MapCountOverlay __instance) { // Save colors for the Hacker __instance.PPKFBIONLAL += Time.deltaTime; if (__instance.PPKFBIONLAL < 0.1f) { return(false); } __instance.PPKFBIONLAL = 0f; players = new Dictionary <SystemTypes, List <Color> >(); bool commsActive = false; foreach (PlayerTask task in PlayerControl.LocalPlayer.myTasks) { if (task.TaskType == TaskTypes.FixComms) { commsActive = true; } } if (!__instance.PIMGCOPFDBG && commsActive) { __instance.PIMGCOPFDBG = true; __instance.BackgroundColor.SetColor(Palette.EGHCBLDNCGP); __instance.SabotageText.gameObject.SetActive(true); return(false); } if (__instance.PIMGCOPFDBG && !commsActive) { __instance.PIMGCOPFDBG = false; __instance.BackgroundColor.SetColor(Color.green); __instance.SabotageText.gameObject.SetActive(false); } for (int i = 0; i < __instance.CountAreas.Length; i++) { CounterArea counterArea = __instance.CountAreas[i]; List <Color> roomColors = new List <Color>(); players.Add(counterArea.RoomType, roomColors); if (!commsActive) { PlainShipRoom plainShipRoom = ShipStatus.Instance.DFAAPCDKCCO[counterArea.RoomType]; if (plainShipRoom != null && plainShipRoom.roomArea) { int num = plainShipRoom.roomArea.OverlapCollider(__instance.CMCPAKBKLDP, __instance.HMNBGCJAGLM); int num2 = num; for (int j = 0; j < num; j++) { Collider2D collider2D = __instance.HMNBGCJAGLM[j]; if (!(collider2D.tag == "DeadBody")) { PlayerControl component = collider2D.GetComponent <PlayerControl>(); if (!component || component.PPMOEEPBHJO == null || component.PPMOEEPBHJO.MFFAGDHDHLO || component.PPMOEEPBHJO.IAGJEKLJCCI) { num2--; } else if (component?.KJAENOGGEOK?.material != null) { Color color = component.KJAENOGGEOK.material.GetColor("_BodyColor"); if (Hacker.onlyColorType) { var id = Mathf.Max(0, Palette.AEDCMKGJKAG.IndexOf(color)); color = Helpers.isLighterColor((byte)id) ? Palette.AEDCMKGJKAG[7] : Palette.AEDCMKGJKAG[6]; } roomColors.Add(color); } } else { DeadBody component = collider2D.GetComponent <DeadBody>(); if (component) { GameData.LGBOMGHJELL LGBOMGHJELL = GameData.Instance.GetPlayerById(component.ParentId); if (LGBOMGHJELL != null) { var color = Palette.AEDCMKGJKAG[LGBOMGHJELL.IMMNCAGJJJC]; if (Hacker.onlyColorType) { color = Helpers.isLighterColor(LGBOMGHJELL.IMMNCAGJJJC) ? Palette.AEDCMKGJKAG[7] : Palette.AEDCMKGJKAG[6]; } roomColors.Add(color); } } } } counterArea.UpdateCount(num2); } else { Debug.LogWarning("Couldn't find counter for:" + counterArea.RoomType); } } else { counterArea.UpdateCount(0); } } return(false); }