Exemple #1
0
        /// <summary>
        /// Adds the save/restore lists buttons to the bottom of the Mods screen.
        /// </summary>
        /// <param name="instance">The object hosting the mods screen.</param>
        /// <param name="bottom">The panel where the buttons should be added.</param>
        internal static void AddExtraButtons(GameObject instance, GameObject bottom)
        {
            var handler = instance.AddOrGet <AllModsHandler>();
            var cb      = new PCheckBox("AllMods")
            {
                CheckSize = new Vector2(24.0f, 24.0f), Text = DebugNotIncludedStrings.
                                                              BUTTON_ALL, ToolTip = DebugNotIncludedStrings.TOOLTIP_ALL, Margin =
                    new RectOffset(5, 5, 0, 0)
            };

            // When clicked, enable/disable all
            if (handler != null)
            {
                cb.OnChecked = handler.OnClick;
            }
            handler.checkbox = cb.AddTo(bottom, 0);
            handler.UpdateCheckedState();
            // Current PLib version
            string version = PSharedData.GetData <string>("PLib.Version");
            string name    = ModDebugRegistry.Instance.OwnerOfAssembly(DebugNotIncludedPatches.
                                                                       RunningPLibAssembly)?.ModName ?? "Unknown";

            new PLabel("PLibVersion")
            {
                TextStyle = PUITuning.Fonts.UILightStyle, Text = string.Format(
                    DebugNotIncludedStrings.LABEL_PLIB, version ?? PVersion.VERSION), ToolTip =
                    string.Format(DebugNotIncludedStrings.TOOLTIP_PLIB, name),
                Margin = new RectOffset(5, 5, 0, 0)
            }.AddTo(bottom, 0);
        }
Exemple #2
0
        /// <summary>
        /// Adds the save/restore lists buttons to the bottom of the Mods screen.
        /// </summary>
        /// <param name="instance">The object hosting the mods screen.</param>
        /// <param name="bottom">The panel where the buttons should be added.</param>
        internal static void AddExtraButtons(GameObject instance, GameObject bottom)
        {
#if ALL_MODS_CHECKBOX
            var handler = instance.AddOrGet <AllModsHandler>();
            var cb      = new PCheckBox("AllMods")
            {
                CheckSize = new Vector2(24.0f, 24.0f), Text = UI.MODSSCREEN.BUTTON_ALL,
                ToolTip   = UI.TOOLTIPS.DNI_ALL, Margin = new RectOffset(5, 5, 0, 0)
            };
            // When clicked, enable/disable all
            if (handler != null)
            {
                cb.OnChecked = handler.OnClick;
            }
            handler.checkbox = cb.AddTo(bottom, 0);
            handler.UpdateCheckedState();
#endif
            // Current PLib version
            string version = PRegistry.Instance.GetLatestVersion(
                "PeterHan.PLib.Core.PLibCorePatches")?.Version?.ToString() ?? "Unknown";
            string name = ModDebugRegistry.Instance.OwnerOfAssembly(DebugNotIncludedPatches.
                                                                    RunningPLibAssembly)?.ModName ?? "Unknown";
            new PLabel("PLibVersion")
            {
                TextStyle = PUITuning.Fonts.UILightStyle, Text = string.Format(
                    UI.MODSSCREEN.LABEL_PLIB, version ?? PVersion.VERSION), ToolTip =
                    string.Format(UI.TOOLTIPS.DNI_PLIB, name), Margin = new RectOffset(5, 5, 0, 0)
            }.AddTo(bottom, 0);
        }