Skip to content

Commit

Permalink
Clear Code
Browse files Browse the repository at this point in the history
  • Loading branch information
mxyx0412 committed Oct 8, 2024
1 parent 7fc2e30 commit 4b7b54f
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 11 deletions.
2 changes: 2 additions & 0 deletions TheOtherRoles/Buttons/CustomButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public static void HudUpdate()
buttons.RemoveAll(item => item.actionButton == null);

foreach (var t in buttons)
{
try
{
t.Update();
Expand All @@ -113,6 +114,7 @@ public static void HudUpdate()
{
Warn("NullReferenceException from HudUpdate().HasButton(), if theres only one warning its fine");
}
}
}

public static void MeetingEndedUpdate()
Expand Down
4 changes: 2 additions & 2 deletions TheOtherRoles/CustomCosmetics/CosmeticsManagerConfig.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Text.Json.Serialization;
using System;
using System;
using System.Text.Json.Serialization;

namespace TheOtherRoles.CustomCosmetics;

Expand Down
3 changes: 1 addition & 2 deletions TheOtherRoles/CustomCosmetics/CustomHats/CustomHatData.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Text.Json.Serialization;
using UnityEngine;

Expand Down
1 change: 0 additions & 1 deletion TheOtherRoles/Helper/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,6 @@ public static async Task checkBeta()
{
if (Main.betaDays > 0)
{
Message($"Beta check");
var ticks = GetBuiltInTicks();
var compileTime = new DateTime(ticks, DateTimeKind.Utc); // This may show as an error, but it is not, compilation will work!
Message($"Beta版构建于: {compileTime.ToString(CultureInfo.InvariantCulture)}");
Expand Down
1 change: 0 additions & 1 deletion TheOtherRoles/Modules/TaskQueue.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace TheOtherRoles.Modules;
Expand Down
1 change: 0 additions & 1 deletion TheOtherRoles/Options/CustomOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1645,7 +1645,6 @@ public static void Postfix(HudManager __instance)
// add a special button for settings viewing:
toggleSettingsButtonObject = Object.Instantiate(__instance.MapButton.gameObject, __instance.MapButton.transform.parent);
toggleSettingsButtonObject.transform.localPosition = __instance.MapButton.transform.localPosition + new Vector3(0, -0.66f, -500f);
toggleSettingsButtonObject.transform.parent.SetLocalZ(-500f);
var renderer = toggleSettingsButtonObject.GetComponent<SpriteRenderer>();
renderer.sprite = UnityHelper.loadSpriteFromResources("TheOtherRoles.Resources.CurrentSettingsButton.png", 180f);
toggleSettingsButton = toggleSettingsButtonObject.GetComponent<PassiveButton>();
Expand Down
4 changes: 2 additions & 2 deletions TheOtherRoles/Patches/IntroPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public static void Prefix(IntroCutscene __instance)
if (AmongUsClient.Instance.AmHost)
{
var mapId = GameOptionsManager.Instance.currentNormalGameOptions.MapId;
var writerS = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId,
var writerS = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId,
(byte)CustomRPC.DynamicMapOption, SendOption.Reliable);
writerS.Write(mapId);
AmongUsClient.Instance.FinishRpcImmediately(writerS);
Expand All @@ -127,7 +127,7 @@ public static void Prefix(IntroCutscene __instance)
var target = PlayerControl.AllPlayerControls.ToList().FirstOrDefault(x => x.Data.PlayerName.Equals(ModOption.firstKillName));
if (target != null)
{
var writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId,
var writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId,
(byte)CustomRPC.SetFirstKill, SendOption.Reliable);
writer.Write(target.PlayerId);
AmongUsClient.Instance.FinishRpcImmediately(writer);
Expand Down
3 changes: 1 addition & 2 deletions TheOtherRoles/RPC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3631,8 +3631,7 @@ private static bool Prefix([HarmonyArgument(0)] byte callId, [HarmonyArgument(1)
break;

case CustomRPC.DynamicMapOption:
var mapId = reader.ReadByte();
RPCProcedure.dynamicMapOption(mapId);
RPCProcedure.dynamicMapOption(reader.ReadByte());
break;

case CustomRPC.SetGameStarting:
Expand Down

0 comments on commit 4b7b54f

Please sign in to comment.