コード例 #1
0
 public static void Postfix(EndGameManager __instance)
 {
     CustomGameObjectManager.deleteAll();
     HudManagerPatch.LoadSprites();
     if (LoveCoupleWins)
     {
         PoolablePlayer[] players = GameObject.FindObjectsOfType <PoolablePlayer>();
         if (players[0] != null)
         {
             players[0].gameObject.transform.position -= new Vector3(1.5f, 0, 0);
             players[0].SetFlipX(true);
             players[0].NameText.text = "<color=#FF80D5FF>" + players[0].NameText.text + "</color>";
         }
         if (players[1] != null)
         {
             players[1].SetFlipX(false);
             players[1].gameObject.transform.position    = players[0].gameObject.transform.position + new Vector3(1.2f, 0, 0);
             players[1].gameObject.transform.localScale *= 0.92f;
             players[1].HatSlot.transform.position      += new Vector3(0.1f, 0, 0);
             players[1].NameText.text = "<color=#FF80D5FF>" + players[1].NameText.text + "</color>";
         }
         __instance.BackgroundBar.material.color = Love.color;
         var wintext = GameObject.Instantiate(players[0].NameText);
         wintext.text = "<color=#FF80D5FF>Love couple wins</color > ";
         wintext.transform.position  += new Vector3(0, 1.4f, 0);
         wintext.transform.localScale = new Vector3(1.5f, 1.5f, 1);
         wintext.color = new Color(1, 1, 1, 1);
         Heart heart = new Heart();
         heart.go.transform.position   = players[0].transform.position + new Vector3(0.35f, 0.55f, 0);
         heart.go.transform.localScale = new Vector3(0.2f, 0.2f, 1);
         CustomGameObjectManager.AddObject(heart);
     }
 }
コード例 #2
0
        public static void Postfix(HudManager __instance)
        {
            HUD = __instance;



            CustomGameObjectManager.Update();
            PlayerController.Update();
            var localplayer = PlayerController.getLocalPlayer();

            if (localplayer != null)
            {
                if (localplayer.hasComponent("Love"))
                {
                    if (!HUD.Chat.isActiveAndEnabled)
                    {
                        HUD.Chat.SetVisible(true);
                    }

                    Love love = (Love)localplayer.GetComponentByName("Love");
                    if (love.lover.isAlive())
                    {
                        HUD.TaskText.text = "<color=#FF80D5FF>Primary objective:</color>\n"
                                            + "<color=#FFFFFFFF>Stay alive with your love </color><color=#FF80D5FF>" + love.lover.playerdata.name + "\n</color>and win together"
                                            + "\n\nSecondary objective: \n" + HUD.FGIFCILIPEH.ToString();
                    }
                }
            }
        }
コード例 #3
0
        public static void Postfix(Il2CppReferenceArray <GameData.LGBOMGHJELL> BHNEINNHPIJ)
        {
            PlayerController.InitPlayers();

            CustomGameObjectManager.deleteAll();

            EndGameManagerPatch.LoveCoupleWins = false;
            List <Player> crewmates = getCrewMates(BHNEINNHPIJ);
            int           lover1idx = (byte)new System.Random().Next(0, crewmates.Count);



            int lover2idx = (byte)new System.Random().Next(0, crewmates.Count);

            if (lover1idx == lover2idx)
            {
                lover2idx = (lover2idx + 1) % crewmates.Count;
            }



            Player[] impostors = PlayerController.getImpostors();
            byte     r         = (byte)new System.Random().Next(0, 3);

            if (r == 0)
            {
                lover2idx = (byte)new System.Random().Next(0, impostors.Length);
            }

            Player lover1 = crewmates[lover1idx];
            Player lover2 = crewmates[lover2idx];

            if (r == 0)
            {
                lover2 = impostors[lover2idx];
            }



            MessageWriter writer = AmongUsClient.Instance.StartRpc(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetCouple, Hazel.SendOption.Reliable);

            writer.Write(lover1.playerdata.PlayerId);

            writer.Write(lover2.playerdata.PlayerId);
            writer.Write(r);
            writer.EndMessage();
            lover1.components.Add(new Love(lover1, lover2));
            lover2.components.Add(new Love(lover2, lover1));
            HudManagerPatch.LoadSprites();
            var localplayer = PlayerController.getLocalPlayer();

            if (lover1 == localplayer | lover2 == localplayer)
            {
                CustomGameObjectManager.AddObject(new Heart(lover1.playerdata.nameText));
                CustomGameObjectManager.AddObject(new Heart(lover2.playerdata.nameText));
            }
        }
コード例 #4
0
        public static void Postfix(byte ONIABIILFGF, MessageReader JIGFBHFFNFI)
        {
            var reader = JIGFBHFFNFI;

            switch (ONIABIILFGF)
            {
            case (byte)CustomRPC.SyncCustomSettings:
            {
                CustomGameOptions.BothLoversDie = reader.ReadBoolean();
                break;
            }

            case (byte)CustomRPC.SetCouple:
            {
                byte lover1id = reader.ReadByte();
                byte lover2id = reader.ReadByte();
                byte r        = reader.ReadByte();
                HudManagerPatch.LoadSprites();
                PlayerController.InitPlayers();
                CustomGameObjectManager.deleteAll();
                EndGameManagerPatch.LoveCoupleWins = false;

                Player lover1 = PlayerController.getPlayerById(lover1id);
                Player lover2 = PlayerController.getPlayerById(lover2id);

                lover1.components.Add(new Love(lover1, lover2));
                lover2.components.Add(new Love(lover2, lover1));
                if (r == 0)
                {
                    ((Love)lover2.GetComponentByName("Love")).spawnedAsImpostor = true;
                }
                var localplayer = PlayerController.getLocalPlayer();
                if (lover1 == localplayer | lover2 == localplayer)
                {
                    CustomGameObjectManager.AddObject(new Heart(lover1.playerdata.nameText));
                    CustomGameObjectManager.AddObject(new Heart(lover2.playerdata.nameText));
                }
                break;
            }

            case (byte)CustomRPC.LoveWin:
            {
                LoveCoupleWins();
                break;
            }

            case (byte)CustomRPC.LoveSuicide:
            {
                byte   target = reader.ReadByte();
                Player player = PlayerController.getPlayerById(target);
                player.playerdata.MurderPlayer(player.playerdata);
                break;
            }
            }
        }