Пример #1
0
        public static void Postfix(GameOptionsMenu __instance)
        {
            __instance.GetComponentInParent <Scroller>().YBounds.max = -0.5F + __instance.Children.Length * 0.55F;
            timer += Time.deltaTime;
            if (timer < 0.1f)
            {
                return;
            }
            timer = 0f;

            float offset = -7.85f;

            foreach (CustomOption option in CustomOption.options)
            {
                if (option?.optionBehaviour != null && option.optionBehaviour.gameObject != null)
                {
                    bool enabled = true;
                    var  parent  = option.parent;
                    while (parent != null && enabled)
                    {
                        enabled = parent.selection != 0;
                        parent  = parent.parent;
                    }
                    option.optionBehaviour.gameObject.SetActive(enabled);
                    if (enabled)
                    {
                        offset -= option.isHeader ? 0.75f : 0.5f;
                        option.optionBehaviour.transform.localPosition = new Vector3(option.optionBehaviour.transform.localPosition.x, offset, option.optionBehaviour.transform.localPosition.z);
                    }
                }
            }
        }
        private static void GameOptionsMenuUpdate(GameOptionsMenu __instance)
        {
            if (Options.Count > 0)
            {
                List <OptionBehaviour> options = (__instance.Children.Length >= defaultGameOptionsCount ? __instance.Children.Take(defaultGameOptionsCount) :
                                                  __instance.Children.Where(option => !Options.Any(o => o.GameObject == option))).ToList();

                float lowestY = options.Min(option => option.transform.localPosition.y);
                int   i       = 0;

                foreach (CustomOption option in Options)
                {
                    if (!option.GameObject?.gameObject)
                    {
                        continue;
                    }

                    option.GameObject.gameObject.SetActive(option.MenuVisible);

                    if (option.MenuVisible)
                    {
                        option.GameObject.transform.localPosition = new Vector3(option.GameObject.transform.localPosition.x, lowestY - ++i * 0.5F, option.GameObject.transform.localPosition.z);

                        options.Add(option.GameObject);
                    }
                }

                __instance.Children = options.ToArray();
            }

            __instance.GetComponentInParent <Scroller>().YBounds.max = (__instance.Children.Length - 7) * 0.5F + 0.13F;
        }
Пример #3
0
        public static void Postfix1(GameOptionsMenu __instance)
        {
            if (showJesterOption != null)
            {
                showJesterOption.transform.position = option.transform.position - new Vector3(0, 0.5f, 0);

                __instance.GetComponentInParent <Scroller>().YBounds.max = defaultBounds + 0.5f;
            }
        }
Пример #4
0
        public static void Postfix(GameOptionsMenu __instance)
        {
            instance = __instance;

            defaultBounds = __instance.GetComponentInParent <Scroller>().YBounds.max;

            option = __instance.Children[__instance.Children.Count - 1];

            CustomPlayerMenuPatch.AddOptions();
        }
Пример #5
0
            static void Postfix(ref GameOptionsMenu __instance)
            {
                var thisPos  = -8.35f;
                var killCool = __instance.GetComponentsInChildren <NumberOption>()[1];

                foreach (NumberOption num in __instance.GetComponentsInChildren <NumberOption>())
                {
                    if (num.name == "KillCooldown")
                    {
                        killCool = num;
                    }
                }

                foreach (CustomNumberOption custom in numOpts)
                {
                    var countOption = UnityEngine.Object.Instantiate(killCool, __instance.transform);
                    countOption.transform.localPosition = new Vector3(countOption.transform.localPosition.x, thisPos, countOption.transform.localPosition.z);
                    countOption.Title = custom.numOptionTitle;
                    countOption.Value = custom.value;
                    var str = "";
                    customTranslationController.Prefix(countOption.Title, ref str);
                    countOption.TitleText.text = str;
                    countOption.OnValueChanged = new Action <OptionBehaviour>(OnValueChanged);
                    countOption.gameObject.AddComponent <OptionBehaviour>();
                    __instance.GetComponentInParent <Scroller>().YBounds.max += 0.3f;
                    thisPos -= 0.50f;
                }

                foreach (CustomBoolOption custom in boolOpts)
                {
                    var toggleOption = UnityEngine.Object.Instantiate(__instance.GetComponentsInChildren <ToggleOption>()[1], __instance.transform);
                    toggleOption.transform.localPosition = new Vector3(toggleOption.transform.localPosition.x, thisPos, toggleOption.transform.localPosition.z);
                    toggleOption.Title             = custom.boolOptionTitle;
                    toggleOption.CheckMark.enabled = custom.value;
                    var str2 = "";
                    customTranslationController.Prefix(toggleOption.Title, ref str2);
                    toggleOption.TitleText.text = str2;
                    toggleOption.OnValueChanged = new Action <OptionBehaviour>(OnValueChanged);
                    toggleOption.gameObject.AddComponent <OptionBehaviour>();
                    __instance.GetComponentInParent <Scroller>().YBounds.max += 0.3f;
                    thisPos -= 0.50f;
                }
            }
Пример #6
0
        public static void Postfix2(GameOptionsMenu __instance)
        {
            __instance.GetComponentInParent <Scroller>().YBounds.max = (__instance.MCAHCPOHNFI.Count - 7) * 0.5F + 0.13F;
            OptionBehaviour option = __instance.MCAHCPOHNFI[CurrentCount - 1];

            if (MorphDuration != null & MorphCooldown != null)
            {
                MorphDuration.transform.position = option.transform.position - new Vector3(0, 0.5f, 0);
                MorphCooldown.transform.position = option.transform.position - new Vector3(0, 1f, 0);
            }
        }
Пример #7
0
            static void Postfix(ref GameOptionsMenu __instance)
            {
                var   lowestY = GetLowestConfigY(__instance);
                float offset  = 0.0f;

                foreach (var opt in options)
                {
                    offset += 0.5f;

                    opt.Start(__instance, lowestY, offset, OnValueChanged);
                }

                __instance.GetComponentInParent <Scroller>().YBounds.max += offset - 0.9f;
            }
Пример #8
0
 public static void Postfix(ref GameOptionsMenu __instance)
 {
     /*
      * 2 options need 1 = / 2
      * __instance.Children.Length = number of options
      * don't calculate the first 7 options = -7
      * bottom margin = 0.2
      * For v2021.11.9 :
      * no need for the bottom margin anymore
      * don't calculate the first 8.5 options = -8.5
      * = (__instance.Children.Length - 8.5) / 2;
      */
     __instance.GetComponentInParent <Scroller>().YBounds.max = (__instance.Children.Length - 7) / 2.0f + 0.2f;
 }
Пример #9
0
            static void Postfix(ref GameOptionsMenu __instance)
            {
                var lowestY = GetLowestConfigY(__instance);

                var countOption = UnityEngine.Object.Instantiate(__instance.GetComponentsInChildren <NumberOption>()[1],
                                                                 __instance.transform);

                countOption.transform.localPosition = new Vector3(countOption.transform.localPosition.x, lowestY - 0.5f,
                                                                  countOption.transform.localPosition.z);
                countOption.Title = maxPlayerAdminTitle;
                countOption.Value = maxPlayerAdmin;
                var str = "";

                TranslationController_GetString.Prefix(countOption.Title, ref str);
                countOption.TitleText.Text = str;
                countOption.OnValueChanged = new Action <OptionBehaviour>(OnValueChanged);
                countOption.gameObject.AddComponent <OptionBehaviour>();
                countOption.ValidRange.max = 10;
                countOption.ValidRange.min = 3;

                countOption = UnityEngine.Object.Instantiate(__instance.GetComponentsInChildren <NumberOption>()[1],
                                                             __instance.transform);
                countOption.transform.localPosition = new Vector3(countOption.transform.localPosition.x, lowestY - 1.0f,
                                                                  countOption.transform.localPosition.z);
                countOption.Title = maxPlayerCamsTitle;
                countOption.Value = maxPlayerCams;
                str = "";
                TranslationController_GetString.Prefix(countOption.Title, ref str);
                countOption.TitleText.Text = str;
                countOption.OnValueChanged = new Action <OptionBehaviour>(OnValueChanged);
                countOption.gameObject.AddComponent <OptionBehaviour>();
                countOption.ValidRange.max = 10;
                countOption.ValidRange.min = 3;

                countOption = UnityEngine.Object.Instantiate(__instance.GetComponentsInChildren <NumberOption>()[1],
                                                             __instance.transform);
                countOption.transform.localPosition = new Vector3(countOption.transform.localPosition.x, lowestY - 1.5f,
                                                                  countOption.transform.localPosition.z);
                countOption.Title = maxPlayerVitalsTitle;
                countOption.Value = maxPlayerVitals;
                str = "";
                TranslationController_GetString.Prefix(countOption.Title, ref str);
                countOption.TitleText.Text = str;
                countOption.OnValueChanged = new Action <OptionBehaviour>(OnValueChanged);
                countOption.gameObject.AddComponent <OptionBehaviour>();
                countOption.ValidRange.max = 10;
                countOption.ValidRange.min = 3;

                __instance.GetComponentInParent <Scroller>().YBounds.max += 0.6f;
            }
Пример #10
0
            static void Postfix(ref GameOptionsMenu __instance)
            {
                var   lowestY = GetLowestConfigY(__instance);
                float offset  = 0.0f;

                foreach (var opt in options)
                {
                    offset += 0.5f;
                    if (opt.onlyHost && !AmongUsClient.Instance.HHBLOCGKFAB)
                    {
                        continue;
                    }
                    opt.Start(__instance, lowestY, offset, OnValueChanged);
                }

                __instance.GetComponentInParent <Scroller>().YBounds.max += offset - 0.9f;
            }
Пример #11
0
 public static void Postfix(ref GameOptionsMenu __instance)
 {
     __instance.GetComponentInParent <Scroller>().YBounds.max = 70f;
 }
Пример #12
0
 static void Postfix(ref GameOptionsMenu __instance)
 {
     defaultBounds = __instance.GetComponentInParent <Scroller>().YBounds.max;
 }
 public static void Postfix(GameOptionsMenu __instance)
 {
     //__instance.GetComponentInParent<Scroller>().YBounds.max = -0.5F + __instance.Children.Length * 0.4F;
     __instance.GetComponentInParent <Scroller>().YBounds.max = (__instance.Children.Length - 7) * 0.5F + 0.13F;
 }
Пример #14
0
 public static void Postfix(GameOptionsMenu __instance)
 {
     __instance.GetComponentInParent <Scroller>().YBounds.max = -0.5F + __instance.IGFJIPMAJHF.Length * 0.5F;
 }
Пример #15
0
 public static void Postfix(GameOptionsMenu __instance)
 {
     __instance.GetComponentInParent <Scroller>().YBounds.max = __instance.Children.Length * 0.45F;
 }