#Enum options with spaces
34 messages · Page 1 of 1 (latest)
I had an implementation with a custom TextMenu.Slider and a CreateEntry method but I noticed that kept raising an error when the settings attempted to save so I probably butchered that
Also I found that the Collab Helper mod uses a simple enum setting and yet it contains spaces because of the dialog files, though I couldn't find in what way the dialog files were used or related to the settings code 
Sadly, nope
here's the code i found in the collabhelper...
public enum BestTimeInJournal { SpeedBerry, ChapterTimer };
public BestTimeInJournal BestTimeToDisplayInJournal { get; set; } = BestTimeInJournal.SpeedBerry;
collab utils dialog file has modoptions_collab_besttimetodisplayinjournal_speedberry= Speed Berry
yeah I found that
i just dont understand how it works
like how it's related to the actual settings code
If it's based on the specific naming, I'm confused about where the collab after modoptions comes from..
ok no idea how collabutils does it, but try putting [SettingName("the name you want")] before the setting
i'm looking to change the options on the right though, not the setting's name
oh right
I think it's supposed to be your mod name, but I don't remember how it's determined 
possibly it just strips Settings from the end of the settings class name
string typeName = type.Name.ToLowerInvariant();
if (typeName.EndsWith("settings"))
typeName = typeName.Substring(0, typeName.Length - 8);
string nameDefaultPrefix = $"modoptions_{typeName}_";
how does that work if multiple mods give their settings the same class name? 
they'd all use the same dialog key 
ooh could be
the reason i didnt know where it came from was that
i couldnt find it to be a technical name for the mod anywhere in the code
I had a guess it was that but I thought "that would cause conflicts super easily, it can't be that"
guess I was wrong
nice that worked thanks xD
yeah it felt a bit too arbitrary to be true
maybe it could be a bit more documented.... :PP
wdym it's always been right here
https://github.com/EverestAPI/Resources/wiki/Mod-Settings#Enum
(if the phrasing is unclear lmk, I'm not great at writing documentation)
I think most of that should be moved to the top of the file to be generalized for all properties, along with a link to SettingName
does this apply to other properties?
this is specifically caused by the return $"{enumNamePrefix}{enumName.ToLowerInvariant()}".DialogCleanOrNull() ??$"modoptions_{propType.Name.ToLowerInvariant()}_{enumName.ToLowerInvariant()}".DialogCleanOrNull() ?? enumName; part of the if (propType.IsEnum) section
and it seems completely independent from SettingName, since it uses propType.Name.ToLowerInvariant() to determine the name of its associated setting