From e9ea621b93fbb58d9edfca8375918791637bbd52 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 30 Dec 2020 20:59:04 +0800 Subject: +init --- Client/Assembly-CSharp/MapBehaviour.cs | 113 +++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 Client/Assembly-CSharp/MapBehaviour.cs (limited to 'Client/Assembly-CSharp/MapBehaviour.cs') diff --git a/Client/Assembly-CSharp/MapBehaviour.cs b/Client/Assembly-CSharp/MapBehaviour.cs new file mode 100644 index 0000000..85d6b39 --- /dev/null +++ b/Client/Assembly-CSharp/MapBehaviour.cs @@ -0,0 +1,113 @@ +using System; +using UnityEngine; + +public class MapBehaviour : MonoBehaviour +{ + public bool IsOpen + { + get + { + return base.isActiveAndEnabled; + } + } + + public bool IsOpenStopped + { + get + { + return this.IsOpen && this.countOverlay.isActiveAndEnabled; + } + } + + public static MapBehaviour Instance; + + public AlphaPulse ColorControl; + + public SpriteRenderer HerePoint; + + public MapCountOverlay countOverlay; + + public InfectedOverlay infectedOverlay; + + public MapTaskOverlay taskOverlay; + + private void Awake() + { + MapBehaviour.Instance = this; + } + + private void GenericShow() + { + base.transform.localScale = Vector3.one; + base.transform.localPosition = new Vector3(0f, 0f, -25f); + base.gameObject.SetActive(true); + } + + public void ShowInfectedMap() + { + if (this.IsOpen) + { + this.Close(); + return; + } + if (!PlayerControl.LocalPlayer.CanMove) + { + return; + } + PlayerControl.LocalPlayer.SetPlayerMaterialColors(this.HerePoint); + this.GenericShow(); + this.infectedOverlay.gameObject.SetActive(true); + this.ColorControl.SetColor(Palette.ImpostorRed); + this.taskOverlay.Hide(); + DestroyableSingleton.Instance.SetHudActive(false); + } + + public void ShowNormalMap() + { + if (this.IsOpen) + { + this.Close(); + return; + } + if (!PlayerControl.LocalPlayer.CanMove) + { + return; + } + PlayerControl.LocalPlayer.SetPlayerMaterialColors(this.HerePoint); + this.GenericShow(); + this.taskOverlay.Show(); + this.ColorControl.SetColor(new Color(0.05f, 0.2f, 1f, 1f)); + DestroyableSingleton.Instance.SetHudActive(false); + } + + public void ShowCountOverlay() + { + this.GenericShow(); + this.countOverlay.gameObject.SetActive(true); + this.taskOverlay.Hide(); + this.HerePoint.enabled = false; + DestroyableSingleton.Instance.SetHudActive(false); + } + + public void FixedUpdate() + { + if (!ShipStatus.Instance) + { + return; + } + Vector3 vector = PlayerControl.LocalPlayer.transform.position; + vector /= ShipStatus.Instance.MapScale; + vector.z = -1f; + this.HerePoint.transform.localPosition = vector; + } + + public void Close() + { + base.gameObject.SetActive(false); + this.countOverlay.gameObject.SetActive(false); + this.infectedOverlay.gameObject.SetActive(false); + this.taskOverlay.Hide(); + this.HerePoint.enabled = true; + DestroyableSingleton.Instance.SetHudActive(true); + } +} -- cgit v1.1-26-g67d0