Beispiel #1
0
        public static void Prefix(IntroCutscene __instance)
        {
            // Arsonist generate player icons
            if (PlayerControl.LocalPlayer != null && PlayerControl.LocalPlayer == Arsonist.arsonist && HudManager.Instance != null)
            {
                int     playerCounter = 0;
                Vector3 bottomLeft    = new Vector3(-HudManager.Instance.UseButton.transform.localPosition.x, HudManager.Instance.UseButton.transform.localPosition.y, HudManager.Instance.UseButton.transform.localPosition.z);
                bottomLeft += new Vector3(-0.25f, -0.25f, 0);
                foreach (PlayerControl player in PlayerControl.AllPlayerControls)
                {
                    if (player != PlayerControl.LocalPlayer)
                    {
                        GameData.PlayerInfo data           = player.Data;
                        PoolablePlayer      poolablePlayer = UnityEngine.Object.Instantiate <PoolablePlayer>(__instance.PlayerPrefab, HudManager.Instance.transform);
                        poolablePlayer.transform.localPosition = bottomLeft + Vector3.right * playerCounter * 0.35f;
                        poolablePlayer.transform.localScale    = Vector3.one * 0.3f;
                        PlayerControl.SetPlayerMaterialColors(data.ColorId, poolablePlayer.Body);
                        DestroyableSingleton <HatManager> .Instance.SetSkin(poolablePlayer.SkinSlot, data.SkinId);

                        poolablePlayer.HatSlot.SetHat(data.HatId, data.ColorId);
                        PlayerControl.SetPetImage(data.PetId, data.ColorId, poolablePlayer.PetSlot);
                        poolablePlayer.NameText.text = data.PlayerName;
                        poolablePlayer.SetFlipX(true);
                        poolablePlayer.setSemiTransparent(true);
                        Arsonist.dousedIcons[player.PlayerId] = poolablePlayer;
                        playerCounter++;
                    }
                }
            }
        }
Beispiel #2
0
        public static void BeginImpostor(IntroCutscene introCutscene)
        {
            introCutscene.ImpostorText.gameObject.SetActive(false);
            introCutscene.Title.Text =
                DestroyableSingleton <TranslationController> .Instance.GetString(StringNames.Impostor,
                                                                                 (Il2CppReferenceArray <Object>) Array.Empty <object>());

            introCutscene.Title.Color = Palette.ImpostorRed;

            GameData.PlayerInfo data = PlayerControl.LocalPlayer.Data;
            if (data != null)
            {
                int            num            = -1;
                int            num2           = 1 / 2;
                float          num3           = 1f - (float)num2 * 0.075f;
                float          num4           = 1f - (float)num2 * 0.035f;
                float          num5           = -8;
                PoolablePlayer poolablePlayer =
                    UnityEngine.Object.Instantiate <PoolablePlayer>(introCutscene.PlayerPrefab, introCutscene.transform);
                poolablePlayer.transform.localPosition = new Vector3((float)(num * num2) * num4,
                                                                     introCutscene.BaseY + (float)num2 * 0.15f, num5 + (float)num2 * 0.01f) * 1.5f;
                Vector3 vector = new Vector3(num3, num3, num3) * 1.5f;
                poolablePlayer.transform.localScale = vector;
                poolablePlayer.SetFlipX(false);
                PlayerControl.SetPlayerMaterialColors((int)data.ColorId, poolablePlayer.Body);
                //DestroyableSingleton<HatManager>.Instance.SetSkin(poolablePlayer.SkinSlot, data.SkinId);
                poolablePlayer.HatSlot.SetHat(data.HatId, (int)data.ColorId);
                PlayerControl.SetPetImage(data.PetId, (int)data.ColorId, poolablePlayer.PetSlot);
                TextRenderer nameText = poolablePlayer.NameText;
                nameText.Text = data.PlayerName;
                nameText.transform.localScale = vector.Inv();
            }
        }
            private static bool Prefix(EndGameManager __instance)
            {
                if (!TempData.EndReason.IsCustom())
                {
                    return(true);
                }

                var  reason = CustomGameOverReasonManager.EndReason;
                bool youWon = CustomGameOverReasonManager.Winners.Any(w => w.IsYou);

                __instance.WinText.text  = reason.WinText;
                __instance.WinText.color = reason.GetWinTextColor(youWon);
                __instance.BackgroundBar.material.SetColor(Color, reason.GetBackgroundColor(youWon));

                AudioClip?sound = reason.Stinger;

                SoundManager.Instance.PlayDynamicSound(
                    "Stinger",
                    sound == null ? __instance.ImpostorStinger : sound,
                    false,
                    (DynamicSound.GetDynamicsFunction)__instance.GetStingerVol
                    );

                for (int i = 0; i < CustomGameOverReasonManager.ShownWinners.Count; i++)
                {
                    var            winner    = CustomGameOverReasonManager.ShownWinners[i];
                    int            oddness   = (i + 1) / 2;
                    PoolablePlayer player    = Object.Instantiate(__instance.PlayerPrefab, __instance.transform);
                    var            transform = player.transform;
                    transform.localPosition = new Vector3(
                        0.8f * (i % 2 == 0 ? -1 : 1) * oddness * 1 - oddness * 0.035f,
                        __instance.BaseY - 0.25f + oddness * 0.1f,
                        (i == 0 ? -8 : -1) + oddness * 0.01f
                        ) * 1.25f;
                    float scale    = 1f - oddness * 0.075f;
                    var   scaleVec = new Vector3(scale, scale, scale) * 1.25f;
                    transform.localScale = scaleVec;
                    if (winner.IsDead)
                    {
                        player.Body.sprite = __instance.GhostSprite;
                        player.SetDeadFlipX(i % 2 == 1);
                        player.HatSlot.color = GhostColor;
                    }
                    else
                    {
                        player.SetFlipX(i % 2 == 0);
                        DestroyableSingleton <HatManager> .Instance.SetSkin(player.SkinSlot, winner.SkinId); // SetSkin
                    }
                    PlayerControl.SetPlayerMaterialColors(winner.ColorId, player.Body);
                    player.HatSlot.SetHat(winner.HatId, winner.ColorId);
                    PlayerControl.SetPetImage(winner.PetId, winner.ColorId, player.PetSlot);
                    player.NameText.text = winner.Name;
                    player.NameText.transform.localScale = global::Extensions.Inv(scaleVec);
                }

                return(false);
            }
Beispiel #4
0
            public static bool Prefix(ref IntroCutscene __instance)
            {
                BaseRole?myRole = PlayerControl.LocalPlayer.GetRole();

                if (myRole == null || myRole.PatchFilterFlags.HasFlag(PatchFilter.IntroCutScene))
                {
                    return(true);
                }

                PlayerControl.LocalPlayer.SetKillTimer(10f);
                HudManager.Instance.KillButton.gameObject.SetActive(myRole.CanKill(null));

                List <PlayerControl> myTeam = PlayerControl.AllPlayerControls.ToArray()
                                              .Where(p => PlayerControl.LocalPlayer.CanSeeSpecial(p))
                                              .OrderBy(p => !p.AmOwner)
                                              .ToList();

                __instance.Title.text  = myRole.Name;
                __instance.Title.color = myRole.Color;
                __instance.BackgroundBar.material.SetColor(Color, myRole.Color);
                __instance.ImpostorText.text = myRole.Description;

                for (var i = 0; i < myTeam.Count; i++)
                {
                    GameData.PlayerInfo data = myTeam[i].Data;
                    int            oddness   = (i + 1) / 2;
                    PoolablePlayer player    = Object.Instantiate(__instance.PlayerPrefab, __instance.transform);
                    player.transform.localPosition = new Vector3(
                        0.8f * oddness * (i % 2 == 0 ? -1 : 1) * (1 - oddness * 0.08f),
                        __instance.BaseY + oddness * 0.15f,
                        (i == 0 ? -8 : -1) + oddness * 0.01f
                        ) * 1.5f;
                    player.SetFlipX(i % 2 == 0);
                    PlayerControl.SetPlayerMaterialColors(data.ColorId, player.Body);
                    DestroyableSingleton <HatManager> .Instance.SetSkin(player.SkinSlot, data.SkinId); // SetSkin

                    player.HatSlot.SetHat(data.HatId, data.ColorId);
                    PlayerControl.SetPetImage(data.PetId, data.ColorId, player.PetSlot);
                    float   scale    = 1f - oddness * 0.075f;
                    Vector3 scaleVec = new Vector3(scale, scale, scale) * 1.5f;
                    player.transform.localScale          = scaleVec;
                    player.NameText.transform.localScale = global::Extensions.Inv(scaleVec);
                    player.NameText.text = myRole.FormatName(data);
                    if (i > 0 && myRole.Visibility != Visibility.Everyone)
                    {
                        player.NameText.gameObject.SetActive(true);
                    }
                }

                return(false);
            }
 public static void Prefix(IntroCutscene __instance)
 {
     if (PlayerControl.LocalPlayer != null && HudManager.Instance != null)
     {
         Vector3 bottomLeft = new Vector3(-HudManager.Instance.UseButton.transform.localPosition.x, HudManager.Instance.UseButton.transform.localPosition.y, HudManager.Instance.UseButton.transform.localPosition.z);
         foreach (PlayerControl p in PlayerControl.AllPlayerControls)
         {
             GameData.PlayerInfo data   = p.Data;
             PoolablePlayer      player = UnityEngine.Object.Instantiate <PoolablePlayer>(__instance.PlayerPrefab, HudManager.Instance.transform);
             player.UpdateFromPlayerOutfit(p.Data.DefaultOutfit, p.Data.IsDead);
             player.SetFlipX(true);
             player.PetSlot.gameObject.SetActive(false);
             player.NameText.text = p.Data.DefaultOutfit.PlayerName;
             player.gameObject.SetActive(false);
             playerIcons[p.PlayerId] = player;
         }
     }
 }
Beispiel #6
0
        public static void Prefix(IntroCutscene __instance)
        {
            // Generate and initialize player icons
            if (PlayerControl.LocalPlayer != null && HudManager.Instance != null)
            {
                Vector3 bottomLeft = new Vector3(-HudManager.Instance.UseButton.transform.localPosition.x, HudManager.Instance.UseButton.transform.localPosition.y, HudManager.Instance.UseButton.transform.localPosition.z);
                foreach (PlayerControl p in PlayerControl.AllPlayerControls)
                {
                    GameData.PlayerInfo data   = p.Data;
                    PoolablePlayer      player = UnityEngine.Object.Instantiate <PoolablePlayer>(__instance.PlayerPrefab, HudManager.Instance.transform);
                    player.UpdateFromPlayerOutfit(p.Data.DefaultOutfit, p.Data.IsDead);
                    player.SetFlipX(true);
                    player.PetSlot.gameObject.SetActive(false);
                    player.NameText.text = p.Data.DefaultOutfit.PlayerName;
                    MapOptions.playerIcons[p.PlayerId] = player;

                    if (PlayerControl.LocalPlayer == BountyHunter.bountyHunter)
                    {
                        player.transform.localPosition = bottomLeft + new Vector3(-0.25f, 0f, 0);
                        player.transform.localScale    = Vector3.one * 0.4f;
                        player.gameObject.SetActive(false);
                    }
                    else if (PlayerControl.LocalPlayer == GM.gm)
                    {
                        player.transform.localPosition = Vector3.zero;
                        player.transform.localScale    = Vector3.one * 0.3f;
                        player.setSemiTransparent(false);
                        player.gameObject.SetActive(false);
                    }
                    else
                    {
                        player.gameObject.SetActive(false);
                    }
                }
            }

            // Force Bounty Hunter to load a new Bounty when the Intro is over
            if (BountyHunter.bounty != null && PlayerControl.LocalPlayer == BountyHunter.bountyHunter)
            {
                BountyHunter.bountyUpdateTimer = 0f;
                if (HudManager.Instance != null)
                {
                    Vector3 bottomLeft = new Vector3(-HudManager.Instance.UseButton.transform.localPosition.x, HudManager.Instance.UseButton.transform.localPosition.y, HudManager.Instance.UseButton.transform.localPosition.z) + new Vector3(-0.25f, 1f, 0);
                    BountyHunter.cooldownText           = UnityEngine.Object.Instantiate <TMPro.TextMeshPro>(HudManager.Instance.KillButton.cooldownTimerText, HudManager.Instance.transform);
                    BountyHunter.cooldownText.alignment = TMPro.TextAlignmentOptions.Center;
                    BountyHunter.cooldownText.transform.localPosition = bottomLeft + new Vector3(0f, -1f, -1f);
                    BountyHunter.cooldownText.gameObject.SetActive(true);
                }
            }

            Arsonist.updateIcons();
            Morphling.resetMorph();
            Camouflager.resetCamouflage();

            if (PlayerControl.LocalPlayer == GM.gm && !GM.hasTasks)
            {
                PlayerControl.LocalPlayer.clearAllTasks();
            }

            if (PlayerControl.LocalPlayer.isGM())
            {
                HudManager.Instance.ShadowQuad.gameObject.SetActive(false);
                HudManager.Instance.ReportButton.gameObject.SetActiveRecursively(false);
                HudManager.Instance.ReportButton.SetActive(false);
                HudManager.Instance.ReportButton.graphic.enabled         = false;
                HudManager.Instance.ReportButton.enabled                 = false;
                HudManager.Instance.ReportButton.graphic.sprite          = null;
                HudManager.Instance.ReportButton.buttonLabelText.enabled = false;
                HudManager.Instance.ReportButton.buttonLabelText.SetText("");

                HudManager.Instance.roomTracker.gameObject.SetActiveRecursively(false);
                HudManager.Instance.roomTracker.text.enabled = false;
                HudManager.Instance.roomTracker.text.SetText("");
                HudManager.Instance.roomTracker.enabled = false;
            }

            // ベントを追加する
            AdditionalVents.AddAdditionalVents();

            // スペシメンにバイタルを移動する
            SpecimenVital.moveVital();

            //タスクバグ修正
            if (PlayerControl.GameOptions.MapId == 4 && CustomOptionHolder.airshipEnableWallCheck.getBool())
            {
                var objects = UnityEngine.GameObject.FindObjectsOfType <Console>().ToList();
                objects.Find(x => x.name == "task_garbage1").checkWalls      = true;
                objects.Find(x => x.name == "task_garbage2").checkWalls      = true;
                objects.Find(x => x.name == "task_garbage3").checkWalls      = true;
                objects.Find(x => x.name == "task_garbage4").checkWalls      = true;
                objects.Find(x => x.name == "task_garbage5").checkWalls      = true;
                objects.Find(x => x.name == "task_shower").checkWalls        = true;
                objects.Find(x => x.name == "task_developphotos").checkWalls = true;
                objects.Find(x => x.name == "DivertRecieve" && x.Room == SystemTypes.Armory).checkWalls   = true;
                objects.Find(x => x.name == "DivertRecieve" && x.Room == SystemTypes.MainHall).checkWalls = true;
            }

            // 最初から一人の場合はLast Impostorになる
            if (AmongUsClient.Instance.AmHost)
            {
                LastImpostor.promoteToLastImpostor();
            }

            // タスクパネルの表示優先度を上げる
            var taskPanel = DestroyableSingleton <HudManager> ._instance.TaskStuff;
            var pos       = taskPanel.transform.position;

            taskPanel.transform.position = new Vector3(pos.x, pos.y, -20);

            // ダミー人形をスポーンさせておく
            if (PlayerControl.LocalPlayer.isRole(RoleType.Puppeteer) && SubmergedCompatibility.isSubmerged())
            {
                var           playerId = (byte)GameData.Instance.GetAvailableId();
                MessageWriter writer   = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SpawnDummy, Hazel.SendOption.Reliable, -1);
                writer.Write(playerId);
                writer.Write(PlayerControl.LocalPlayer.transform.position.x);
                writer.Write(PlayerControl.LocalPlayer.transform.position.y);
                writer.Write(PlayerControl.LocalPlayer.transform.position.z);
                AmongUsClient.Instance.FinishRpcImmediately(writer);
                RPCProcedure.spawnDummy(playerId, PlayerControl.LocalPlayer.transform.position);
            }
        }