]> git.deb.at Git - rhonda/theotherroles.git/commitdiff
Update to version 4.1.1
authorMallöris <|||||@||.||>
Mon, 2 May 2022 20:32:30 +0000 (22:32 +0200)
committerMallöris <|||||@||.||>
Mon, 2 May 2022 20:32:30 +0000 (22:32 +0200)
TheOtherRoles/Buttons.cs
TheOtherRoles/Main.cs
TheOtherRoles/Modules/CustomOptions.cs
TheOtherRoles/Modules/ModUpdater.cs
TheOtherRoles/Patches/MainMenuPatch.cs
TheOtherRoles/Patches/UpdatePatch.cs
TheOtherRoles/Resources/CentralUpperBlocked.png
TheOtherRoles/TheOtherRoles.csproj

index 4ad84e9fb3b3e3993d94109a9d2b4dda0cae2230..deb34a1e2930d6a2407bcea321b962633ddfcf70 100644 (file)
@@ -768,7 +768,7 @@ namespace TheOtherRoles
                     HudManager.Instance.StartCoroutine(Effects.Lerp(Portal.teleportDuration, new Action<float>((p) => { // Delayed action
                         PlayerControl.LocalPlayer.moveable = false;
                         PlayerControl.LocalPlayer.NetTransform.Halt();
-                        if (p >= 0.5f && p <= 0.53f && !didTeleport) {
+                        if (p >= 0.5f && p <= 0.53f && !didTeleport && !MeetingHud.Instance) {
                             if (SubmergedCompatibility.isSubmerged()) {
                                 SubmergedCompatibility.ChangeFloor(exit.y > -7);
                             }
@@ -1242,7 +1242,7 @@ namespace TheOtherRoles
                     if (Medium.target == null || Medium.target.player == null) return;
                     string msg = "";
 
-                    int randomNumber = TheOtherRoles.rnd.Next(4);
+                    int randomNumber = Medium.target.killerIfExisting?.PlayerId == Mini.mini?.PlayerId ? TheOtherRoles.rnd.Next(3) : TheOtherRoles.rnd.Next(4);
                     string typeOfColor = Helpers.isLighterColor(Medium.target.killerIfExisting.Data.DefaultOutfit.ColorId) ? "lighter" : "darker";
                     float timeSinceDeath = ((float)(Medium.meetingStartTime - Medium.target.timeOfDeath).TotalMilliseconds);
                     string name = " (" + Medium.target.player.Data.PlayerName + ")";
@@ -1251,7 +1251,7 @@ namespace TheOtherRoles
                     if (randomNumber == 0) msg = "What is your role? My role is " + RoleInfo.GetRolesString(Medium.target.player, false) + name;
                     else if (randomNumber == 1) msg = "What is your killer`s color type? My killer is a " + typeOfColor + " color" + name;
                     else if (randomNumber == 2) msg = "When did you die? I have died " + Math.Round(timeSinceDeath / 1000) + "s before meeting started" + name;
-                    else msg = "What is your killer`s role? My killer is " + RoleInfo.GetRolesString(Medium.target.killerIfExisting, false) + name;
+                    else msg = "What is your killer`s role? My killer is " + RoleInfo.GetRolesString(Medium.target.killerIfExisting, true) + name;
 
                     DestroyableSingleton<HudManager>.Instance.Chat.AddChat(PlayerControl.LocalPlayer, $"{msg}");
 
index 9aebb39bfea082502c2d48bf1aa46399fd101d5a..ee4de2bc14675e0071b427c8942541c2934d61d8 100644 (file)
@@ -22,7 +22,7 @@ namespace TheOtherRoles
     public class TheOtherRolesPlugin : BasePlugin
     {
         public const string Id = "me.eisbison.theotherroles";
-        public const string VersionString = "4.1.0";
+        public const string VersionString = "4.1.1";
 
         public static Version Version = Version.Parse(VersionString);
         internal static BepInEx.Logging.ManualLogSource Logger;
index 17b5c3fba35ad63dc7153828a77b472603849ee1..bfbdbc06be617a64945459d5937c16a1b36f72de 100644 (file)
@@ -635,6 +635,7 @@ namespace TheOtherRoles {
                 LastPosition = new Vector3(MinX, MinY);
                 lastAspect = aspect;
                 setLastPosition = true;
+                if (Scroller != null) Scroller.ContentXBounds = new FloatRange(MinX, MinX);                
             }
 
             CreateScroller(__instance);
index 1d68ac8c686b5d87faa3cb6c770bf134ac72b572..e26c8f9e7d41de9a221287d9298413d6b5c4cdb7 100644 (file)
@@ -68,7 +68,10 @@ namespace TheOtherRoles.Modules
         private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
         {
             if (scene.name != "MainMenu") return;
-            if (RequiredUpdateData is null) return;
+            if (RequiredUpdateData is null) {
+                showPopUp = false;
+                return;
+            }
             
             var template = GameObject.Find("ExitGameButton");
             if (!template) return;
@@ -100,6 +103,7 @@ namespace TheOtherRoles.Modules
             var isSubmerged = TORUpdate == null;
             var announcement = $"<size=150%>A new <color=#FC0303>{(isSubmerged ? "Submerged" : "THE OTHER ROLES")}</color> update to {(isSubmerged ? SubmergedUpdate.Tag : TORUpdate.Tag)} is available</size>\n{(isSubmerged ? SubmergedUpdate.Content : TORUpdate.Content)}";
             var mgr = FindObjectOfType<MainMenuManager>(true);
+            if (isSubmerged && !SubmergedCompatibility.Loaded) showPopUp = false;
             if (showPopUp) mgr.StartCoroutine(CoShowAnnouncement(announcement));
             showPopUp = false;
         }
@@ -140,6 +144,7 @@ namespace TheOtherRoles.Modules
         {
             var torUpdateCheck = Task.Run(() => Instance.GetGithubUpdate("Eisbison", "TheOtherRoles"));
             while (!torUpdateCheck.IsCompleted) yield return null;
+            Announcement.updateData = torUpdateCheck.Result;
             if (torUpdateCheck.Result != null && torUpdateCheck.Result.IsNewer(Version.Parse(TheOtherRolesPlugin.VersionString)))
             {
                 Instance.TORUpdate = torUpdateCheck.Result;
@@ -196,11 +201,20 @@ namespace TheOtherRoles.Modules
             if (downloadURI.Length == 0) return false;
 
             var res = await client.GetAsync(downloadURI, HttpCompletionOption.ResponseContentRead);
-            string codeBase = (isSubmerged ? SubmergedCompatibility.Assembly : Assembly.GetExecutingAssembly()).CodeBase;
+            string codeBase = "";
+            if (!isSubmerged)
+                codeBase = Assembly.GetExecutingAssembly().CodeBase;
+            else if (SubmergedCompatibility.Loaded)
+                codeBase = SubmergedCompatibility.Assembly.CodeBase;
+            else {
+                Uri pluginsFolder = new Uri(new Uri(Assembly.GetExecutingAssembly().CodeBase), ".");
+                codeBase = pluginsFolder.OriginalString + "/Submerged.dll";
+            }
+
             UriBuilder uri = new UriBuilder(codeBase);
             string fullname = Uri.UnescapeDataString(uri.Path);
             if (File.Exists(fullname + ".old")) File.Delete(fullname + ".old");
-            File.Move(fullname, fullname + ".old");
+            if (File.Exists(fullname)) File.Move(fullname, fullname + ".old");
 
             await using var responseStream = await res.Content.ReadAsStreamAsync();
             await using var fileStream = File.Create(fullname);
index 83c0fa038ee73431e93f4a340d0ce16c4347df2d..7418c956813b1559c0c1bca7aee0e1c405ef2c78 100644 (file)
@@ -74,4 +74,19 @@ namespace TheOtherRoles.Modules {
             });
         }
     }
+
+    [HarmonyPatch(typeof(AnnouncementPopUp), nameof(AnnouncementPopUp.UpdateAnnounceText))]
+    public static class Announcement
+    {
+        public static ModUpdateBehaviour.UpdateData updateData = null;
+        public static bool Prefix(AnnouncementPopUp __instance)
+        {
+            if (ModUpdateBehaviour.showPopUp || updateData == null) return true;
+
+            var text = __instance.AnnounceTextMeshPro;            
+            text.text = $"<size=150%><color=#FC0303>THE OTHER ROLES </color> {(updateData.Tag)}\n{(updateData.Content)}";
+
+            return false;
+        }
+    }
 }
\ No newline at end of file
index 7cf68011740c426d8740fe07691f01bf3fb7779a..4bb2ca2a850b18c3007e60ea90925b89709d5dd0 100644 (file)
@@ -245,7 +245,11 @@ namespace TheOtherRoles.Patches {
         }
 
         static void updateImpostorKillButton(HudManager __instance) {
-            if (!PlayerControl.LocalPlayer.Data.Role.IsImpostor || MeetingHud.Instance) return;
+            if (!PlayerControl.LocalPlayer.Data.Role.IsImpostor) return;
+            if (MeetingHud.Instance) {
+                __instance.KillButton.Hide();
+                return;
+            }
             bool enabled = true;
             if (Vampire.vampire != null && Vampire.vampire == PlayerControl.LocalPlayer)
                 enabled = false;
@@ -272,6 +276,14 @@ namespace TheOtherRoles.Patches {
 
         }
 
+        static void updateUseButton(HudManager __instance) {
+            if (MeetingHud.Instance) __instance.UseButton.Hide();
+        }
+
+        static void updateSabotageButton(HudManager __instance) {
+            if (MeetingHud.Instance) __instance.SabotageButton.Hide();
+        }
+
         static void Postfix(HudManager __instance)
         {
             if (AmongUsClient.Instance.GameState != InnerNet.InnerNetClient.GameStates.Started) return;
@@ -292,6 +304,9 @@ namespace TheOtherRoles.Patches {
             // Deputy Sabotage, Use and Vent Button Disabling
             updateReportButton(__instance);
             updateVentButton(__instance);
+            // Meeting hide buttons if needed (used for the map usage, because closing the map would show buttons)
+            updateSabotageButton(__instance);
+            updateUseButton(__instance);
 
         }
     }
index 87523269fc06f1586308561188dd9580050b65e5..438a6eddc806d175e874cc3a2a1de4e241581a3b 100644 (file)
Binary files a/TheOtherRoles/Resources/CentralUpperBlocked.png and b/TheOtherRoles/Resources/CentralUpperBlocked.png differ
index 8e471d80b375f9d4a5a46aaa04a331fcc119a55b..b978702635becf0e6e8c9c831be18330a4a0f6ae 100644 (file)
@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
     <PropertyGroup>
         <TargetFramework>netstandard2.1</TargetFramework>
-        <Version>4.0.0</Version>
+        <Version>4.1.1</Version>
         <Description>TheOtherRoles</Description>
         <Authors>Eisbison</Authors>
                <LangVersion>latest</LangVersion>
         <Reference Include="$(AmongUs)/BepInEx/unhollowed/*.dll" />
     </ItemGroup>
 
-    <ItemGroup>
-      <None Remove="Resources\Blood1.png" />
-      <None Remove="Resources\Blood2.png" />
-      <None Remove="Resources\Blood3.png" />
-    </ItemGroup>
-
     <Target Name="CopyCustomContent" AfterTargets="AfterBuild">
         <Message Text="Second occurrence" />
         <Copy SourceFiles="$(ProjectDir)\bin\$(Configuration)\netstandard2.1\TheOtherRoles.dll" DestinationFolder="$(AmongUsLatest)/BepInEx/plugins/" />