using System; using UnityEngine; internal class ChatBubble : PoolableBehavior { public SpriteRenderer ChatFace; public SpriteRenderer Xmark; public SpriteRenderer votedMark; public TextRenderer NameText; public TextRenderer TextArea; public SpriteRenderer Background; public void SetLeft() { base.transform.localPosition = new Vector3(-3f, 0f, 0f); this.ChatFace.flipX = false; this.ChatFace.transform.localScale = new Vector3(1f, 1f, 1f); this.ChatFace.transform.localPosition = new Vector3(0f, 0.07f, 0f); this.Xmark.transform.localPosition = new Vector3(-0.15f, -0.13f, -0.0001f); this.votedMark.transform.localPosition = new Vector3(-0.15f, -0.13f, -0.0001f); this.NameText.transform.localPosition = new Vector3(0.5f, 0.34f, 0f); this.NameText.RightAligned = false; this.TextArea.transform.localPosition = new Vector3(0.5f, 0.09f, 0f); this.TextArea.RightAligned = false; } public void SetNotification() { base.transform.localPosition = new Vector3(-2.75f, 0f, 0f); this.ChatFace.flipX = false; this.ChatFace.transform.localScale = new Vector3(0.75f, 0.75f, 1f); this.ChatFace.transform.localPosition = new Vector3(0f, 0.18f, 0f); this.Xmark.transform.localPosition = new Vector3(-0.15f, -0.13f, -0.0001f); this.votedMark.transform.localPosition = new Vector3(-0.15f, -0.13f, -0.0001f); this.NameText.transform.localPosition = new Vector3(0.5f, 0.34f, 0f); this.NameText.RightAligned = false; this.TextArea.transform.localPosition = new Vector3(0.5f, 0.09f, 0f); this.TextArea.RightAligned = false; this.TextArea.Text = string.Empty; } public void SetRight() { base.transform.localPosition = new Vector3(-2.35f, 0f, 0f); this.ChatFace.flipX = true; this.ChatFace.transform.localScale = new Vector3(1f, 1f, 1f); this.ChatFace.transform.localPosition = new Vector3(4.75f, 0.07f, 0f); this.Xmark.transform.localPosition = new Vector3(0.15f, -0.13f, -0.0001f); this.votedMark.transform.localPosition = new Vector3(0.15f, -0.13f, -0.0001f); this.NameText.transform.localPosition = new Vector3(4.35f, 0.34f, 0f); this.NameText.RightAligned = true; this.TextArea.transform.localPosition = new Vector3(4.35f, 0.09f, 0f); this.TextArea.RightAligned = true; } public void SetName(string playerName, bool isDead, bool voted, Color color) { this.NameText.Text = (playerName ?? "..."); this.NameText.Color = color; this.NameText.RefreshMesh(); if (isDead) { this.Xmark.enabled = true; this.Background.color = Palette.HalfWhite; } if (voted) { this.votedMark.enabled = true; } } public override void Reset() { this.Xmark.enabled = false; this.votedMark.enabled = false; this.Background.color = Color.white; } }