#Enum options with spaces

34 messages · Page 1 of 1 (latest)

cold frost
#

Looking to make this type of menu with options that contain spaces

#

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

cold frost
frosty pecan
#

it might Just Work™️ for camelcase?

#

or titlecase, whichever

cold frost
#

Sadly, nope

#

here's the code i found in the collabhelper...

public enum BestTimeInJournal { SpeedBerry, ChapterTimer };
public BestTimeInJournal BestTimeToDisplayInJournal { get; set; } = BestTimeInJournal.SpeedBerry;
wind iris
#

collab utils dialog file has modoptions_collab_besttimetodisplayinjournal_speedberry= Speed Berry

cold frost
#

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..

wind iris
#

ok no idea how collabutils does it, but try putting [SettingName("the name you want")] before the setting

cold frost
#

i'm looking to change the options on the right though, not the setting's name

wind iris
#

oh right

frosty pecan
#

I think it's supposed to be your mod name, but I don't remember how it's determined thinkeline

#

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}_";
wind iris
#

how does that work if multiple mods give their settings the same class name? maddyS

frosty pecan
#

they'd all use the same dialog key baddyhueh

cold frost
#

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

wind iris
#

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

cold frost
cold frost
#

maybe it could be a bit more documented.... :PP

wind iris
#

(if the phrasing is unclear lmk, I'm not great at writing documentation)

frosty pecan
#

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

wind iris
#

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