From 5d62040d0b49dbba437d467c1d7d058fc3fb8cd5 Mon Sep 17 00:00:00 2001 From: Hardel <42413417+Hardel-DW@users.noreply.github.com> Date: Tue, 9 Feb 2021 14:33:43 +0100 Subject: [PATCH] Correction de bugs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changement du layer Visibilité fonctionnel --- ModsThanos/ComponentMap.cs | 4 ++-- .../Patch/CustomGameOption/StringNumberOptions.cs | 5 +++++ .../Patch/CustomGameOption/ThanosrGameOptions.cs | 14 ++++++++++++++ ModsThanos/Patch/HandleRpcPatch.cs | 4 ++-- ModsThanos/Patch/PlayerControlPatch.cs | 3 +++ ModsThanos/Stone/Map/Mind.cs | 1 + ModsThanos/Stone/Map/Power.cs | 2 ++ ModsThanos/Stone/Map/Reality.cs | 1 + ModsThanos/Stone/Map/Soul.cs | 2 ++ ModsThanos/Stone/Map/Space.cs | 2 ++ ModsThanos/Stone/Map/Time.cs | 2 ++ 11 files changed, 36 insertions(+), 4 deletions(-) diff --git a/ModsThanos/ComponentMap.cs b/ModsThanos/ComponentMap.cs index b1d1e1c..735dcc0 100644 --- a/ModsThanos/ComponentMap.cs +++ b/ModsThanos/ComponentMap.cs @@ -35,8 +35,8 @@ private void Start() { BoxCollider2D collider = component.AddComponent(); collider.size = new Vector2(1f, 1f); collider.isTrigger = true; - component.transform.position = new Vector3(position.x, position.y, - 50); - component.transform.localPosition = new Vector3(position.x, position.y, -50); + component.transform.position = new Vector3(position.x, position.y, -0.5f); + component.transform.localPosition = new Vector3(position.x, position.y, -0.5f); component.transform.localScale = new Vector3(0.6f, 0.6f, 0.6f); component.SetActive(true); diff --git a/ModsThanos/Patch/CustomGameOption/StringNumberOptions.cs b/ModsThanos/Patch/CustomGameOption/StringNumberOptions.cs index 53e1fa5..1824b55 100644 --- a/ModsThanos/Patch/CustomGameOption/StringNumberOptions.cs +++ b/ModsThanos/Patch/CustomGameOption/StringNumberOptions.cs @@ -77,5 +77,10 @@ public void ValueChanged() { this.OnClick(); } + + public void ValueChanged(string newValue) { + value = newValue; + this.OnClick(); + } } } diff --git a/ModsThanos/Patch/CustomGameOption/ThanosrGameOptions.cs b/ModsThanos/Patch/CustomGameOption/ThanosrGameOptions.cs index d6304df..2958acf 100644 --- a/ModsThanos/Patch/CustomGameOption/ThanosrGameOptions.cs +++ b/ModsThanos/Patch/CustomGameOption/ThanosrGameOptions.cs @@ -1,4 +1,5 @@ using HarmonyLib; +using Hazel; using System; using System.Collections.Generic; using System.Linq; @@ -184,6 +185,19 @@ public static void UpdateGameMenu() { foreach (var item in GameOptionMenuPatch.numberButtonLists) UnityEngine.Object.Destroy(item.Button.gameObject); + + MessageWriter writer = FMLLKEACGIO.Instance.StartRpcImmediately(FFGALNAPKCD.LocalPlayer.NetId, (byte) CustomRPC.SyncCustomSettings, Hazel.SendOption.None, -1); + + foreach (var item in CustomGameOptions.stringOptions) + item.ValueChanged(); + + foreach (var item in CustomGameOptions.numberOptions) + writer.Write(item.Value); + + foreach (var item in CustomGameOptions.stringOptions) + writer.Write(item.Value); + + FMLLKEACGIO.Instance.FinishRpcImmediately(writer); } } } diff --git a/ModsThanos/Patch/HandleRpcPatch.cs b/ModsThanos/Patch/HandleRpcPatch.cs index f494f71..02b8dea 100644 --- a/ModsThanos/Patch/HandleRpcPatch.cs +++ b/ModsThanos/Patch/HandleRpcPatch.cs @@ -112,8 +112,8 @@ public static bool Prefix(PlayerControl __instance, [HarmonyArgument(0)] byte ca } foreach (var item in CustomGameOptions.stringOptions) { - item.Value = reader.ReadString(); - item.ValueChanged(); + string newValue = reader.ReadString(); + item.ValueChanged(newValue); } return false; diff --git a/ModsThanos/Patch/PlayerControlPatch.cs b/ModsThanos/Patch/PlayerControlPatch.cs index 4328d59..fb3e83a 100644 --- a/ModsThanos/Patch/PlayerControlPatch.cs +++ b/ModsThanos/Patch/PlayerControlPatch.cs @@ -80,6 +80,9 @@ public static void Postfix(KMOGFLPJLLK IOFBPLNIJIC) { if (FFGALNAPKCD.AllPlayerControls.Count > 1) { MessageWriter writer = FMLLKEACGIO.Instance.StartRpcImmediately(FFGALNAPKCD.LocalPlayer.NetId, (byte) CustomRPC.SyncCustomSettings, Hazel.SendOption.None, -1); + foreach (var item in CustomGameOptions.stringOptions) + item.ValueChanged(); + foreach (var item in CustomGameOptions.numberOptions) writer.Write(item.Value); diff --git a/ModsThanos/Stone/Map/Mind.cs b/ModsThanos/Stone/Map/Mind.cs index 32debeb..13d62e6 100644 --- a/ModsThanos/Stone/Map/Mind.cs +++ b/ModsThanos/Stone/Map/Mind.cs @@ -5,6 +5,7 @@ namespace ModsThanos.Stone.Map { public static class Mind { public static void Place(Vector3 position) { if (!GlobalVariable.stoneObjects.ContainsKey("Mind")) { + ModThanos.Logger.LogInfo(CustomGameOptions.VisibilityMind.ToString()); new ComponentMap(position, "ModsThanos.Resources.mind.png", "Mind", CustomGameOptions.VisibilityMind); } } diff --git a/ModsThanos/Stone/Map/Power.cs b/ModsThanos/Stone/Map/Power.cs index 868903d..1eb3bd9 100644 --- a/ModsThanos/Stone/Map/Power.cs +++ b/ModsThanos/Stone/Map/Power.cs @@ -5,6 +5,8 @@ public static class Power { public static void Place(Vector3 position) { if (!GlobalVariable.stoneObjects.ContainsKey("Power")) { + + ModThanos.Logger.LogInfo(CustomGameOptions.VisibilityPower.ToString()); new ComponentMap(position, "ModsThanos.Resources.power.png", "Power", CustomGameOptions.VisibilityPower); } } diff --git a/ModsThanos/Stone/Map/Reality.cs b/ModsThanos/Stone/Map/Reality.cs index fac163c..8d0a273 100644 --- a/ModsThanos/Stone/Map/Reality.cs +++ b/ModsThanos/Stone/Map/Reality.cs @@ -5,6 +5,7 @@ namespace ModsThanos.Stone.Map { public static class Reality { public static void Place(Vector3 position) { if (!GlobalVariable.stoneObjects.ContainsKey("Reality")) { + ModThanos.Logger.LogInfo(CustomGameOptions.VisibilityReality.ToString()); new ComponentMap(position, "ModsThanos.Resources.reality.png", "Reality", CustomGameOptions.VisibilityReality); } } diff --git a/ModsThanos/Stone/Map/Soul.cs b/ModsThanos/Stone/Map/Soul.cs index 7e6f365..42d5e34 100644 --- a/ModsThanos/Stone/Map/Soul.cs +++ b/ModsThanos/Stone/Map/Soul.cs @@ -8,8 +8,10 @@ public static class Soul { public static void Place(Vector3 position) { if (!GlobalVariable.stoneObjects.ContainsKey("Soul")) { + ModThanos.Logger.LogInfo(CustomGameOptions.VisibilitySoul.ToString()); new ComponentMap(position, "ModsThanos.Resources.soul.png", "Soul", CustomGameOptions.VisibilitySoul); + if (AmongUsClient.Instance.GameMode == GameModes.FreePlay || !PlayerControl.LocalPlayer.Data.IsImpostor) { var gameObject = new GameObject { layer = 5 }; var arrow = gameObject.AddComponent(); diff --git a/ModsThanos/Stone/Map/Space.cs b/ModsThanos/Stone/Map/Space.cs index b7f4011..3f090ac 100644 --- a/ModsThanos/Stone/Map/Space.cs +++ b/ModsThanos/Stone/Map/Space.cs @@ -5,6 +5,8 @@ namespace ModsThanos.Stone.Map { public static class Space { public static void Place(Vector3 position) { if (!GlobalVariable.stoneObjects.ContainsKey("Space")) { + + ModThanos.Logger.LogInfo(CustomGameOptions.VisibilitySpace.ToString()); new ComponentMap(position, "ModsThanos.Resources.space.png", "Space", CustomGameOptions.VisibilitySpace); } } diff --git a/ModsThanos/Stone/Map/Time.cs b/ModsThanos/Stone/Map/Time.cs index 31c5819..f4faf70 100644 --- a/ModsThanos/Stone/Map/Time.cs +++ b/ModsThanos/Stone/Map/Time.cs @@ -5,6 +5,8 @@ namespace ModsThanos.Stone.Map { public static class Time { public static void Place(Vector3 position) { if (!GlobalVariable.stoneObjects.ContainsKey("Time")) { + + ModThanos.Logger.LogInfo(CustomGameOptions.VisibilityTime.ToString()); new ComponentMap(position, "ModsThanos.Resources.time.png", "Time", CustomGameOptions.VisibilityTime); } }