private void DrawButtonArrowRight(string VersionNumber) { GUIStyle coloredButtonStyle = GuiHelper.CompatibilityState(OverrideType.version, null, VersionNumber) ? buttonStyleGreen : buttonStyle; string buttonLabel = "\u25B6"; //unicode for a triangle, pointing to the right if (GUILayout.Button(buttonLabel, coloredButtonStyle, GUILayout.Width(25), GUILayout.Height(25))) { if (!GuiHelper.CompatibilityState(OverrideType.version, null, VersionNumber)) { GuiHelper.UpdateCompatibilityState(OverrideType.version, null, VersionNumber); } } }
//void InitEnabledCompatVersions() //{ // for (int i = 0; i < versions.Count(); i++) // { // string v = versions[i].Replace("*", "-1"); // CompatVersions cv; // if (Configuration.CompatibleVersions.TryGetValue(v, out cv)) // { // VersionInfo vi = new VersionInfo(Versioning.version_major, Versioning.version_minor, Versioning.Revision, 0); // if (cv.compatWithVersion.Contains(vi)) // { // enabledCompatVersions[i] = true; // } // } // } //} //void CheckCompatVersion(string version) //{ // Debug.Log("CheckCompatVersion, version: " + version); // for (int i = 0; i < versions.Count(); i++) // { // Debug.Log("versions[" + i + "]: " + versions[i]); // if (version == versions[i]) // enabledCompatVersions[i] = true; // } //} //void DrawStdCompatToggles() //{ // if (Configuration.OverrideIsDisabledGlobal) // return; // for (int i = 0; i < versions.Count(); i++) // { // Debug.Log("DrawStdCompatToggles, i:" + i); // GUILayout.BeginHorizontal(); // bool b = GUILayout.Toggle(enabledCompatVersions[i], versions[i]); // if (b != enabledCompatVersions[i]) // { // string v = versions[i].Replace("*", "-1"); // enabledCompatVersions[i] = b; // if (enabledCompatVersions[i]) // { // GuiHelper.UpdateCompatibilityState(OverrideType.version, null, v); // Logger.Log($"AVC Compatibility Override, Version input: " + v); // } // else // { // GuiHelper.UpdateCompatibilityState(OverrideType.version , null, v + "," + AddonInfo.ActualKspVersion.ToString(), true); // Logger.Log($"AVC Compatibility Override remove , Version input: " + v); // } // } // GUILayout.EndHorizontal(); // } //} private void DrawInputOverrideVersion() { GUILayout.BeginHorizontal(); GuiHelper.userInput = GUILayout.TextField(GuiHelper.userInput, GUILayout.Width(150.0f), GUILayout.Height(20)); if (GUILayout.Button("ADD", this.buttonStyle, GUILayout.Width(75), GUILayout.Height(20))) { Debug.Log("userInput: " + GuiHelper.userInput); //CheckCompatVersion(GuiHelper.userInput); GuiHelper.UpdateCompatibilityState(OverrideType.version, null, GuiHelper.userInput); Logger.Log($"AVC Compatibility Override, Version input: {GuiHelper.userInput}"); } 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); } } }
private void DrawButtonArrowRight(Addon addon) { if (GuiHelper.CompatibilityState(OverrideType.locked, addon) || GuiHelper.CompatibilityState(OverrideType.name, addon)) { GUILayout.Space(25); //fill the space which would usually taken by the button at this position return; } GUIStyle coloredButtonStyle = GuiHelper.CompatibilityState(OverrideType.version, addon) ? buttonStyleGreen : buttonStyle; string buttonLabel = "\u25B6"; //unicode for a triangle, pointing to the right if (GUILayout.Button(buttonLabel, coloredButtonStyle, GUILayout.Width(25), GUILayout.Height(25))) { if (!GuiHelper.CompatibilityState(OverrideType.version, addon)) { GuiHelper.UpdateCompatibilityState(OverrideType.version, null, addon.LocalInfo.KspVersionMaxIsNull && addon.LocalInfo.KspVersionMinIsNull ? addon.LocalInfo.KspVersion.ToString() : addon.LocalInfo.KspVersionMax.ToString()); } } }
private void DrawCompatibleByName() { if (Configuration.OverrideIsDisabledGlobal) { DrawDisabled(); return; } List <Addon> listCompatibleByName = AddonLibrary.Addons.Where(a => a.IsForcedCompatibleByName).OrderBy(a => a.Name).ToList(); int m = listCompatibleByName.Count(); for (int i = 0; i < m; i++) { var addon = listCompatibleByName[i]; GUILayout.BeginHorizontal(); GUILayout.Label(addon.Name, this.labelStyle, GUILayout.MinWidth(190.0f)); GUILayout.FlexibleSpace(); if (GUILayout.Button("X", this.buttonStyleRed, GUILayout.Width(25), GUILayout.Height(25))) { GuiHelper.UpdateCompatibilityState(OverrideType.name, addon); } GUILayout.EndHorizontal(); } }
//List of active version overrides private void DrawVersionList() { if (Configuration.OverrideIsDisabledGlobal) { DrawDisabled(); return; } var listKeys = Configuration.CompatibleVersions.Keys.ToList(); listKeys.Sort(); foreach (var key in listKeys) { for (int i = 0; i < Configuration.CompatibleVersions[key].compatibleWithVersion.Count; i++) { GUILayout.BeginHorizontal(); GUILayout.Label(Configuration.CompatibleVersions[key].currentVersion.Replace("-1", "*") + " \u279C " + Configuration.CompatibleVersions[key].compatibleWithVersion[i], this.labelStyle); GUILayout.FlexibleSpace(); if (GUILayout.Button("X", this.buttonStyleRed, GUILayout.Width(25), GUILayout.Height(25))) { GuiHelper.UpdateCompatibilityState(OverrideType.version, null, Configuration.CompatibleVersions[key].currentVersion + "," + Configuration.CompatibleVersions[key].compatibleWithVersion[i], true); //if (Configuration.CompatibleVersions[key].compatibleWithVersion[i] == AddonInfo.ActualKspVersion.ToString() ) //{ // for (int i1 = 0; i1 < versions.Count(); i1++) // { // if (versions[i1] == Configuration.CompatibleVersions[key].currentVersion.Replace("-1", "*")) // { // enabledCompatVersions[i1] = false; // } // } //} } GUILayout.EndHorizontal(); } } Configuration.DeleteFinally(); }
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(); } }