Jump to content

CustomParameterNode sorting & gouping


Recommended Posts

So I've been looking at utilizing the CustomParameterNode to get the configurations incorporated directly into KSP. However, I cannot figure out how to sort the elements in the settings menu. I thought that the sorting of the elements in the class would be inherited to the menu... Seems I was wrong. But I haven't been able to localize a sorting parameter for the elements.

I have the following elements

  • String heading for event settings
  • Bool for activation of events
  • integer for how often the check for the event
  • integer for how fast to repeat the check just after it has been last found true
  • String heading for debugging section
  • Bool for activation of debugging messages in the log
  • custom enum for level of debugging messages.

Now when I run the game to sorting is different, like

  • String heading for event settings
  • Bool for activation of debugging messages in the log
  • Bool for activation of events
  • integer for how often the check for the event
  • integer for how fast to repeat the check just after it has been last found true
  • String heading for debugging section
  • custom enum for level of debugging messages.

And this does not make any sense to me, so I want them sorted.

Spoiler

//using GTI.Config;
using static GTI.Config.GTIConfig;
using UnityEngine;

namespace GTI.Config
{
    public class GTISettings : GameParameters.CustomParameterNode
    {
        #region CustomParameterNode
        public override GameParameters.GameMode GameMode { get { return GameParameters.GameMode.ANY; } }

        public override bool HasPresets { get { return false; } }

        public override string Section { get { return "GTIndustries"; } }

        public override int SectionOrder { get { return 1; } }

        public override string Title { get { return "Settings"; } }
        #endregion

        #region Events
        [GameParameters.CustomStringParameterUI("Events", autoPersistance = true, title = "Event", toolTip = "change GTI custom event settings")]
        public string stringEvents = "";

        [GameParameters.CustomParameterUI("Activate Events", toolTip = "Activate GTI custom events.", autoPersistance = true)]
        public bool initEvent { get; set; } = true;

        [GameParameters.CustomIntParameterUI("Check Frequence Idle", toolTip = "Set interval in ms in which the event is checked for when idle.", minValue = 50 , maxValue = 1250, stepSize = 50, autoPersistance = true)]
        public int EventCheckFreqIdle = 250;

        [GameParameters.CustomIntParameterUI("Check Frequence Active", toolTip = "Set interval in ms in which the event is checked for when it has just fired.", minValue = 1, maxValue = 500, stepSize = 10, autoPersistance = true)]
        public int EventCheckFreqActive = 90;
        #endregion

        #region Debugging
        [GameParameters.CustomStringParameterUI("DEBUG", autoPersistance = true, title = "Debug Settings", toolTip = "change debugging settings")]
        public string stringDebug = "";

        [GameParameters.CustomParameterUI("Activate Debugging", toolTip = "If enabled, debugging logs will be generated.", autoPersistance = true)]
        public bool DebugActive { get; set; } = true;

        [GameParameters.CustomParameterUI("Debug Level", toolTip = "Set level of debugging messages in the log file.", autoPersistance = true)]
        public iDebugLevel DebugLevel = iDebugLevel.DebugInfo;
        #endregion

        public override void OnLoad(ConfigNode node)
        {
            GTIDebug.Log("GTISettings --> OnLoad() --> GameParameters.CustomParameterNode", iDebugLevel.None);
            Debug.Log("[GTI] DebugActive: " + DebugActive);
            Debug.Log("[GTI] GTIConfig.DebugActive: " + GTIConfig.DebugActive);
            Debug.Log("[GTI] DebugLevel: " + DebugLevel);
            Debug.Log("[GTI] GTIConfig.DebugLevel: " + GTIConfig.DebugLevel);

            //Apply settings the GTIconfig class
            if (!GTIConfig.SetDebugActive(DebugActive)) GTIDebug.LogError("Loading of DebugActive Failed");
            if (!GTIConfig.SetDebugLevel(DebugLevel)) GTIDebug.LogError("Loading of DebugLevel Failed");
        }
    }
}

Does anyone have a suggestion on how to proceed??

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...