예제 #1
0
        public static bool Prefix(SpawnInMinigame __instance)
        {
            if (PlayerControl.LocalPlayer.Is(RoleEnum.Phantom))
            {
                var caught = Role.GetRole <Phantom>(PlayerControl.LocalPlayer).Caught;
                if (!caught)
                {
                    __instance.Close();
                    return(false);
                }
            }

            return(true);
        }
예제 #2
0
            static bool Prefix(SpawnInMinigame __instance)
            {
                //respawn a true || GameStarted == false
                if (AirshipSpawn.MeetingRespawn.GetValue() || !GameStarted)   // respawn a false et GameStarted ==  true
                {
                    GameStarted = true;
                    var Spawn = __instance.Locations.ToArray <SpawnInMinigame.SpawnLocation>();

                    if (AirshipSpawn.NewSpawn.GetValue())
                    {
                        Spawn = AddSpawn(Location: new Vector3(-8.808f, 12.710f, 0.013f), name: StringNames.VaultRoom, Sprite: ResourceLoader.VaultSprite, Rollover: ResourceLoader.VaultAnim, RolloverSfx: Spawn[0].RolloverSfx, array: Spawn);
                        Spawn = AddSpawn(Location: new Vector3(-19.278f, -1.033f, 0), name: StringNames.Cockpit, Sprite: ResourceLoader.CokpitSprite, Rollover: ResourceLoader.CokpitAnim, RolloverSfx: Spawn[0].RolloverSfx, array: Spawn);

                        __instance.Locations = Spawn;
                    }
                    if (AirshipSpawn.TypeSpawn.GetValue() != 0)
                    {
                        for (int i = 0; i < Spawn.Length; i++)
                        {
                            AirshipSpawn.Logger.LogInfo($"Name : {Spawn[i].Name}, i : {i}");
                        }
                        for (int i = 0; i < SpawnPoints.Count; i++)
                        {
                            AirshipSpawn.Logger.LogInfo($"i : {SpawnPoints[i]}");
                        }

                        if (AirshipSpawn.TypeSpawn.GetValue() == 1)
                        {
                            __instance.Locations = new SpawnInMinigame.SpawnLocation[3] {
                                AirshipSpawn.NewSpawn.GetValue() ? Spawn[7] : Spawn[3], Spawn[2], Spawn[5]
                            }
                        }
                        ;
                        else if (AirshipSpawn.TypeSpawn.GetValue() == 2)
                        {
                            __instance.Locations = new SpawnInMinigame.SpawnLocation[3] {
                                Spawn[SpawnPoints[0]], Spawn[SpawnPoints[1]], Spawn[SpawnPoints[2]]
                            }
                        }
                        ;
                    }

                    return(true);
                }
                __instance.Close();
                PlayerControl.LocalPlayer.NetTransform.RpcSnapTo(GetMeetingPosition(PlayerControl.LocalPlayer.PlayerId));
                return(false);
            }
예제 #3
0
            static bool Prefix(SpawnInMinigame __instance)
            {
                if (BetterAirShip.MeetingRespawn.GetValue() || !GameStarted)
                {
                    GameStarted = true;
                    var Spawn = __instance.Locations.ToArray();

                    if (BetterAirShip.NewSpawn.GetValue())
                    {
                        Spawn = AddSpawn(Location: new Vector3(-8.808f, 12.710f, 0.013f), name: StringNames.VaultRoom, Sprite: AssetsLoader.VaultSprite, Rollover: AssetsLoader.VaultAnim, RolloverSfx: Spawn[0].RolloverSfx, array: Spawn);
                        Spawn = AddSpawn(Location: new Vector3(-19.278f, -1.033f, 0), name: StringNames.Cockpit, Sprite: AssetsLoader.CokpitSprite, Rollover: AssetsLoader.CokpitAnim, RolloverSfx: Spawn[0].RolloverSfx, array: Spawn);
                        Spawn = AddSpawn(Location: new Vector3(29.041f, -6.336f, 0), name: StringNames.Medical, Sprite: AssetsLoader.MedicalSprite, Rollover: AssetsLoader.MedicalAnim, RolloverSfx: Spawn[0].RolloverSfx, array: Spawn);

                        __instance.Locations = Spawn;
                    }

                    if (BetterAirShip.TypeSpawn.GetValue() != 0)
                    {
                        if (BetterAirShip.TypeSpawn.GetValue() == 1)
                        {
                            __instance.Locations = new SpawnInMinigame.SpawnLocation[3] {
                                BetterAirShip.NewSpawn.GetValue() ? Spawn[7] : Spawn[3], Spawn[2], Spawn[5]
                            }
                        }
                        ;
                        else if (BetterAirShip.TypeSpawn.GetValue() == 2)
                        {
                            __instance.Locations = new SpawnInMinigame.SpawnLocation[3] {
                                Spawn[SpawnPoints[0]], Spawn[SpawnPoints[1]], Spawn[SpawnPoints[2]]
                            }
                        }
                        ;
                    }
                    return(true);
                }

                __instance.Close();
                PlayerControl.LocalPlayer.moveable = true;
                PlayerControl.LocalPlayer.NetTransform.RpcSnapTo(GetMeetingPosition(PlayerControl.LocalPlayer.PlayerId));
                return(false);
            }
예제 #4
0
        public static void Postfix(SpawnInMinigame __instance)
        {
            selected = null;

            if (!CustomOptionHolder.airshipSynchronizedSpawning.getBool() || CustomOptionHolder.airshipRandomSpawn.getBool())
            {
                return;
            }

            foreach (var button in __instance.LocationButtons)
            {
                button.OnClick.AddListener((UnityEngine.Events.UnityAction)(() =>
                {
                    if (selected == null)
                    {
                        selected = button;
                    }
                }
                                                                            ));
            }
        }
예제 #5
0
        public static bool Prefix2(SpawnInMinigame __instance, [HarmonyArgument(0)] Vector3 spawnAt)
        {
            if (!CustomOptionHolder.airshipSynchronizedSpawning.getBool() || CustomOptionHolder.airshipRandomSpawn.getBool())
            {
                if (isFirstSpawn)
                {
                    resetButtons();
                }
                CustomButton.stopCountdown = false;
                return(true);
            }

            Synchronize(SynchronizeTag.PreSpawnMinigame, PlayerControl.LocalPlayer.PlayerId);
            if (__instance.amClosing != Minigame.CloseState.None)
            {
                return(false);
            }
            if (__instance.gotButton)
            {
                return(false);
            }

            __instance.gotButton = true;


            foreach (var button in __instance.LocationButtons)
            {
                button.enabled = false;
            }

            __instance.StartCoroutine(Effects.Lerp(10f, new Action <float>((p) =>
            {
                float time = p * 10f;


                foreach (var button in __instance.LocationButtons)
                {
                    if (selected == button)
                    {
                        if (time > 0.3f)
                        {
                            float x = button.transform.localPosition.x;
                            if (x < 0f)
                            {
                                x += 10f * Time.deltaTime;
                            }
                            if (x > 0f)
                            {
                                x -= 10f * Time.deltaTime;
                            }
                            if (Mathf.Abs(x) < 10f * Time.deltaTime)
                            {
                                x = 0f;
                            }
                            button.transform.localPosition = new Vector3(x, button.transform.localPosition.y, button.transform.localPosition.z);
                        }
                    }
                    else
                    {
                        var color = button.GetComponent <SpriteRenderer>().color;
                        float a   = color.a;
                        if (a > 0f)
                        {
                            a -= 2f * Time.deltaTime;
                        }
                        if (a < 0f)
                        {
                            a = 0f;
                        }
                        button.GetComponent <SpriteRenderer>().color        = new Color(color.r, color.g, color.b, a);
                        button.GetComponentInChildren <TextMeshPro>().color = new Color(1f, 1f, 1f, a);
                    }

                    if (__instance.amClosing != Minigame.CloseState.None)
                    {
                        return;
                    }

                    if (synchronizeData.Align(SynchronizeTag.PreSpawnMinigame, false) || p == 1f)
                    {
                        PlayerControl.LocalPlayer.gameObject.SetActive(true);
                        __instance.StopAllCoroutines();
                        PlayerControl.LocalPlayer.NetTransform.RpcSnapTo(spawnAt);
                        DestroyableSingleton <HudManager> .Instance.PlayerCam.SnapToTarget();
                        synchronizeData.Reset(SynchronizeTag.PreSpawnMinigame);
                        __instance.Close();
                        CustomButton.stopCountdown = false;
                        // サボタージュのクールダウンをリセット
                        SabotageSystemType saboSystem = ShipStatus.Instance.Systems[SystemTypes.Sabotage].Cast <SabotageSystemType>();
                        AccessTools.PropertySetter(typeof(SabotageSystemType), "IsDirty").Invoke(saboSystem, new object[]
                        {
                            true
                        });
                        saboSystem.ForceSabTime(0f);
                        saboSystem.Timer           = initialSabotageCooldown;
                        DoorsSystemType doorSystem = ShipStatus.Instance.Systems[SystemTypes.Doors].Cast <DoorsSystemType>();
                        AccessTools.PropertySetter(typeof(DoorsSystemType), "IsDirty").Invoke(doorSystem, new object[]
                        {
                            true
                        });
                        doorSystem.timers[SystemTypes.MainHall] = initialDoorCooldown;
                        doorSystem.timers[SystemTypes.Brig]     = initialDoorCooldown;
                        doorSystem.timers[SystemTypes.Comms]    = initialDoorCooldown;
                        doorSystem.timers[SystemTypes.Medical]  = initialDoorCooldown;
                        doorSystem.timers[SystemTypes.Engine]   = initialDoorCooldown;
                        doorSystem.timers[SystemTypes.Records]  = initialDoorCooldown;
                        doorSystem.timers[SystemTypes.Kitchen]  = initialDoorCooldown;

                        if (isFirstSpawn)
                        {
                            resetButtons();
                        }
                    }
                }
            })));

            return(false);
        }
예제 #6
0
        public static bool Prefix(SpawnInMinigame __instance, PlayerTask task)
        {
            CustomButton.stopCountdown = true;
            // base.Begin(task);
            __instance.MyTask     = task;
            __instance.MyNormTask = (task as NormalPlayerTask);
            if (PlayerControl.LocalPlayer)
            {
                if (MapBehaviour.Instance)
                {
                    MapBehaviour.Instance.Close();
                }
                PlayerControl.LocalPlayer.NetTransform.Halt();
            }
            __instance.StartCoroutine(__instance.CoAnimateOpen());


            List <SpawnInMinigame.SpawnLocation> list = __instance.Locations.ToList <SpawnInMinigame.SpawnLocation>();

            foreach (var spawnCandidate in SpawnCandidates)
            {
                SpawnInMinigame.SpawnLocation spawnlocation = new SpawnInMinigame.SpawnLocation();
                spawnlocation.Location    = spawnCandidate.SpawnLocation;
                spawnlocation.Image       = spawnCandidate.GetSprite();
                spawnlocation.Name        = spawnCandidate.LocationKey;
                spawnlocation.Rollover    = new AnimationClip();
                spawnlocation.RolloverSfx = __instance.DefaultRolloverSound;
                list.Add(spawnlocation);
            }

            SpawnInMinigame.SpawnLocation[] array = list.ToArray <SpawnInMinigame.SpawnLocation>();
            array.Shuffle(0);
            array = (from s in array.Take(__instance.LocationButtons.Length)
                     orderby s.Location.x, s.Location.y descending
                     select s).ToArray <SpawnInMinigame.SpawnLocation>();
            PlayerControl.LocalPlayer.NetTransform.RpcSnapTo(new Vector2(-25f, 40f));

            for (int i = 0; i < __instance.LocationButtons.Length; i++)
            {
                PassiveButton passiveButton      = __instance.LocationButtons[i];
                SpawnInMinigame.SpawnLocation pt = array[i];
                passiveButton.OnClick.AddListener((UnityEngine.Events.UnityAction)(() => __instance.SpawnAt(pt.Location)));
                passiveButton.GetComponent <SpriteAnim>().Stop();
                passiveButton.GetComponent <SpriteRenderer>().sprite = pt.Image;
                // passiveButton.GetComponentInChildren<TextMeshPro>().text = DestroyableSingleton<TranslationController>.Instance.GetString(pt.Name, Array.Empty<object>());
                passiveButton.GetComponentInChildren <TextMeshPro>().text = DestroyableSingleton <TranslationController> .Instance.GetString(pt.Name, new Il2CppReferenceArray <Il2CppSystem.Object>(0));

                ButtonAnimRolloverHandler component = passiveButton.GetComponent <ButtonAnimRolloverHandler>();
                component.StaticOutImage = pt.Image;
                component.RolloverAnim   = pt.Rollover;
                component.HoverSound     = (pt.RolloverSfx ? pt.RolloverSfx : __instance.DefaultRolloverSound);
            }


            PlayerControl.LocalPlayer.gameObject.SetActive(false);
            PlayerControl.LocalPlayer.NetTransform.RpcSnapTo(new Vector2(-25f, 40f));
            if (CustomOptionHolder.airshipRandomSpawn.getBool())
            {
                __instance.LocationButtons.Random <PassiveButton>().ReceiveClickUp();
            }
            else
            {
                __instance.StartCoroutine(__instance.RunTimer());
            }
            ControllerManager.Instance.OpenOverlayMenu(__instance.name, null, __instance.DefaultButtonSelected, __instance.ControllerSelectable, false);
            PlayerControl.HideCursorTemporarily();
            ConsoleJoystick.SetMode_Menu();
            return(false);
        }