public CustomText(Hud __instance, float x, float y, string text, Transform parent)
        {
            gameObject = new GameObject();
            gameObject.transform.SetParent(parent);
            gameObject.transform.localPosition = new Vector3(x, y);

            textRenderer      = UnityEngine.Object.Instantiate(__instance.TaskText, gameObject.transform);
            textRenderer.Text = text;
        }
Exemple #2
0
        private void Start(OptionsMenuBehaviour optionsMenu, GameObject parent)
        {
            //Get original components
            var oBackgroundComponent = Utils.GetChildComponentByName <Component>(optionsMenu, "Background");
            var oCloseButton         = Utils.GetChildComponentByName <Component>(optionsMenu, "CloseButton");
            var oControlText         = Utils.GetChildComponentByName <Component>(optionsMenu, "ControlText");

            //Create component and add it to the parent
            holder = new GameObject(name);

            //Set button parent
            holder.transform.parent = parent == null ? optionsMenu.transform : parent.transform;

            //Configure holder and his components
            holder.layer = 5; //UI
            holder.transform.localScale    = new Vector3(1f, 1f, 1f);
            holder.transform.localPosition = Vector3.back * 20f;

            //clone original sub components
            _backgroundComponent = Object.Instantiate(oBackgroundComponent, holder.transform);
            if (oCloseButton != null)
            {
                _closeButton = Object.Instantiate(oCloseButton, holder.transform);
            }
            _controlText = Object.Instantiate(oControlText, holder.transform);

            //Configure background size
            _backgroundComponent.transform.localPosition = new Vector3(_backgroundComponent.transform.localPosition.x,
                                                                       _backgroundComponent.transform.localPosition.y, 9f);
            var renderer = _backgroundComponent.gameObject.GetComponent <SpriteRenderer>();

            renderer.size = size;
            var collider = _backgroundComponent.gameObject.GetComponent <BoxCollider2D>();

            collider.size = size;

            //Configure close button
            if (_closeButton != null)
            {
                _closeButton.transform.localPosition = new Vector3(pos.x, pos.y);
                var button = _closeButton.gameObject.GetComponent <PassiveButton>();
                Object.Destroy(button);
                button = _closeButton.gameObject.AddComponent <PassiveButton>();
                button.OnClick.AddListener((UnityAction)OnClose);
                button.OnMouseOver = new UnityEvent();
                button.OnMouseOut  = new UnityEvent();
            }

            //Configure title title
            _textRenderer          = _controlText.gameObject.GetComponent <TextRenderer>();
            _textRenderer.Centered = true;
            _controlText.transform.localPosition = new Vector3(/*-(size.x / 2) * 0.90f */ 0f, size.y / 2 * 0.92f);


            //Enable the button
            holder.gameObject.SetActive(false);
        }
Exemple #3
0
        private void Start(OptionsMenuBehaviour optionsMenu, GameObject parent)
        {
            //Get original components
            var oControlGroup = Utils.GetChildComponentByName <Component>(optionsMenu, "ControlGroup");
            var oControlText  = Utils.GetChildComponentByName <Component>(oControlGroup, "ControlText");
            var oIgnoreClose  = Utils.GetChildComponentByName <Component>(optionsMenu, "IgnoreClose");

            if (oIgnoreClose == null)
            {
                oIgnoreClose = Utils.GetChildComponentByName <Component>(optionsMenu, "CloseBackground");
            }

            //Create component and add it to the parent
            _holder = new GameObject(name);

            //Set button parent
            _holder.transform.parent = parent == null ? optionsMenu.transform : parent.transform;

            //Configure holder and his components
            _holder.layer = 5; //UI
            _holder.transform.localScale    = new Vector3(1f, 1f, 1f);
            _holder.transform.localPosition = Vector3.zero;

            //clone original sub components
            _label       = Object.Instantiate(oControlText, _holder.transform);
            _ignoreClose = Object.Instantiate(oIgnoreClose, _holder.transform);

            //Configure label
            _textRenderer = _label.gameObject.GetComponent <TextRenderer>();
            _label.transform.localPosition = new Vector3(labelPos.x, labelPos.y);

            //Create button
            _button = new OptionsMenuButton(optionsMenu, key + "Button", ConfigManager.keyBinds[key].ToString(),
                                            OnClick, buttonPos + new Vector2(0f, -0.2f) /* Centered vertical anchor */, new Vector2(1.0f, 0.4f),
                                            _holder);
            _button.SetOnMouseOut(OnMouseOut);
            _button.SetOnMouseOver(OnMouseOver);

            //Configure ignoreClose
            _ignoreClose.gameObject.SetActive(false);
            _ignoreClose.transform.localPosition = new Vector3(_ignoreClose.transform.localPosition.x,
                                                               _ignoreClose.transform.localPosition.y, _ignoreClose.transform.localPosition.z - 1000f);

            var collider = _ignoreClose.gameObject.GetComponent <BoxCollider2D>();

            collider.size = new Vector2(Screen.width, Screen.height);
        }
Exemple #4
0
        private void Start(OptionsMenuBehaviour optionsMenu, GameObject parent)
        {
            //Get original components
            var joyStickButtonComponent = Utils.GetChildComponentByName <Component>(optionsMenu, "JoystickModeButton");
            var oBackgroundComponent    = Utils.GetChildComponentByName <Component>(joyStickButtonComponent, "Background");
            var oTextComponent          = Utils.GetChildComponentByName <TextRenderer>(joyStickButtonComponent, "Text");

            //Create component and add it to the parent
            holder = new GameObject(name);

            //Set button parent
            holder.transform.parent =
                parent == null ? joyStickButtonComponent.transform.parent.transform : parent.transform;

            //Configure holder and his components
            holder.layer = 5; //UI
            holder.transform.localScale = new Vector3(1f, 1f, 1f);
            //holder.transform.localPosition = new Vector3(holder.transform.localPosition.x, holder.transform.localPosition.y, holder.transform.localPosition.z - 100f);
            var collider = holder.gameObject.AddComponent <BoxCollider2D>();

            collider.size = size;

            //clone original sub components
            backgroundComponent = Object.Instantiate(oBackgroundComponent, holder.transform);
            textComponent       = Object.Instantiate(oTextComponent, holder.transform);

            //Configure background size
            var renderer = backgroundComponent.gameObject.GetComponent <SpriteRenderer>();

            renderer.size = size;

            //Add PassiveButton component
            button = holder.gameObject.AddComponent <PassiveButton>();
            button.OnClick.AddListener(action);
            button.OnMouseOut = new UnityEvent();
            button.OnMouseOut.AddListener((UnityAction)OnOut);
            button.OnMouseOver = new UnityEvent();
            button.OnMouseOver.AddListener((UnityAction)OnOver);

            //Enable the button
            OnOut();
            holder.gameObject.SetActive(true);
            textComponent.Text             = text;
            holder.transform.localPosition = new Vector3(pos.x, pos.y);
        }
Exemple #5
0
            public static void Postfix(TextRendererClass __instance)
            {
                if (__instance.Text == "Crewmate" && CrewmateText != string.Empty)
                {
                    __instance.Text = CrewmateText;
                    CrewmateText    = string.Empty;
                }

                if (__instance.Text == "Impostor" && ImpostorText != string.Empty)
                {
                    __instance.Text = ImpostorText;
                    ImpostorText    = string.Empty;
                }

                if (__instance.Text.Contains("[] among us") && DescriptionTextBefore != string.Empty)
                {
                    __instance.Text       = DescriptionTextBefore + __instance.Text;
                    DescriptionTextBefore = string.Empty;
                }

                if (__instance.Text.Contains("[] among us") && DescriptionTextAfter != string.Empty)
                {
                    __instance.Text     += DescriptionTextAfter;
                    DescriptionTextAfter = string.Empty;
                }

                if (__instance.Text.Contains("Victory") && VictoryText != string.Empty)
                {
                    __instance.Text = VictoryText;
                    VictoryText     = string.Empty;
                }

                if (__instance.Text.Contains("Defeat") && DefeatText != string.Empty)
                {
                    __instance.Text = DefeatText;
                    DefeatText      = string.Empty;
                }

                if (__instance.Text.Contains("[] among us") && DescriptionText != string.Empty)
                {
                    __instance.Text = DescriptionText;
                    DescriptionText = string.Empty;
                }
            }
Exemple #6
0
        public static void Postfix(BOCOFLHKCOJ __instance)
        {
            TextRenderer text = __instance.text;

            text.Text += $"\n[3EE605ff]Chameleon Mod[ffffffff] loaded - v[1C26E6ff]{ChameleonMod.version}[ffffffff] by [E66100ff]Wunax";
        }
Exemple #7
0
        public static void Postfix(VersionShower __instance)
        {
            AELDHKGBIFD text = __instance.text;

            text.Text += " + [704FA8FF]Mayor[] Mod by Tomozbot";
        }
        public static void Postfix(VersionShower __instance)
        {
            AELDHKGBIFD text = __instance.text;

            text.Text += "\nDictator Role 1.0.1 by DillyzThe1";
        }
        public static void Postfix(VersionShower __instance)
        {
            AELDHKGBIFD text = __instance.text;

            text.Text += " + [0054C9FF]Sweeper[] Mod by Tomozbot";
        }
Exemple #10
0
        public static void Postfix(VersionShower __instance)
        {
            AELDHKGBIFD text = __instance.text;

            text.Text += " + [FF5F20FF]Torch[] Mod by Tomozbot";
        }