summaryrefslogtreecommitdiff
path: root/Client/Assembly-CSharp/ExileController.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Client/Assembly-CSharp/ExileController.cs')
-rw-r--r--Client/Assembly-CSharp/ExileController.cs160
1 files changed, 160 insertions, 0 deletions
diff --git a/Client/Assembly-CSharp/ExileController.cs b/Client/Assembly-CSharp/ExileController.cs
new file mode 100644
index 0000000..4a52a4d
--- /dev/null
+++ b/Client/Assembly-CSharp/ExileController.cs
@@ -0,0 +1,160 @@
+using System;
+using System.Collections;
+using System.Linq;
+using UnityEngine;
+
+public class ExileController : MonoBehaviour
+{
+ public static ExileController Instance;
+
+ public TextRenderer ImpostorText;
+
+ public TextRenderer Text;
+
+ public SpriteRenderer Player;
+
+ public SpriteRenderer PlayerHat;
+
+ public SpriteRenderer PlayerSkin;
+
+ public AnimationCurve LerpCurve;
+
+ public float Duration = 7f;
+
+ public AudioClip TextSound;
+
+ private string completeString = string.Empty;
+
+ private GameData.PlayerInfo exiled;
+
+ public void Begin(GameData.PlayerInfo exiled, bool tie)
+ {
+ ExileController.Instance = this;
+ this.exiled = exiled;
+ this.Text.gameObject.SetActive(false);
+ this.Text.Text = string.Empty;
+ int num = GameData.Instance.AllPlayers.Count((GameData.PlayerInfo p) => p.IsImpostor && !p.IsDead && !p.Disconnected);
+ if (exiled != null)
+ {
+ int num2 = GameData.Instance.AllPlayers.Count((GameData.PlayerInfo p) => p.IsImpostor);
+ if (exiled.IsImpostor)
+ {
+ if (num2 > 1)
+ {
+ this.completeString = DestroyableSingleton<TranslationController>.Instance.GetString(StringNames.ExileTextPP, new object[]
+ {
+ exiled.PlayerName
+ });
+ }
+ else
+ {
+ this.completeString = DestroyableSingleton<TranslationController>.Instance.GetString(StringNames.ExileTextSP, new object[]
+ {
+ exiled.PlayerName
+ });
+ }
+ }
+ else if (num2 > 1)
+ {
+ this.completeString = DestroyableSingleton<TranslationController>.Instance.GetString(StringNames.ExileTextPN, new object[]
+ {
+ exiled.PlayerName
+ });
+ }
+ else
+ {
+ this.completeString = DestroyableSingleton<TranslationController>.Instance.GetString(StringNames.ExileTextSN, new object[]
+ {
+ exiled.PlayerName
+ });
+ }
+ PlayerControl.SetPlayerMaterialColors((int)exiled.ColorId, this.Player);
+ PlayerControl.SetHatImage(exiled.HatId, this.PlayerHat);
+ this.PlayerSkin.sprite = DestroyableSingleton<HatManager>.Instance.GetSkinById(exiled.SkinId).EjectFrame;
+ if (exiled.IsImpostor)
+ {
+ num--;
+ }
+ }
+ else
+ {
+ if (tie)
+ {
+ this.completeString = DestroyableSingleton<TranslationController>.Instance.GetString(StringNames.NoExileTie, Array.Empty<object>());
+ }
+ else
+ {
+ this.completeString = DestroyableSingleton<TranslationController>.Instance.GetString(StringNames.NoExileSkip, Array.Empty<object>());
+ }
+ this.Player.gameObject.SetActive(false);
+ }
+ if (num == 1)
+ {
+ this.ImpostorText.Text = DestroyableSingleton<TranslationController>.Instance.GetString(StringNames.ImpostorsRemainS, new object[]
+ {
+ num
+ });
+ }
+ else
+ {
+ this.ImpostorText.Text = DestroyableSingleton<TranslationController>.Instance.GetString(StringNames.ImpostorsRemainP, new object[]
+ {
+ num
+ });
+ }
+ base.StartCoroutine(this.Animate());
+ }
+
+ private IEnumerator Animate()
+ {
+ yield return DestroyableSingleton<HudManager>.Instance.CoFadeFullScreen(Color.black, Color.clear, 0.2f);
+ yield return new WaitForSeconds(1f);
+ float d = Camera.main.orthographicSize * Camera.main.aspect + 1f;
+ Vector2 left = Vector2.left * d;
+ Vector2 right = Vector2.right * d;
+ for (float t = 0f; t <= this.Duration; t += Time.deltaTime)
+ {
+ float num = t / this.Duration;
+ this.Player.transform.localPosition = Vector2.Lerp(left, right, this.LerpCurve.Evaluate(num));
+ float z = (t + 0.75f) * 25f / Mathf.Exp(t * 0.75f + 1f);
+ this.Player.transform.Rotate(new Vector3(0f, 0f, z));
+ if (num >= 0.3f)
+ {
+ int num2 = (int)(Mathf.Min(1f, (num - 0.3f) / 0.3f) * (float)this.completeString.Length);
+ if (num2 > this.Text.Text.Length)
+ {
+ this.Text.Text = this.completeString.Substring(0, num2);
+ this.Text.gameObject.SetActive(true);
+ if (this.completeString[num2 - 1] != ' ')
+ {
+ SoundManager.Instance.PlaySoundImmediate(this.TextSound, false, 0.8f, 1f);
+ }
+ }
+ }
+ yield return null;
+ }
+ this.Text.Text = this.completeString;
+ this.ImpostorText.gameObject.SetActive(true);
+ yield return Effects.Bloop(0f, this.ImpostorText.transform, 0.5f);
+ yield return new WaitForSeconds(0.5f);
+ yield return DestroyableSingleton<HudManager>.Instance.CoFadeFullScreen(Color.clear, Color.black, 0.2f);
+ if (this.exiled != null)
+ {
+ PlayerControl @object = this.exiled.Object;
+ if (@object != null)
+ {
+ @object.Exiled();
+ }
+ }
+ if (DestroyableSingleton<TutorialManager>.InstanceExists || !ShipStatus.Instance.IsGameOverDueToDeath())
+ {
+ DestroyableSingleton<HudManager>.Instance.StartCoroutine(DestroyableSingleton<HudManager>.Instance.CoFadeFullScreen(Color.black, Color.clear, 0.2f));
+ PlayerControl.LocalPlayer.SetKillTimer(PlayerControl.GameOptions.KillCooldown);
+ ShipStatus.Instance.EmergencyCooldown = (float)PlayerControl.GameOptions.EmergencyCooldown;
+ Camera.main.GetComponent<FollowerCamera>().Locked = false;
+ DestroyableSingleton<HudManager>.Instance.SetHudActive(true);
+ }
+ UnityEngine.Object.Destroy(base.gameObject);
+ yield break;
+ }
+}