Skip to content
This repository has been archived by the owner on Oct 19, 2022. It is now read-only.

Commit

Permalink
Merge pull request #13 from LaicosVK/luemmel
Browse files Browse the repository at this point in the history
Cursor + TER
  • Loading branch information
LaicosVK authored Feb 22, 2022
2 parents e898614 + 6cc66fa commit c68d25d
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 22 deletions.
15 changes: 15 additions & 0 deletions TheOtherRoles/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@ public enum MurderAttemptResult {
}
public static class Helpers {

public static void enableCursor(bool initalSetCursor) {
if (initalSetCursor) {
Sprite sprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.Cursor.png", 115f);
Cursor.SetCursor(sprite.texture, Vector2.zero, CursorMode.Auto);
return;
}
if (TheOtherRolesPlugin.ToggleCursor.Value) {
Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
}
else {
Sprite sprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.Cursor.png", 115f);
Cursor.SetCursor(sprite.texture, Vector2.zero, CursorMode.Auto);
}
}

public static Sprite loadSpriteFromResources(string path, float pixelsPerUnit) {
try {
Texture2D texture = loadTextureFromResources(path);
Expand Down
9 changes: 8 additions & 1 deletion TheOtherRoles/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ public class TheOtherRolesPlugin : BasePlugin
{
public const string Id = "me.eisbison.theotherroles";

public const string VersionString = "3.4.3";
public const string VersionString = "3.4.3.1";

public static System.Version Version = System.Version.Parse(VersionString);

internal static BepInEx.Logging.ManualLogSource Logger;

public Harmony Harmony { get; } = new Harmony(Id);
Expand All @@ -39,6 +40,7 @@ public class TheOtherRolesPlugin : BasePlugin
public static ConfigEntry<bool> GhostsSeeVotes{ get; set; }
public static ConfigEntry<bool> ShowRoleSummary { get; set; }
public static ConfigEntry<bool> ShowLighterDarker { get; set; }
public static ConfigEntry<bool> ToggleCursor { get; set; }
public static ConfigEntry<string> StreamerModeReplacementText { get; set; }
public static ConfigEntry<string> StreamerModeReplacementColor { get; set; }
public static ConfigEntry<string> Ip { get; set; }
Expand Down Expand Up @@ -67,6 +69,7 @@ public override void Load() {
GhostsSeeVotes = Config.Bind("Custom", "Ghosts See Votes", true);
ShowRoleSummary = Config.Bind("Custom", "Show Role Summary", true);
ShowLighterDarker = Config.Bind("Custom", "Show Lighter / Darker", true);
ToggleCursor = Config.Bind("Custom", "Better Cursor", true);
ShowPopUpVersion = Config.Bind("Custom", "Show PopUp", "0");
StreamerModeReplacementText = Config.Bind("Custom", "Streamer Mode Replacement Text", "\n\nThe Other Roles");
StreamerModeReplacementColor = Config.Bind("Custom", "Streamer Mode Replacement Text Hex Color", "#87AAF5FF");
Expand All @@ -87,6 +90,10 @@ public override void Load() {
CustomColors.Load();

Harmony.PatchAll();

if (ToggleCursor.Value) {
Helpers.enableCursor(true);
}
}
public static Sprite GetModStamp() {
if (ModStamp) return ModStamp;
Expand Down
2 changes: 2 additions & 0 deletions TheOtherRoles/MapOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ static class MapOptions {
public static bool showRoleSummary = true;
public static bool allowParallelMedBayScans = false;
public static bool showLighterDarker = true;
public static bool toggleCursor = true;

// Updating values
public static int meetingsCount = 0;
Expand All @@ -40,6 +41,7 @@ public static void clearAndReloadMapOptions() {
ghostsSeeVotes = TheOtherRolesPlugin.GhostsSeeVotes.Value;
showRoleSummary = TheOtherRolesPlugin.ShowRoleSummary.Value;
showLighterDarker = TheOtherRolesPlugin.ShowLighterDarker.Value;
toggleCursor = TheOtherRolesPlugin.ToggleCursor.Value;
}
}
}
13 changes: 5 additions & 8 deletions TheOtherRoles/Modules/ModUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private static void Prefix(MainMenuManager __instance) {

var text = button.transform.GetChild(0).GetComponent<TMPro.TMP_Text>();
__instance.StartCoroutine(Effects.Lerp(0.1f, new System.Action<float>((p) => {
text.SetText("Update\nThe Other Roles");
text.SetText("Update\nThe Epic Roles");
})));

TwitchManager man = DestroyableSingleton<TwitchManager>.Instance;
Expand Down Expand Up @@ -88,7 +88,7 @@ public static void LaunchUpdater() {
}

public static void ExecuteUpdate() {
string info = "Updating The Other Roles\nPlease wait...";
string info = "Updating The Epic Roles\nPlease wait...";
ModUpdater.InfoPopup.Show(info); // Show originally
if (updateTask == null) {
if (updateURI != null) {
Expand Down Expand Up @@ -117,7 +117,7 @@ public static async Task<bool> checkForUpdate() {
try {
HttpClient http = new HttpClient();
http.DefaultRequestHeaders.Add("User-Agent", "TheOtherRoles Updater");
var response = await http.GetAsync(new System.Uri("https://api.github.com/repos/Eisbison/TheOtherRoles/releases/latest"), HttpCompletionOption.ResponseContentRead);
var response = await http.GetAsync(new System.Uri("https://api.github.com/repos/LaicosVK/TheEpicRoles/releases/latest"), HttpCompletionOption.ResponseContentRead);
// var response = await http.GetAsync(new System.Uri("https://api.github.com/repos/EoF-1141/TheOtherRoles/releases/latest"), HttpCompletionOption.ResponseContentRead);
if (response.StatusCode != HttpStatusCode.OK || response.Content == null) {
System.Console.WriteLine("Server returned no data: " + response.StatusCode.ToString());
Expand All @@ -138,10 +138,7 @@ public static async Task<bool> checkForUpdate() {
int diff = TheOtherRolesPlugin.Version.CompareTo(ver);
if (diff < 0) { // Update required
hasUpdate = true;
announcement = $@"<size=150%>A new <color=#FC0303>THE OTHER ROLES</color>
update to v{ver} is available</size>
{announcement}";
announcement = $@"<size=150%>A new <color=#FC0303>THE EPIC ROLES</color> update to v{ver} is available</size> {announcement}";

JToken assets = data["assets"];
if (!assets.HasValues)
Expand Down Expand Up @@ -191,7 +188,7 @@ public static async Task<bool> downloadUpdate() {
responseStream.CopyTo(fileStream);
}
}
showPopup("The Other Roles\nupdated successfully\nPlease restart the game.");
showPopup("The Epic Roles\nupdated successfully\nPlease restart the game.");
return true;
} catch (System.Exception ex) {
TheOtherRolesPlugin.Instance.Log.LogError(ex.ToString());
Expand Down
6 changes: 5 additions & 1 deletion TheOtherRoles/Patches/ClientOptionsPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public static class ClientOptionsPatch
new SelectionBehaviour("Ghosts Can See Roles", () => MapOptions.ghostsSeeRoles = TheOtherRolesPlugin.GhostsSeeRoles.Value = !TheOtherRolesPlugin.GhostsSeeRoles.Value, TheOtherRolesPlugin.GhostsSeeRoles.Value),
new SelectionBehaviour("Show Role Summary", () => MapOptions.showRoleSummary = TheOtherRolesPlugin.ShowRoleSummary.Value = !TheOtherRolesPlugin.ShowRoleSummary.Value, TheOtherRolesPlugin.ShowRoleSummary.Value),
new SelectionBehaviour("Show Lighter / Darker", () => MapOptions.showLighterDarker = TheOtherRolesPlugin.ShowLighterDarker.Value = !TheOtherRolesPlugin.ShowLighterDarker.Value, TheOtherRolesPlugin.ShowLighterDarker.Value),
new SelectionBehaviour("Better Cursor", () => MapOptions.toggleCursor = TheOtherRolesPlugin.ToggleCursor.Value = !TheOtherRolesPlugin.ToggleCursor.Value, TheOtherRolesPlugin.ToggleCursor.Value),
};

private static GameObject popUp;
Expand Down Expand Up @@ -148,7 +149,7 @@ private static void SetUpOptions()

var transform = button.transform;
transform.localPosition = pos;

button.onState = info.DefaultValue;
button.Background.color = button.onState ? Color.green : Palette.ImpostorRed;

Expand All @@ -171,6 +172,9 @@ private static void SetUpOptions()

passiveButton.OnClick.AddListener((Action) (() =>
{
if(info.Title == "Better Cursor") {
Helpers.enableCursor(false);
}
button.onState = info.OnClick();
button.Background.color = button.onState ? Color.green : Palette.ImpostorRed;
}));
Expand Down
16 changes: 6 additions & 10 deletions TheOtherRoles/Patches/CredentialsPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,11 @@
namespace TheOtherRoles.Patches {
[HarmonyPatch]
public static class CredentialsPatch {
public static string fullCredentials =
$@"<size=130%><color=#ff351f>TheOtherRoles</color></size> v{TheOtherRolesPlugin.Version.ToString()}
<size=60%>Modded by <color=#FCCE03FF>Eisbison</color>, <color=#FCCE03FF>EndOfFile</color>
<color=#FCCE03FF>Thunderstorm584</color> & <color=#FCCE03FF>Mallöris</color>
Button design by <color=#FCCE03FF>Bavari</color></size>";
public static string fullCredentials = $@"<size=130%><color=#ff351f>TheEpicRoles</color></size> v{TheOtherRolesPlugin.Version.ToString()} <size=60%>Remodded by <color=#D5342AFF>LaicosVK</color>, <color=#D5342AFF>Nova</color> & <color=#D5342AFF>DasMonschta</color></size>";

public static string mainMenuCredentials =
$@"Modded by <color=#FCCE03FF>Eisbison</color>, <color=#FCCE03FF>Thunderstorm584</color>, <color=#FCCE03FF>EndOfFile</color> & <color=#FCCE03FF>Mallöris</color>
Design by <color=#FCCE03FF>Bavari</color>";
public static string mainMenuCredentials = $@"Remodded by <color=#D5342AFF>LaicosVK</color>, <color=#D5342AFF>Nova</color> & <color=#D5342AFF>DasMonschta</color>";

public static string contributorsCredentials = "<size=60%>GitHub Contributors: Alex2911, amsyarasyiq, gendelo3, MaximeGillot</size>";
public static string torCredentials = $@"<size=60%><color=#FCCE03FF>Original Mod by github.com/Eisbison/TheOtherRoles</color></size>";

[HarmonyPatch(typeof(VersionShower), nameof(VersionShower.Start))]
private static class VersionShowerPatch
Expand All @@ -30,7 +24,7 @@ static void Postfix(VersionShower __instance) {

var credentials = UnityEngine.Object.Instantiate<TMPro.TextMeshPro>(__instance.text);
credentials.transform.position = new Vector3(0, 0, 0);
credentials.SetText($"v{TheOtherRolesPlugin.Version.ToString()}\n<size=30f%>\n</size>{mainMenuCredentials}\n<size=30%>\n</size>{contributorsCredentials}");
credentials.SetText($"v{TheOtherRolesPlugin.Version.ToString()}\n<size=30f%>\n</size>{mainMenuCredentials}\n<size=30%>\n</size>{torCredentials}");
credentials.alignment = TMPro.TextAlignmentOptions.Center;
credentials.fontSize *= 0.75f;

Expand Down Expand Up @@ -89,3 +83,5 @@ static void Postfix(PingTracker __instance) {
}
}
}


Binary file added TheOtherRoles/Resources/Cursor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions TheOtherRoles/TheOtherRoles.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Version>3.4.3</Version>
<Version>3.4.3.1</Version>
<Description>TheOtherRoles</Description>
<Authors>Eisbison</Authors>
</PropertyGroup>
Expand Down

0 comments on commit c68d25d

Please sign in to comment.