Skip to content

Commit

Permalink
Show new dead bodies option
Browse files Browse the repository at this point in the history
  • Loading branch information
dabao40 committed Dec 15, 2024
1 parent 1d2f483 commit 667bb79
Show file tree
Hide file tree
Showing 17 changed files with 341 additions and 55 deletions.
Binary file modified Strings.xlsx
Binary file not shown.
4 changes: 2 additions & 2 deletions TheOtherRoles/CustomGameModes/FreePlayGM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void SetWidget(int tab)
FortuneTeller.meetingFlag = false;
}
RPCProcedure.resetAchievement();
roleScreen.CloseScreen();
roleScreen?.CloseScreen();
})), 4);
}
else if (tab == 1)
Expand All @@ -110,7 +110,7 @@ void SetWidget(int tab)
})), 4)}
);
}
roleScreen.SetContext(gui.VerticalHolder(GUIAlignment.Center, new List<GUIContext>() { holder, TORGUIContextEngine.API.VerticalMargin(0.15f), gui.ScrollView(GUIAlignment.Center, new(7.4f, 3.5f), null, inner, out _) }), out _);
roleScreen?.SetContext(gui.VerticalHolder(GUIAlignment.Center, new List<GUIContext>() { holder, TORGUIContextEngine.API.VerticalMargin(0.15f), gui.ScrollView(GUIAlignment.Center, new(7.4f, 3.5f), null, inner, out _) }), out _);
}

SetWidget(0);
Expand Down
14 changes: 10 additions & 4 deletions TheOtherRoles/CustomOptionHolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ public class CustomOptionHolder {
public static CustomOption evilHackerSpawnRate;
public static CustomOption evilHackerCanHasBetterAdmin;
public static CustomOption evilHackerCanCreateMadmate;
public static CustomOption evilHackerCanSeeDoorStatus;
public static CustomOption evilHackerCanCreateMadmateFromJackal;
public static CustomOption evilHackerCanInheritAbility;
public static CustomOption createdMadmateCanDieToSheriff;
Expand Down Expand Up @@ -554,6 +555,7 @@ public class CustomOptionHolder {
public static CustomOption fungleElectrical;
public static CustomOption miraVitals;
public static CustomOption randomGameStartPosition;
public static CustomOption noticeNewDeadBodies;
public static CustomOption activateProps;
public static CustomOption numAccelTraps;
public static CustomOption accelerationDuration;
Expand Down Expand Up @@ -740,8 +742,9 @@ public static void Load() {

evilHackerSpawnRate = CustomOption.Create(8001, Types.Impostor, cs(EvilHacker.color, "evilHacker"), rates, null, true);
evilHackerCanHasBetterAdmin = CustomOption.Create(8002, Types.Impostor, "evilHackerCanHasBetterAdmin", false, evilHackerSpawnRate);
evilHackerCanSeeDoorStatus = CustomOption.Create(8015, Types.Impostor, "evilHackerCanSeeDoorStatus", true, evilHackerSpawnRate);
evilHackerCanCreateMadmate = CustomOption.Create(8000, Types.Impostor, "evilHackerCanCreateMadmate", true, evilHackerSpawnRate);
evilHackerCanCreateMadmateFromJackal = CustomOption.Create(8005, Types.Impostor, "evilHackerCanCreateMadmateFromJackal", true, evilHackerCanCreateMadmate);
evilHackerCanCreateMadmateFromJackal = CustomOption.Create(8013, Types.Impostor, "evilHackerCanCreateMadmateFromJackal", true, evilHackerCanCreateMadmate);
createdMadmateCanDieToSheriff = CustomOption.Create(8004, Types.Impostor, "createdMadmateCanDieToSheriff", true, evilHackerCanCreateMadmate);
createdMadmateCanEnterVents = CustomOption.Create(8005, Types.Impostor, "createdMadmateCanEnterVents", true, evilHackerCanCreateMadmate);
createdMadmateCanFixComm = CustomOption.Create(8006, Types.Impostor, "createdMadmateCanFixComm", false, evilHackerCanCreateMadmate);
Expand All @@ -759,7 +762,7 @@ public static void Load() {
trapperTrapRange = CustomOption.Create(8021, Types.Impostor, "trapperTrapRange", 1f, 0.5f, 5f, 0.1f, trapperSpawnRate, false, "unitMeters");
trapperMaxDistance = CustomOption.Create(8022, Types.Impostor, "trapperMaxDistance", 10f, 1f, 50f, 1f, trapperSpawnRate, false, "unitMeters");
trapperPenaltyTime = CustomOption.Create(8023, Types.Impostor, "trapperPenaltyTime", 10f, 0f, 50f, 1f, trapperSpawnRate, false, "unitSeconds");
trapperBonusTime = CustomOption.Create(8024, Types.Impostor, "trapperBonusTime", 8f, 0f, 9f, 1f, trapperSpawnRate, false, "unitSeconds");
trapperBonusTime = CustomOption.Create(8024, Types.Impostor, "trapperBonusTime", 10f, 0f, 50f, 1f, trapperSpawnRate, false, "unitSeconds");

mimicSpawnRate = CustomOption.Create(5000, Types.Impostor, cs(MimicK.color, "mimic"), rates, null, true);
mimicCountAsOne = CustomOption.Create(5001, Types.Impostor, "mimicCountAsOne", true, mimicSpawnRate);
Expand Down Expand Up @@ -1213,8 +1216,6 @@ public static void Load() {
allowParallelMedBayScans = CustomOption.Create(7, Types.General, "allowParallelMedBayScans", false);
shieldFirstKill = CustomOption.Create(8, Types.General, "shieldFirstKill", false);
finishTasksBeforeHauntingOrZoomingOut = CustomOption.Create(9, Types.General, "finishTasksBeforeHauntingOrZoomingOut", true);
camsNightVision = CustomOption.Create(11, Types.General, "camsNightVision", false, null, true, heading: "headingNightVision");
camsNoNightVisionIfImpVision = CustomOption.Create(12, Types.General, "camsNoNightVisionIfImpVision", false, camsNightVision, false);
additionalVents = CustomOption.Create(5060, Types.General, "additionalVents", false);
specimenVital = CustomOption.Create(5061, Types.General, "specimenVital", false);
miraVitals = CustomOption.Create(6075, Types.General, "miraVitals", false);
Expand All @@ -1223,6 +1224,11 @@ public static void Load() {
airshipAdditionalSpawn = CustomOption.Create(6073, Types.General, "airshipAdditionalSpawn", false);
fungleElectrical = CustomOption.Create(6074, Types.General, "fungleElectrical", false);
randomGameStartPosition = CustomOption.Create(6071, Types.General, "randomGameStartPosition", false);
noticeNewDeadBodies = CustomOption.Create(6098, Types.General, "noticeNewDeadBodies", true);

camsNightVision = CustomOption.Create(11, Types.General, "camsNightVision", false, null, true, heading: "headingNightVision");
camsNoNightVisionIfImpVision = CustomOption.Create(12, Types.General, "camsNoNightVisionIfImpVision", false, camsNightVision, false);

activateProps = CustomOption.Create(6083, Types.General, "activateProps", false, null, true, heading: "headingPropSetting");
numAccelTraps = CustomOption.Create(6084, Types.General, "numAccelTraps", 1f, 0f, 5f, 1f, activateProps, false, "unitScrews");
accelerationDuration = CustomOption.Create(6085, Types.General, "accelerationDuration", 5f, 1f, 20f, 1f, activateProps, false, "unitSeconds");
Expand Down
4 changes: 3 additions & 1 deletion TheOtherRoles/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public class TheOtherRolesPlugin : BasePlugin
public static ConfigEntry<string> ShowPopUpVersion { get; set; }
public static ConfigEntry<bool> ToggleCursor { get; set; }
public static ConfigEntry<bool> ShowChatNotifications { get; set; }
public static ConfigEntry<bool> ShowVentsOnMap { get; set; }

public static Sprite ModStamp;

Expand Down Expand Up @@ -113,7 +114,8 @@ public override void Load() {
EnableSoundEffects = Config.Bind("Custom", "Enable Sound Effects", true);
EnableHorseMode = Config.Bind("Custom", "Enable Horse Mode", false);
ShowPopUpVersion = Config.Bind("Custom", "Show PopUp", "0");
ShowChatNotifications = Config.Bind("Custom", "Show Chat Notifications", true);
ShowChatNotifications = Config.Bind("Custom", "Show Chat Notifications", true);
ShowVentsOnMap = Config.Bind("Custom", "Show Vent Positions On Minimap", false);

Ip = Config.Bind("Custom", "Custom Server IP", "127.0.0.1");
Port = Config.Bind("Custom", "Custom Server Port", (ushort)22023);
Expand Down
2 changes: 2 additions & 0 deletions TheOtherRoles/MapOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ static class TORMapOptions {
public static bool enableHorseMode = false;
public static bool shieldFirstKill = false;
public static bool ShowChatNotifications = true;
public static bool ShowVentsOnMap = true;
public static CustomGamemodes gameMode = CustomGamemodes.Classic;

// Updating values
Expand Down Expand Up @@ -56,6 +57,7 @@ public static void reloadPluginOptions() {
enableSoundEffects = TheOtherRolesPlugin.EnableSoundEffects.Value;
enableHorseMode = TheOtherRolesPlugin.EnableHorseMode.Value;
ShowChatNotifications = TheOtherRolesPlugin.ShowChatNotifications.Value;
ShowVentsOnMap = TheOtherRolesPlugin.ShowVentsOnMap.Value;
//Patches.ShouldAlwaysHorseAround.isHorseMode = TheOtherRolesPlugin.EnableHorseMode.Value;
}

Expand Down
64 changes: 60 additions & 4 deletions TheOtherRoles/Patches/ClientOptionsPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using UnityEngine.Events;
using static UnityEngine.UI.Button;
using Object = UnityEngine.Object;
using System.Linq;

namespace TheOtherRoles.Patches
{
Expand All @@ -23,6 +24,7 @@ public static class ClientOptionsPatch
new SelectionBehaviour("toggleCursor", () => TORMapOptions.toggleCursor = TheOtherRolesPlugin.ToggleCursor.Value = !TheOtherRolesPlugin.ToggleCursor.Value, TheOtherRolesPlugin.ToggleCursor.Value),
new SelectionBehaviour("enableSoundEffects", () => TORMapOptions.enableSoundEffects = TheOtherRolesPlugin.EnableSoundEffects.Value = !TheOtherRolesPlugin.EnableSoundEffects.Value, TheOtherRolesPlugin.EnableSoundEffects.Value),
new("showChatNotification", () => TORMapOptions.ShowChatNotifications = TheOtherRolesPlugin.ShowChatNotifications.Value = !TheOtherRolesPlugin.ShowChatNotifications.Value, TheOtherRolesPlugin.ShowChatNotifications.Value),
new("showVentsOnMap", () => TORMapOptions.ShowVentsOnMap = TheOtherRolesPlugin.ShowVentsOnMap.Value = !TheOtherRolesPlugin.ShowVentsOnMap.Value, TheOtherRolesPlugin.ShowVentsOnMap.Value),
};

private static GameObject popUp;
Expand All @@ -31,6 +33,7 @@ public static class ClientOptionsPatch
private static ToggleButtonBehaviour moreOptions;
private static TextMeshPro titleTextTitle;
private static List<ToggleButtonBehaviour> modButtons = new();
private static int page = 1;

private static ToggleButtonBehaviour buttonPrefab;
private static Vector3? _origin;
Expand Down Expand Up @@ -156,17 +159,17 @@ private static void CheckSetTitle()

private static void SetUpOptions()
{
if (popUp.transform.GetComponentInChildren<ToggleButtonBehaviour>()) return;
//if (popUp.transform.GetComponentInChildren<ToggleButtonBehaviour>()) return;
foreach (var button in modButtons)
{
if (button != null) GameObject.Destroy(button.gameObject);
}

modButtons = new List<ToggleButtonBehaviour>();

for (var i = 0; i < AllOptions.Length; i++)
int length = (page * 10) < AllOptions.Length ? page * 10 : AllOptions.Length;
for (var i = 0; i + ((page - 1) * 10) < length; i++)
{
var info = AllOptions[i];
var info = AllOptions[i + ((page - 1) * 10)];

var button = Object.Instantiate(buttonPrefab, popUp.transform);
var pos = new Vector3(i % 2 == 0 ? -1.17f : 1.17f, 1.3f - i / 2 * 0.8f, -.5f);
Expand Down Expand Up @@ -213,6 +216,59 @@ private static void SetUpOptions()

modButtons.Add(button);
}

if (page * 10 < AllOptions.Length)
{
var button = Object.Instantiate(buttonPrefab, popUp.transform);
var pos = new Vector3(1.2f, -2.5f, -0.5f);
var transform = button.transform;
transform.localPosition = pos;
button.Text.text = ModTranslation.getString("next");
button.Text.fontSizeMin = button.Text.fontSizeMax = 2.2f;
button.Text.font = Object.Instantiate(titleText.font);
button.Text.GetComponent<RectTransform>().sizeDelta = new Vector2(2, 2);
button.gameObject.SetActive(true);
var passiveButton = button.GetComponent<PassiveButton>();
var colliderButton = button.GetComponent<BoxCollider2D>();
colliderButton.size = new Vector2(2.2f, .7f);
passiveButton.OnClick = new ButtonClickedEvent();
passiveButton.OnMouseOut = new UnityEvent();
passiveButton.OnMouseOver = new UnityEvent();
passiveButton.OnClick.AddListener((Action)(() =>
{
page += 1;
SetUpOptions();
}));
passiveButton.OnMouseOver.AddListener((Action)(() => button.Background.color = new Color32(34, 139, 34, byte.MaxValue)));
passiveButton.OnMouseOut.AddListener((Action)(() => button.Background.color = Color.white));
modButtons.Add(button);
}
if (page > 1)
{
var button = Object.Instantiate(buttonPrefab, popUp.transform);
var pos = new Vector3(-1.2f, -2.5f, -0.5f);
var transform = button.transform;
transform.localPosition = pos;
button.Text.text = ModTranslation.getString("previous");
button.Text.fontSizeMin = button.Text.fontSizeMax = 2.2f;
button.Text.font = Object.Instantiate(titleText.font);
button.Text.GetComponent<RectTransform>().sizeDelta = new Vector2(2, 2);
button.gameObject.SetActive(true);
var passiveButton = button.GetComponent<PassiveButton>();
var colliderButton = button.GetComponent<BoxCollider2D>();
colliderButton.size = new Vector2(2.2f, .7f);
passiveButton.OnClick = new ButtonClickedEvent();
passiveButton.OnMouseOut = new UnityEvent();
passiveButton.OnMouseOver = new UnityEvent();
passiveButton.OnClick.AddListener((Action)(() =>
{
page -= 1;
SetUpOptions();
}));
passiveButton.OnMouseOver.AddListener((Action)(() => button.Background.color = new Color32(34, 139, 34, byte.MaxValue)));
passiveButton.OnMouseOut.AddListener((Action)(() => button.Background.color = Color.white));
modButtons.Add(button);
}
}

private static IEnumerable<GameObject> GetAllChilds(this GameObject Go)
Expand Down
Loading

0 comments on commit 667bb79

Please sign in to comment.