Skip to content

Commit

Permalink
Correction de bugs
Browse files Browse the repository at this point in the history
Changement du layer
Visibilité fonctionnel
  • Loading branch information
Hardel-DW committed Feb 9, 2021
1 parent a00ad53 commit 5d62040
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ModsThanos/ComponentMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ private void Start() {
BoxCollider2D collider = component.AddComponent<BoxCollider2D>();
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);
Expand Down
5 changes: 5 additions & 0 deletions ModsThanos/Patch/CustomGameOption/StringNumberOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,10 @@ public void ValueChanged() {

this.OnClick();
}

public void ValueChanged(string newValue) {
value = newValue;
this.OnClick();
}
}
}
14 changes: 14 additions & 0 deletions ModsThanos/Patch/CustomGameOption/ThanosrGameOptions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using HarmonyLib;
using Hazel;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down Expand Up @@ -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);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions ModsThanos/Patch/HandleRpcPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions ModsThanos/Patch/PlayerControlPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
1 change: 1 addition & 0 deletions ModsThanos/Stone/Map/Mind.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
2 changes: 2 additions & 0 deletions ModsThanos/Stone/Map/Power.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
1 change: 1 addition & 0 deletions ModsThanos/Stone/Map/Reality.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
2 changes: 2 additions & 0 deletions ModsThanos/Stone/Map/Soul.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<DGPHMLNNPDN>();
Expand Down
2 changes: 2 additions & 0 deletions ModsThanos/Stone/Map/Space.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
2 changes: 2 additions & 0 deletions ModsThanos/Stone/Map/Time.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 5d62040

Please sign in to comment.