private void DrawIncompatibleMods()
        {
            if (Configuration.OverrideIsDisabledGlobal)
            {
                DrawDisabled();
                return;
            }
            List <Addon> listIncompatibleMods = AddonLibrary.Addons.Where(a => !a.IsCompatible).OrderBy(a => a.Name).ToList();
            int          m = listIncompatibleMods.Count();

            if (m == 0)
            {
                DrawNoIncompatibleAddons();
                return;
            }
            if (Configuration.ShowDefaultValues)
            {
                DrawDefaultValues();
            }
            for (int i = 0; i < m; i++)
            {
                Addon       addon         = listIncompatibleMods[i];
                GUIStyle    coloredLabel  = (GuiHelper.CompatibilityState(OverrideType.version, addon) || GuiHelper.CompatibilityState(OverrideType.name, addon)) ? this.labelStyleCyan : GuiHelper.CompatibilityState(OverrideType.ignore, addon) ? this.labelStyleIgnore : this.labelStyleYellow; //highlighting ignored mods
                VersionInfo versionNumber = addon.LocalInfo.KspVersionMaxIsNull && addon.LocalInfo.KspVersionMinIsNull ? addon.LocalInfo.KspVersion : addon.LocalInfo.KspVersionMax;

                GUILayout.BeginHorizontal();
                DrawButtonArrowLeft(addon);
                GUILayout.Space(18);
                GUILayout.Label(addon.Name, coloredLabel, GUILayout.MinWidth(230.0f));
                GUILayout.Space(10);
                GUILayout.Label($"{versionNumber}", coloredLabel, GUILayout.MinWidth(65));
                GUILayout.Space(18);
                DrawButtonArrowRight(addon);
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
            }
        }
        private void DrawButtonArrowLeft(Addon addon)
        {
            if (GuiHelper.CompatibilityState(OverrideType.locked, addon) || (GuiHelper.CompatibilityState(OverrideType.version, addon) && !GuiHelper.CompatibilityState(OverrideType.ignore, addon)))
            {
                GUILayout.Space(33); //fill the space which would usually taken by the button at this position
                return;
            }

            GUIStyle coloredButtonStyle = GuiHelper.CompatibilityState(OverrideType.name, addon) ? buttonStyleGreen : buttonStyle;
            string   buttonLabel        = "\u25C0"; //unicode for a triangle, pointing to the left

            if (GUILayout.Button(buttonLabel, coloredButtonStyle, GUILayout.Width(25), GUILayout.Height(25)))
            {
                if (!GuiHelper.CompatibilityState(OverrideType.name, addon))
                {
                    GuiHelper.UpdateCompatibilityState(OverrideType.name, addon);
                }
            }
        }
示例#3
0
        private void DrawIgnoreList()
        {
            List <Addon> overrideMods = AddonLibrary.Addons.Where(x => x.IsForcedCompatibleByVersion || GuiHelper.CompatibilityState(OverrideType.ignore, x)).OrderBy(x => x.Name).ToList();
            int          m            = overrideMods.Count;

            for (int i = 0; i < m; i++)
            {
                var      addon            = overrideMods[i];
                bool     toggleState      = GuiHelper.CompatibilityState(OverrideType.ignore, addon);
                GUIStyle labelStyleIgnore = GuiHelper.CompatibilityState(OverrideType.ignore, addon) ? this.labelStyleYellow : this.labelStyleCyan;

                GUILayout.BeginHorizontal();
                GUILayout.Label(addon.Name, labelStyleIgnore);
                GUILayout.FlexibleSpace();

                toggleState = GUILayout.Toggle(toggleState, "", this.toggleStyle);
                if (toggleState != GuiHelper.CompatibilityState(OverrideType.ignore, addon))
                {
                    GuiHelper.UpdateCompatibilityState(OverrideType.ignore, addon);
                }
                GUILayout.Space(25);
                GUILayout.EndHorizontal();
            }
        }