Example #1
0
        protected override void OnPrefabInit()
        {
            Transform buttonParent;
            KButton   resumeButton;

            base.OnPrefabInit();
            var mm = GetComponent <MainMenu>();

            if (Instance != null)
            {
                PUtil.LogWarning("Multiple instances of MainMenuWarning have been created!");
            }
            Instance = this;
            try {
                // "Resume game" is in the same panel as "Mods"
                if (mm != null && (resumeButton = RESUME_GAME.Get(mm)) != null &&
                    (buttonParent = resumeButton.gameObject.transform?.parent) != null)
                {
                    FindModsButton(buttonParent);
                }
            } catch (DetourException) { }
            UpdateText();
        }
Example #2
0
        protected override void OnPrefabInit()
        {
            Transform buttonParent;

            base.OnPrefabInit();
            if (Instance != null)
            {
                PUtil.LogWarning("Multiple instances of MainMenuWarning have been created!");
            }
            Instance = this;
            var resumeButton = GetComponent <MainMenu>()?.Button_ResumeGame;

            // "resume game" is in the same panel
            if (resumeButton != null && (buttonParent = resumeButton.gameObject.transform?.
                                                        parent) != null)
            {
                int n = buttonParent.childCount;
                for (int i = 0; i < n; i++)
                {
                    var button = buttonParent.GetChild(i).gameObject;
                    // Match by text... sucks but unlikely to have changed this early
                    if (button != null && button.GetComponentInChildren <LocText>()?.text ==
                        STRINGS.UI.FRONTEND.MODS.TITLE)
                    {
                        modsButton = button;
                        break;
                    }
                }
                if (modsButton == null)
                {
                    PUtil.LogWarning("Unable to find Mods menu button, main menu update " +
                                     "warning will not be functional");
                }
            }
            UpdateText();
        }
Example #3
0
 protected override void OnCleanUp()
 {
     Instance = null;
     base.OnCleanUp();
 }