Skip to content

Commit 04a3cc1

Browse files
committed
New Work !
1 parent a08c51b commit 04a3cc1

File tree

9 files changed

+2339
-912
lines changed

9 files changed

+2339
-912
lines changed

Strings.xlsx

19.4 KB
Binary file not shown.

TheOtherRoles/CustomOptionHolder.cs

Lines changed: 430 additions & 502 deletions
Large diffs are not rendered by default.

TheOtherRoles/Helpers.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,13 @@ public static void refreshRoleDescription(PlayerControl player)
226226

227227
internal static string getRoleString(RoleInfo roleInfo)
228228
{
229-
if (roleInfo.name == "Jackal")
229+
if (roleInfo.roleId == RoleId.Jackal)
230230
{
231231
var getSidekickText = Jackal.canCreateSidekick ? " and recruit a Sidekick" : "";
232232
return cs(roleInfo.color, $"{roleInfo.name}: Kill everyone{getSidekickText}");
233233
}
234234

235-
if (roleInfo.name == "Invert")
235+
if (roleInfo.roleId == RoleId.Invert)
236236
return cs(roleInfo.color, $"{roleInfo.name}: {roleInfo.shortDescription} ({Invert.meetings})");
237237

238238
return cs(roleInfo.color, $"{roleInfo.name}: {roleInfo.shortDescription}");

TheOtherRoles/Modules/CustomOptions.cs

Lines changed: 123 additions & 117 deletions
Large diffs are not rendered by default.

TheOtherRoles/Modules/RoleDraft.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,12 +317,10 @@ public static IEnumerator CoSelectRoles(IntroCutscene __instance)
317317
actionButton.SetCoolDown(0, 0);
318318
var textHolder = new GameObject("textHolder");
319319
var text = textHolder.AddComponent<TextMeshPro>();
320-
text.text = roleInfo.name.Replace(" ", "\n");
320+
text.text = "<b>" +roleInfo.name.Replace(" ", "\n") + "</b>";
321321
text.horizontalAlignment = HorizontalAlignmentOptions.Center;
322322
text.fontSize = 5;
323323
textHolder.layer = actionButton.gameObject.layer;
324-
text.outlineWidth = 0.1f;
325-
text.outlineColor = Color.white;
326324
text.color = roleInfo.color;
327325
textHolder.transform.SetParent(actionButton.transform, false);
328326
textHolder.transform.localPosition =
@@ -413,6 +411,12 @@ public static void receivePick(byte playerId, byte roleId)
413411
roleString = Helpers.cs(Palette.Blue, "Neutral Role");
414412
roleLength = "Neutral Role".Length;
415413
}
414+
else if (CustomOptionHolder.draftModeHideCrewRoles.getBool() && !roleInfo.isImpostor && !roleInfo.isNeutral &&
415+
!(playerId == PlayerControl.LocalPlayer.PlayerId))
416+
{
417+
roleString = Helpers.cs(Palette.Blue, "Crewmate Role");
418+
roleLength = "Crewmate Role".Length;
419+
}
416420

417421
var line = $"{(playerId == PlayerControl.LocalPlayer.PlayerId ? "You" : alreadyPicked.Count)}:";
418422
line = line + string.Concat(Enumerable.Repeat(" ", 6 - line.Length)) + roleString;
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
using HarmonyLib;
2+
using Reactor.Utilities.Extensions;
3+
using System;
4+
using TMPro;
5+
using UnityEngine;
6+
using Object = UnityEngine.Object;
7+
8+
namespace TheOtherRoles.Patches;
9+
10+
internal class CreateGameOptionsPatch
11+
{
12+
public static PassiveButton modeButtonGS;
13+
public static PassiveButton modeButtonHK;
14+
public static PassiveButton modeButtonPH;
15+
16+
[HarmonyPatch(typeof(CreateGameOptions), nameof(CreateGameOptions.Start))]
17+
public static class CreateGameOptionsStartPatch
18+
{
19+
private static void Postfix(CreateGameOptions __instance)
20+
{
21+
var blackSquare = GameObject.Find("BlackSquare");
22+
blackSquare.transform.localPosition = new Vector3(-2.35f, -4.04f, -1f);
23+
__instance.modeButtons[0].transform.localPosition = new Vector3(-0f, -4f, -3f);
24+
__instance.modeButtons[1].transform.localPosition = new Vector3(2.91f, -4f, -3f);
25+
__instance.serverDropdown.transform.SetLocalY(-2.63f);
26+
27+
__instance.modeButtons[0].OnClick.AddListener((Action)(() =>
28+
{
29+
modeButtonGS.SelectButton(false);
30+
modeButtonHK.SelectButton(false);
31+
modeButtonPH.SelectButton(false);
32+
}
33+
));
34+
35+
__instance.modeButtons[1].OnClick.AddListener((Action)(() =>
36+
{
37+
modeButtonGS.SelectButton(false);
38+
modeButtonHK.SelectButton(false);
39+
modeButtonPH.SelectButton(false);
40+
}
41+
));
42+
43+
TORMapOptions.gameMode = CustomGamemodes.Classic;
44+
45+
modeButtonGS = Object.Instantiate(__instance.modeButtons[0], __instance.modeButtons[0].transform);
46+
modeButtonGS.name = "TORGUESSER";
47+
changeButtonText(modeButtonGS, "TOR Guesser");
48+
modeButtonGS.transform.localPosition = new Vector3(5.8f, -0f, -3f);
49+
modeButtonGS.OnClick.RemoveAllListeners();
50+
__instance.StartCoroutine(Effects.Lerp(0.1f, new Action<float>(p => modeButtonGS.SelectButton(false))));
51+
modeButtonGS.OnMouseOver.AddListener((Action)(() => __instance.tooltip.SetText("An extension to the Classic-Gamemode and gives you a multitude of new options for Guessers.")));
52+
modeButtonGS.OnClick.AddListener((Action)(() =>
53+
{
54+
TORMapOptions.gameMode = CustomGamemodes.Guesser;
55+
modeButtonGS.SelectButton(true);
56+
__instance.modeButtons[0].SelectButton(false);
57+
__instance.modeButtons[1].SelectButton(false);
58+
modeButtonHK.SelectButton(false);
59+
modeButtonPH.SelectButton(false);
60+
}
61+
));
62+
63+
modeButtonHK = Object.Instantiate(modeButtonGS, __instance.modeButtons[0].transform);
64+
modeButtonHK.name = "TORHIDENSEEK";
65+
changeButtonText(modeButtonHK, "TOR Hide N Seek");
66+
modeButtonHK.transform.localPosition = new Vector3(0, -0.8f, -3f);
67+
modeButtonHK.OnClick.RemoveAllListeners();
68+
__instance.StartCoroutine(Effects.Lerp(0.1f, new Action<float>(p => modeButtonHK.SelectButton(false))));
69+
modeButtonHK.OnMouseOver.AddListener((Action)(() => __instance.tooltip.SetText("A standalone Gamemode where Hunter have to catch their prey (\"Hunted\" players).")));
70+
modeButtonHK.OnClick.AddListener((Action)(() =>
71+
{
72+
TORMapOptions.gameMode = CustomGamemodes.HideNSeek;
73+
modeButtonHK.SelectButton(true);
74+
__instance.modeButtons[0].SelectButton(false);
75+
__instance.modeButtons[1].SelectButton(false);
76+
modeButtonGS.SelectButton(false);
77+
modeButtonPH.SelectButton(false);
78+
}
79+
));
80+
81+
modeButtonPH = Object.Instantiate(modeButtonHK, __instance.modeButtons[0].transform);
82+
modeButtonPH.name = "TORPROPHUNT";
83+
changeButtonText(modeButtonPH, "TOR Prop Hunt");
84+
modeButtonPH.transform.localPosition = new Vector3(2.9f, -0.8f, -3f);
85+
modeButtonPH.OnClick.RemoveAllListeners();
86+
__instance.StartCoroutine(Effects.Lerp(0.1f, new Action<float>(p => modeButtonPH.SelectButton(false))));
87+
modeButtonPH.OnMouseOver.AddListener((Action)(() => __instance.tooltip.SetText("A standalone Gamemode where Hunters have to find the disguised players (\"Props\").")));
88+
modeButtonPH.OnClick.AddListener((Action)(() =>
89+
{
90+
TORMapOptions.gameMode = CustomGamemodes.PropHunt;
91+
modeButtonPH.SelectButton(true);
92+
__instance.modeButtons[0].SelectButton(false);
93+
__instance.modeButtons[1].SelectButton(false);
94+
modeButtonGS.SelectButton(false);
95+
modeButtonHK.SelectButton(false);
96+
}
97+
));
98+
}
99+
internal static void changeButtonText(PassiveButton passiveButton, string buttonText)
100+
{
101+
passiveButton.transform.FindChild("SelectedInactive/ClassicText").gameObject.GetComponentInChildren<TextTranslatorTMP>().Destroy();
102+
passiveButton.transform.FindChild("Inactive/ClassicText").gameObject.GetComponentInChildren<TextTranslatorTMP>().Destroy();
103+
passiveButton.transform.FindChild("Highlight/ClassicText").gameObject.GetComponentInChildren<TextTranslatorTMP>().Destroy();
104+
passiveButton.transform.FindChild("SelectedHighlight/ClassicText").gameObject.GetComponentInChildren<TextTranslatorTMP>().Destroy();
105+
106+
passiveButton.transform.FindChild("SelectedInactive/ClassicText").gameObject.GetComponentInChildren<TMP_Text>().SetText(buttonText);
107+
passiveButton.transform.FindChild("Inactive/ClassicText").gameObject.GetComponentInChildren<TMP_Text>().SetText(buttonText);
108+
passiveButton.transform.FindChild("Highlight/ClassicText").gameObject.GetComponentInChildren<TMP_Text>().SetText(buttonText);
109+
passiveButton.transform.FindChild("SelectedHighlight/ClassicText").gameObject.GetComponentInChildren<TMP_Text>().SetText(buttonText);
110+
}
111+
}
112+
}

TheOtherRoles/Patches/CreateOptionsPickerPatch.cs

Lines changed: 0 additions & 108 deletions
This file was deleted.

TheOtherRoles/Resources/Banner.png

67.5 KB
Loading

0 commit comments

Comments
 (0)