-
Notifications
You must be signed in to change notification settings - Fork 0
/
Setting.cs
94 lines (78 loc) · 2.92 KB
/
Setting.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
using Colossal;
using Colossal.IO.AssetDatabase;
using Game.Modding;
using Game.Settings;
using System.Collections.Generic;
using UnityEngine;
namespace RegionFlagIcons
{
[FileLocation($"ModsSettings/{nameof(RegionFlagIcons)}/{nameof(RegionFlagIcons)}")]
[SettingsUIGroupOrder(kButtonGroup)]
[SettingsUIShowGroupName(kButtonGroup)]
public class Setting : ModSetting
{
public enum FlagStyle_NA
{
USA,
Canada
}
public const string kSection = "Main";
public const string kButtonGroup = "Group";
public Setting(IMod mod) : base(mod)
{
}
[SettingsUISection(kSection, kButtonGroup)]
public FlagStyle_NA NorthAmericanFlagStyle
{ get; set; } = FlagStyle_NA.USA;
[SettingsUISection(kSection, kButtonGroup)]
public bool ApplyChanges
{
set
{
Mod.CheckFlagStyles();
Application.Quit();
}
}
public override void SetDefaults()
{
NorthAmericanFlagStyle = FlagStyle_NA.USA;
}
}
public class LocaleEN : IDictionarySource
{
private readonly Setting m_Setting;
public LocaleEN(Setting setting)
{
m_Setting = setting;
}
public IEnumerable<KeyValuePair<string, string>> ReadEntries(IList<IDictionaryEntryError> errors,
Dictionary<string, int> indexCounts)
{
return new Dictionary<string, string>
{
{ m_Setting.GetSettingsLocaleID(), "Region Flag Icons" },
{ m_Setting.GetOptionTabLocaleID(Setting.kSection), "Main" },
{ m_Setting.GetOptionGroupLocaleID(Setting.kButtonGroup), "Settings" },
{ m_Setting.GetOptionLabelLocaleID(nameof(Setting.NorthAmericanFlagStyle)), "North American Flag Style" },
{
m_Setting.GetOptionDescLocaleID(nameof(Setting.NorthAmericanFlagStyle)),
$"Change the icon used for north american flags"
},
{ m_Setting.GetEnumValueLocaleID(Setting.FlagStyle_NA.USA), "USA" },
{ m_Setting.GetEnumValueLocaleID(Setting.FlagStyle_NA.Canada), "Canada" },
{ m_Setting.GetOptionLabelLocaleID(nameof(Setting.ApplyChanges)), "Restart Game to Apply Changes" },
{
m_Setting.GetOptionDescLocaleID(nameof(Setting.ApplyChanges)),
$"Click to close the game. After a restart the changes will be applied. If you don't want to restart right now, the changes will take effect when the game is started next time."
},
{
m_Setting.GetOptionWarningLocaleID(nameof(Setting.ApplyChanges)),
"Game will be closed?"
},
};
}
public void Unload()
{
}
}
}