Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ Every player in your lobby need to install Reactor-Sheriff Mod. There are two wa

<details>
<summary><b>Changelog</b></summary>
<h3>v1.2.4-R</h3>
<ul>
<li>Updated the mod for Among Us v2021.4.12 (compatible with v2021.4.14)</li>
</ul>

<h3>v1.2.3-R</h3>
<ul>
<li>Updated the mod for Among Us v2021.3.31.3</li>
Expand Down
16 changes: 8 additions & 8 deletions ReactorSheriff/GameOptionsMenuPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static ToggleOption PrepareToggle(GameOptionsMenu instance, string title,
ToggleOption toggle = UnityEngine.Object.Instantiate(instance.GetComponentsInChildren<ToggleOption>().Last(),
instance.transform);
PositionElement(toggle);
toggle.TitleText.Text = title;
toggle.TitleText.text = title;
toggle.CheckMark.enabled = enabled;

return toggle;
Expand All @@ -44,9 +44,9 @@ public static NumberOption PrepareNumberOption(GameOptionsMenu instance, string

PositionElement(option);
option.gameObject.name = title;
option.TitleText.Text = title;
option.TitleText.text = title;
option.Value = value;
option.ValueText.Text = value.ToString();
option.ValueText.text = value.ToString();

return option;
}
Expand Down Expand Up @@ -84,7 +84,7 @@ public static class ToggleButtonPatch
[HarmonyPatch(nameof(ToggleOption.Toggle))]
public static bool Prefix(ToggleOption __instance)
{
if (__instance.TitleText.Text == GameOptionsMenuPatch.ShowSheriffOption.TitleText.Text)
if (__instance.TitleText.text == GameOptionsMenuPatch.ShowSheriffOption.TitleText.text)
{
CustomGameOptions.ShowSheriff = !CustomGameOptions.ShowSheriff;
PlayerControl.LocalPlayer.RpcSyncSettings(PlayerControl.GameOptions);
Expand All @@ -107,13 +107,13 @@ public static class NumberOptionPatch
[HarmonyPatch(nameof(NumberOption.Increase))]
public static bool Prefix1(NumberOption __instance)
{
if (__instance.TitleText.Text == GameOptionsMenuPatch.SheriffCooldown.TitleText.Text)
if (__instance.TitleText.text == GameOptionsMenuPatch.SheriffCooldown.TitleText.text)
{
CustomGameOptions.SheriffKillCD = Math.Min(CustomGameOptions.SheriffKillCD + 2.5f, 45);
PlayerControl.LocalPlayer.RpcSyncSettings(PlayerControl.GameOptions);
__instance.oldValue = CustomGameOptions.SheriffKillCD;
__instance.Value = CustomGameOptions.SheriffKillCD;
__instance.ValueText.Text = CustomGameOptions.SheriffKillCD.ToString();
__instance.ValueText.text = CustomGameOptions.SheriffKillCD.ToString();
return false;
}

Expand All @@ -124,14 +124,14 @@ public static bool Prefix1(NumberOption __instance)
[HarmonyPatch(nameof(NumberOption.Decrease))]
public static bool Prefix2(NumberOption __instance)
{
if (__instance.TitleText.Text == GameOptionsMenuPatch.SheriffCooldown.TitleText.Text)
if (__instance.TitleText.text == GameOptionsMenuPatch.SheriffCooldown.TitleText.text)
{
CustomGameOptions.SheriffKillCD = Math.Max(CustomGameOptions.SheriffKillCD - 2.5f, 10);

PlayerControl.LocalPlayer.RpcSyncSettings(PlayerControl.GameOptions);
__instance.oldValue = CustomGameOptions.SheriffKillCD;
__instance.Value = CustomGameOptions.SheriffKillCD;
__instance.ValueText.Text = CustomGameOptions.SheriffKillCD.ToString();
__instance.ValueText.text = CustomGameOptions.SheriffKillCD.ToString();

return false;
}
Expand Down
16 changes: 8 additions & 8 deletions ReactorSheriff/HudManagerPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ public static class HudManagerPatch

public static void UpdateGameSettingsText(HudManager __instance)
{
if (__instance.GameSettings.Text.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries).Count() == 19)
if (__instance.GameSettings.text.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries).Count() == 19)
{
GameSettingsText = __instance.GameSettings.Text;
GameSettingsText = __instance.GameSettings.text;
}

if (GameSettingsText != null)
{
if (CustomGameOptions.ShowSheriff)
__instance.GameSettings.Text = GameSettingsText + "Show Sheriff: On" + "\n";
__instance.GameSettings.text = GameSettingsText + "Show Sheriff: On" + "\n";
else
__instance.GameSettings.Text = GameSettingsText + "Show Sheriff: Off" + "\n";
__instance.GameSettings.text = GameSettingsText + "Show Sheriff: Off" + "\n";

__instance.GameSettings.Text += "Sheriff Kill Cooldown: " + CustomGameOptions.SheriffKillCD.ToString() + "s";
__instance.GameSettings.text += "Sheriff Kill Cooldown: " + CustomGameOptions.SheriffKillCD.ToString() + "s";
}

}
Expand All @@ -56,11 +56,11 @@ public static void updateMeetingHud(MeetingHud __instance)
{
foreach (PlayerVoteArea playerVoteArea in __instance.playerStates)
{
if (PlayerControlPatch.Sheriff != null && playerVoteArea.NameText.Text == PlayerControlPatch.Sheriff.name)
if (PlayerControlPatch.Sheriff != null && playerVoteArea.NameText.text == PlayerControlPatch.Sheriff.name)
{
if (CustomGameOptions.ShowSheriff | PlayerControlPatch.isSheriff(PlayerControl.LocalPlayer))
{
playerVoteArea.NameText.Color = new Color(1, (float)(204.0 / 255.0), 0, 1);
playerVoteArea.NameText.color = new Color(1, (float)(204.0 / 255.0), 0, 1);
}
}
}
Expand All @@ -84,7 +84,7 @@ public static void Postfix(HudManager __instance)
if (PlayerControlPatch.isSheriff(PlayerControl.LocalPlayer))
{

PlayerControl.LocalPlayer.nameText.Color = new Color(1, (float)(204.0 / 255.0), 0, 1);
PlayerControl.LocalPlayer.nameText.color = new Color(1, (float)(204.0 / 255.0), 0, 1);


if (PlayerControl.LocalPlayer.Data.IsDead || PlayerControlPatch.sheriffInTask || isMeetingHudActive)
Expand Down
6 changes: 3 additions & 3 deletions ReactorSheriff/IntroCutScenePatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ public static void Postfix(IntroCutscene._CoBegin_d__11 __instance)
{
if (PlayerControlPatch.isSheriff(PlayerControl.LocalPlayer))
{
__instance.__this.Title.Text = "Sheriff";
__instance.__this.Title.Color = new Color(1, (float)(204.0 / 255.0), 0, 1);
__instance.__this.ImpostorText.Text = "Shoot the [FF0000FF]Impostor";
__instance.__this.Title.text = "Sheriff";
__instance.__this.Title.color = new Color(1, (float)(204.0 / 255.0), 0, 1);
__instance.__this.ImpostorText.text = "Shoot the <color=#FF0000FF>Impostor</color>";
__instance.__this.BackgroundBar.material.color = new Color(1, (float)(204.0 / 255.0), 0, 1);

}
Expand Down
2 changes: 1 addition & 1 deletion ReactorSheriff/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public void Update()
{
if (isSheriff & (CustomGameOptions.ShowSheriff | this == PlayerController.getLocalPlayer()))
{
playerdata.nameText.Color = new Color(48 / 255.0f, 223 / 255.0f, 48 / 255.0f);
playerdata.nameText.color = new Color(48 / 255.0f, 223 / 255.0f, 48 / 255.0f);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions ReactorSheriff/PlayerControlPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static void Postfix([HarmonyArgument(0)] byte callId, [HarmonyArgument(1)
Sheriff = player;
if (CustomGameOptions.ShowSheriff)
{
player.nameText.Color = new Color(1, (float)(204.0 / 255.0), 0, 1);
player.nameText.color = new Color(1, (float)(204.0 / 255.0), 0, 1);
}
}
}
Expand Down Expand Up @@ -237,7 +237,7 @@ public static void Postfix([HarmonyArgument(0)] Il2CppReferenceArray<GameData.Pl

if (CustomGameOptions.ShowSheriff)
{
Sheriff.nameText.Color = new Color(1, (float)(204.0 / 255.0), 0, 1);
Sheriff.nameText.color = new Color(1, (float)(204.0 / 255.0), 0, 1);
}

byte SheriffId = Sheriff.PlayerId;
Expand Down
6 changes: 3 additions & 3 deletions ReactorSheriff/ReactorSheriff.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Version>1.2.3</Version>
<GameVersion>2021.3.31.3s</GameVersion>
<Mappings>NuclearPowered/Mappings:0.3.0</Mappings>
<Version>1.2.4</Version>
<GameVersion>2021.4.12s</GameVersion>
<Mappings>NuclearPowered/Mappings:0.4.0</Mappings>

<Description>Reimplementation of Woodi's Sheriff Mod in Reactor</Description>
<Authors>Brybry</Authors>
Expand Down
6 changes: 3 additions & 3 deletions ReactorSheriff/SheriffReactorMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ public override void Load()

ReactorVersionShower.TextUpdated += (text) =>
{
int index = text.Text.LastIndexOf('\n');
text.Text = text.Text.Insert(index == -1 ? text.Text.Length - 1 : index,
"\nLoaded [F7C600FF]Sheriff Mod v1.2.3-R[] by Brybry");
int index = text.text.LastIndexOf('\n');
text.text = text.text.Insert(index == -1 ? text.text.Length - 1 : index,
"\nLoaded <color=#F7C600FF>Sheriff Mod v1.2.4-R</color> by Brybry");
};

Harmony.PatchAll();
Expand Down