Skip to content

Commit

Permalink
just a little Update
Browse files Browse the repository at this point in the history
  • Loading branch information
XiezibanWrite committed Jul 14, 2023
1 parent 8c6eb15 commit 086e213
Show file tree
Hide file tree
Showing 13 changed files with 194 additions and 107 deletions.
40 changes: 22 additions & 18 deletions TownOfUsReworked.sln
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.6.33723.286
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TownOfUsReworked", "TownOfUsReworked\TownOfUsReworked.csproj", "{7B91EF68-B9BB-4138-9DEF-79C91FA554D6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7B91EF68-B9BB-4138-9DEF-79C91FA554D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7B91EF68-B9BB-4138-9DEF-79C91FA554D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7B91EF68-B9BB-4138-9DEF-79C91FA554D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7B91EF68-B9BB-4138-9DEF-79C91FA554D6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F2C2A857-F42E-4331-B220-4439B2FCA645}
EndGlobalSection
EndGlobal
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7B91EF68-B9BB-4138-9DEF-79C91FA554D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7B91EF68-B9BB-4138-9DEF-79C91FA554D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7B91EF68-B9BB-4138-9DEF-79C91FA554D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7B91EF68-B9BB-4138-9DEF-79C91FA554D6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F2C2A857-F42E-4331-B220-4439B2FCA645}
EndGlobalSection
EndGlobal
2 changes: 1 addition & 1 deletion TownOfUsReworked/CustomOptions/Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void Set(object value, object otherValue = null)
{
var newValue = (int)Value;
str.Selected = str.oldValue = newValue;
str.ValueText.text = ToString();
str.ValueText.text = GetString(ToString());
}
else if (Setting is RoleOptionSetting role)
{
Expand Down
14 changes: 5 additions & 9 deletions TownOfUsReworked/CustomOptions/GameSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,18 @@ public static string Settings()
if (option.Type == CustomOptionType.Button)
continue;

if (option.Type == CustomOptionType.Header)
builder.AppendLine($"\n");
else if (option.Type == CustomOptionType.Nested)
if (option is CustomNestedOption nested)
{
var nested = (CustomNestedOption)option;


foreach (var option2 in nested.InternalOptions)
{
if (option2.Type == CustomOptionType.Header)
builder.AppendLine($"\n{option2.Name}");
else if (option2.Type != CustomOptionType.Button)
builder.AppendLine($" {option2.Name}: {option2}");
if (option2.Type is not CustomOptionType.Button and not CustomOptionType.Nested)
builder.AppendLine($"{option2}");
}
}
else
builder.AppendLine($" : {option}");
builder.AppendLine($"{option}");
}

return $"<size=1.25>{builder}</size>";
Expand Down
67 changes: 33 additions & 34 deletions TownOfUsReworked/CustomOptions/Generate.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using static TownOfUsReworked.Languages.Language;
namespace TownOfUsReworked.CustomOptions
{
[HarmonyPatch]
Expand Down Expand Up @@ -1394,39 +1393,39 @@ public static void GenerateAll()
ExampleLayers.AddOptions(ExampleHeader, ExampleToggle, ExampleNumber, ExampleString);
ExampleNested.AddOptions(ExampleHeader, ExampleToggle, ExampleNumber, ExampleString, ExampleLayers);*/

GameSettings = new(MultiMenu.main, GetString("GameSettings"));
PlayerSpeed = new(num++, MultiMenu.main, "Player Speed", 1.25f, 0.25f, 10, 0.25f, MultiplierFormat);
GhostSpeed = new(num++, MultiMenu.main, "Ghost Speed", 3, 0.25f, 10, 0.25f, MultiplierFormat);
InteractionDistance = new(num++, MultiMenu.main, "Interaction Distance", 2, 0.5f, 5, 0.5f, DistanceFormat);
EmergencyButtonCount = new(num++, MultiMenu.main, "Emergency Button Count", 1, 0, 100, 1);
EmergencyButtonCooldown = new(num++, MultiMenu.main, "Emergency Button Cooldown", 25, 0, 300, 5, CooldownFormat);
DiscussionTime = new(num++, MultiMenu.main, "Discussion Time", 30, 0, 300, 5, CooldownFormat);
VotingTime = new(num++, MultiMenu.main, "Voting Time", 60, 5, 600, 15, CooldownFormat);
TaskBarMode = new(num++, MultiMenu.main, "Taskbar Updates", new[] { "Meeting Only", "Normal", "Invisible" });
ConfirmEjects = new(num++, MultiMenu.main, "Confirm Ejects", false);
EjectionRevealsRole = new(num++, MultiMenu.main, "Ejection Reveals <color=#FFD700FF>Roles</color>", false);
InitialCooldowns = new(num++, MultiMenu.main, "Game Start Cooldowns", 10, 0, 30, 2.5f, CooldownFormat);
ReportDistance = new(num++, MultiMenu.main, "Player Report Distance", 3.5f, 1, 20, 0.25f, DistanceFormat);
ChatCooldown = new(num++, MultiMenu.main, "Chat Cooldown", 3, 0, 3, 0.1f, CooldownFormat);
ChatCharacterLimit = new(num++, MultiMenu.main, "Chat Character Limit", 200, 50, 2000, 50);
LobbySize = new(num++, MultiMenu.main, "Lobby Size", 15, 3, 127, 1);

GameModeSettings = new(MultiMenu.main, "Game Mode Settings");
GameMode = new(num++, MultiMenu.main, "Game Mode", new[] { "Classic", "All Any", "Killing Only", "Custom", "Vanilla" });

KillingOnlySettings = new(MultiMenu.main, "<color=#1D7CF2FF>Killing</color> Only Settings");
NeutralRoles = new(num++, MultiMenu.main, "<color=#B3B3B3FF>Neutrals</color> Count", 1, 0, 13, 1);
AddArsonist = new(num++, MultiMenu.main, "Add <color=#EE7600FF>Arsonist</color>", false);
AddCryomaniac = new(num++, MultiMenu.main, "Add <color=#642DEAFF>Cryomaniac</color>", false);
AddPlaguebearer = new(num++, MultiMenu.main, "Add <color=#CFFE61FF>Plaguebearer</color>", false);

AllAnySettings = new(MultiMenu.main, "All Any Settings");
EnableUniques = new(num++, MultiMenu.main, "Enable Uniques", false);

GameModifiers = new(MultiMenu.main, "Game Modifiers");
WhoCanVent = new(num++, MultiMenu.main, "Serial Venters", new[] { "Default", "Everyone", "Never" });
AnonymousVoting = new(num++, MultiMenu.main, "Anonymous Voting", true);
SkipButtonDisable = new(num++, MultiMenu.main, "No Skipping", new[] { "Never", "Emergency", "Always" });
GameSettings = new(MultiMenu.main, "GameSettings");
PlayerSpeed = new(num++, MultiMenu.main, "PlayerSpeed", 1.25f, 0.25f, 10, 0.25f, MultiplierFormat);
GhostSpeed = new(num++, MultiMenu.main, "GhostSpeed", 3, 0.25f, 10, 0.25f, MultiplierFormat);
InteractionDistance = new(num++, MultiMenu.main, "InteractionDistance", 2, 0.5f, 5, 0.5f, DistanceFormat);
EmergencyButtonCount = new(num++, MultiMenu.main, "EmergencyButtonCount", 1, 0, 100, 1);
EmergencyButtonCooldown = new(num++, MultiMenu.main, "EmergencyButtonCooldown", 25, 0, 300, 5, CooldownFormat);
DiscussionTime = new(num++, MultiMenu.main, "DiscussionTime", 30, 0, 300, 5, CooldownFormat);
VotingTime = new(num++, MultiMenu.main, "VotingTime", 60, 5, 600, 15, CooldownFormat);
TaskBarMode = new(num++, MultiMenu.main, "TaskbarUpdates", new[] { "MeetingOnly", "Normal", "Invisible" });
ConfirmEjects = new(num++, MultiMenu.main, "ConfirmEjects", false);
EjectionRevealsRole = new(num++, MultiMenu.main, "EjectionRevealsRole", false);
InitialCooldowns = new(num++, MultiMenu.main, "GameStartCooldowns", 10, 0, 30, 2.5f, CooldownFormat);
ReportDistance = new(num++, MultiMenu.main, "ReportDistance", 3.5f, 1, 20, 0.25f, DistanceFormat);
ChatCooldown = new(num++, MultiMenu.main, "ChatCooldown", 3, 0, 3, 0.1f, CooldownFormat);
ChatCharacterLimit = new(num++, MultiMenu.main, "ChatCharacterLimit", 200, 50, 2000, 50);
LobbySize = new(num++, MultiMenu.main, "LobbySize", 15, 3, 127, 1);

GameModeSettings = new(MultiMenu.main, "GMoSettings");
GameMode = new(num++, MultiMenu.main, "GameMode", new[] { "Classic", "AllAny", "KillingOnly", "Custom", "Vanilla" });

KillingOnlySettings = new(MultiMenu.main, "KillingOnlySettings");
NeutralRoles = new(num++, MultiMenu.main, "NeutralRoles", 1, 0, 13, 1);
AddArsonist = new(num++, MultiMenu.main, "AddArsonist", false);
AddCryomaniac = new(num++, MultiMenu.main, "AddCryomaniac", false);
AddPlaguebearer = new(num++, MultiMenu.main, "AddPlaguebearer", false);

AllAnySettings = new(MultiMenu.main, "AllAnySettings");
EnableUniques = new(num++, MultiMenu.main, "EnableUniques", false);

GameModifiers = new(MultiMenu.main, "GameModifiers");
WhoCanVent = new(num++, MultiMenu.main, "Serial Venters", new[] {"Default", "Everyone", "Never" });
AnonymousVoting = new(num++, MultiMenu.main, "AnonymousVoting", true);
SkipButtonDisable = new(num++, MultiMenu.main, "NoSkipping", new[] { "Never", "Emergency", "Always" });
FactionSeeRoles = new(num++, MultiMenu.main, "Factioned Evils See The <color=#FFD700FF>Roles</color> Of Their Team", true);
VisualTasks = new(num++, MultiMenu.main, "Visual Tasks", false);
NoNames = new(num++, MultiMenu.main, "No Player Names", false);
Expand Down
3 changes: 2 additions & 1 deletion TownOfUsReworked/CustomOptions/Header.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using static TownOfUsReworked.Languages.Language;
namespace TownOfUsReworked.CustomOptions
{
public class CustomHeaderOption : CustomOption
Expand All @@ -7,7 +8,7 @@ public class CustomHeaderOption : CustomOption
public override void OptionCreated()
{
base.OptionCreated();
Setting.Cast<ToggleOption>().TitleText.text = Name;
Setting.Cast<ToggleOption>().TitleText.text = GetString(Name);
}
}
}
3 changes: 2 additions & 1 deletion TownOfUsReworked/CustomOptions/Layers.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using static TownOfUsReworked.Languages.Language;
namespace TownOfUsReworked.CustomOptions
{
public class CustomLayersOption : CustomOption
Expand All @@ -18,7 +19,7 @@ public override void OptionCreated()
{
base.OptionCreated();
var role = Setting.Cast<RoleOptionSetting>();
role.TitleText.text = Name;
role.TitleText.text = GetString(Name);
role.RoleMaxCount = 15;
role.ChanceText.text = "0%";
role.CountText.text = "0";
Expand Down
3 changes: 2 additions & 1 deletion TownOfUsReworked/CustomOptions/Number.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using static TownOfUsReworked.Languages.Language;
namespace TownOfUsReworked.CustomOptions
{
public class CustomNumberOption : CustomOption
Expand Down Expand Up @@ -43,7 +44,7 @@ public override void OptionCreated()
{
base.OptionCreated();
var number = Setting.Cast<NumberOption>();
number.TitleText.text = Name;
number.TitleText.text = GetString(Name);
number.ValidRange = new(Min, Max);
number.Increment = Increment;
number.Value = number.oldValue = Get();
Expand Down
5 changes: 3 additions & 2 deletions TownOfUsReworked/CustomOptions/String.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
using static TownOfUsReworked.Languages.Language;
namespace TownOfUsReworked.CustomOptions
{
public class CustomStringOption : CustomOption
{
public CustomStringOption(int id, MultiMenu menu, string name, string[] values) : base(id, menu, name, CustomOptionType.String, 0)
{
Values = values;
Format = (value, _) => Values[(int)value];
Format = (value, _) => GetString(Values[(int)value]);
}

public string[] Values;
Expand All @@ -32,7 +33,7 @@ public override void OptionCreated()
{
base.OptionCreated();
var str = Setting.Cast<KeyValueOption>();
str.TitleText.text = Name;
str.TitleText.text = GetString(Name);
str.Selected = str.oldValue = Get();
str.ValueText.text = ToString();
}
Expand Down
3 changes: 2 additions & 1 deletion TownOfUsReworked/CustomOptions/Toggle.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using static TownOfUsReworked.Languages.Language;
namespace TownOfUsReworked.CustomOptions
{
public class CustomToggleOption : CustomOption
Expand All @@ -12,7 +13,7 @@ public override void OptionCreated()
{
base.OptionCreated();
var toggle = Setting.Cast<ToggleOption>();
toggle.TitleText.text = Name;
toggle.TitleText.text = GetString(Name);
toggle.CheckMark.enabled = Get();
}
}
Expand Down
Loading

0 comments on commit 086e213

Please sign in to comment.