using System; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; // Token: 0x020000AE RID: 174 public class HannahAnimator : MonoBehaviour { // Token: 0x06000FD7 RID: 4055 RVA: 0x001310EC File Offset: 0x0012F2EC private void Awake() { if (!this.looping && this.currentAnimation == "") { base.enabled = false; } if (!this.looping) { this.currentIndex = -1; this.updateTime = 0f; } if (this.randomStart) { this.delay = Random.Range(0f, 1f); this.startTime = Time.timeSinceLevelLoad; this.currentIndex = Random.Range(0, this.sprites.Count - 1); } } // Token: 0x06000FD8 RID: 4056 RVA: 0x00131178 File Offset: 0x0012F378 private void OnEnable() { if (!this.looping && this.currentAnimation != "") { this.currentIndex = -1; this.updateTime = 0f; } if (this.animationType == HannahAnimator.type.meshes) { for (int i = 0; i < this.meshes.Count; i++) { this.meshes[i].enabled = false; } for (int j = 0; j < this.meshes2.Count; j++) { this.meshes2[j].enabled = false; } } } // Token: 0x06000FD9 RID: 4057 RVA: 0x0013120C File Offset: 0x0012F40C public void Play(string animationName) { base.enabled = true; this.currentAnimation = animationName; this.updateTime = 0f; this.currentIndex = 0; if (this.animationType == HannahAnimator.type.sheen) { this.start = 0f; this.target = 1f; this.imageRenderer.fillOrigin = 1; } if (this.animationType == HannahAnimator.type.book && animationName.Contains("Close")) { this.currentIndex = -1; } if (animationName == "End" && this.animationType == HannahAnimator.type.meshes) { if (this.meshes2.Count > 0) { for (int i = 0; i < this.meshes.Count; i++) { this.meshes[i].enabled = false; } this.currentIndex = 0; } else { this.currentIndex = this.meshes.Count; } } if (animationName.Contains("2") && this.animationType == HannahAnimator.type.meshes) { this.currentIndex = 0; } this.Update(); } // Token: 0x06000FDA RID: 4058 RVA: 0x0013130D File Offset: 0x0012F50D public void SetAtBeginning() { if (this.animationType == HannahAnimator.type.image || this.animationType == HannahAnimator.type.book) { this.currentIndex = 0; this.imageRenderer.sprite = this.sprites[this.currentIndex]; this.End(); } } // Token: 0x06000FDB RID: 4059 RVA: 0x0013134B File Offset: 0x0012F54B public void Stop() { if (this.animationType == HannahAnimator.type.sheen) { this.imageRenderer.enabled = false; } this.End(); } // Token: 0x06000FDC RID: 4060 RVA: 0x00131368 File Offset: 0x0012F568 public void End() { if (this.deactivateOnEnd) { if (this.returnToCellar) { base.gameObject.transform.parent = Links.x.cellar.tr; } base.gameObject.SetActive(false); return; } base.enabled = false; } // Token: 0x06000FDD RID: 4061 RVA: 0x001313B8 File Offset: 0x0012F5B8 private void Update() { if (this.stopDuringPocketPause && Records.x.pocketPause) { return; } float num = 0f; if (Records.x.filming) { num = 0.2f; } if (this.speed > 0f) { if (this.animationType == HannahAnimator.type.sprite) { if (!this.useRealTime) { if (Time.timeSinceLevelLoad > this.updateTime + this.updateInterval) { this.updateTime = Time.timeSinceLevelLoad; this.currentIndex++; if (this.currentIndex > this.sprites.Count - 1) { this.currentIndex = 0; } this.spriteRenderer.sprite = this.sprites[this.currentIndex]; } } else if (Time.realtimeSinceStartup > this.updateTime + this.updateInterval + num) { this.updateTime = Time.realtimeSinceStartup; this.currentIndex++; if (this.currentIndex > this.sprites.Count - 1) { this.currentIndex = 0; } this.spriteRenderer.sprite = this.sprites[this.currentIndex]; } } if (this.animationType == HannahAnimator.type.meshes) { if (this.looping) { if (Time.timeSinceLevelLoad > this.updateTime + this.updateInterval) { this.updateTime = Time.timeSinceLevelLoad; this.currentIndex++; if (this.currentIndex > this.meshes.Count - 1) { this.currentIndex = 0; } for (int i = 0; i < this.meshes.Count; i++) { if (i != this.currentIndex) { this.meshes[i].enabled = false; } else { this.meshes[i].enabled = true; } } } } else if (Time.timeSinceLevelLoad > this.updateTime + this.updateInterval) { if (this.currentAnimation.Contains("Start")) { this.updateTime = Time.timeSinceLevelLoad; this.currentIndex++; if (this.currentIndex > this.meshes.Count - 1) { if (this.currentAnimation.Contains("StartEnd")) { for (int j = 0; j < this.meshes.Count; j++) { this.meshes[j].enabled = false; } } this.Stop(); return; } if (this.currentAnimation.Contains("Summon") && this.currentIndex == 5 && this.currentTileEffect) { this.currentTileEffect.Flag(); } for (int k = 0; k < this.meshes.Count; k++) { if (k != this.currentIndex) { this.meshes[k].enabled = false; } else { this.meshes[k].enabled = true; } } } if (this.currentAnimation == "End") { if (this.meshes2.Count > 0) { this.updateTime = Time.timeSinceLevelLoad; this.currentIndex++; if (this.currentIndex > this.meshes2.Count - 1) { Flag component = base.gameObject.GetComponent(); if (component) { component.FXDone(); } this.Stop(); return; } for (int l = 0; l < this.meshes2.Count; l++) { if (l != this.currentIndex) { this.meshes2[l].enabled = false; } else { this.meshes2[l].enabled = true; } } } else { this.updateTime = Time.timeSinceLevelLoad; this.currentIndex--; if (this.currentIndex < 0) { Flag component2 = base.gameObject.GetComponent(); if (component2) { component2.FXDone(); } this.Stop(); return; } for (int m = 0; m < this.meshes.Count; m++) { if (m != this.currentIndex) { this.meshes[m].enabled = false; } else { this.meshes[m].enabled = true; } } } } if (this.currentAnimation.Contains("2")) { this.updateTime = Time.timeSinceLevelLoad; this.currentIndex++; if (this.currentIndex > this.meshes2.Count - 1) { if (this.currentAnimation.Contains("StartEnd")) { for (int n = 0; n < this.meshes2.Count; n++) { this.meshes2[n].enabled = false; } } this.Stop(); return; } for (int num2 = 0; num2 < this.meshes2.Count; num2++) { if (num2 != this.currentIndex) { this.meshes2[num2].enabled = false; } else { this.meshes2[num2].enabled = true; } } } } } if (this.animationType == HannahAnimator.type.image) { if (this.currentAnimation == "2") { if (!this.useRealTime) { if (Time.timeSinceLevelLoad > this.updateTime + this.updateInterval) { this.updateTime = Time.timeSinceLevelLoad; this.currentIndex++; if (this.currentIndex > this.sprites2.Count - 1) { this.currentIndex = 0; if (!this.looping && this.currentIndex == 0) { this.End(); } } if (base.enabled) { this.imageRenderer.sprite = this.sprites2[this.currentIndex]; } } } else if (Time.realtimeSinceStartup > this.updateTime + this.updateInterval + num) { this.updateTime = Time.realtimeSinceStartup; this.currentIndex++; if (this.currentIndex > this.sprites2.Count - 1) { this.currentIndex = 0; if (!this.looping) { this.End(); } } if (base.enabled) { this.imageRenderer.sprite = this.sprites2[this.currentIndex]; } } } else if (!this.useRealTime) { if (Time.timeSinceLevelLoad > this.updateTime + this.updateInterval) { this.updateTime = Time.timeSinceLevelLoad; this.currentIndex++; if (this.currentIndex > this.sprites.Count - 1) { this.currentIndex = 0; if (!this.looping && this.currentIndex == 0) { this.End(); } } if (base.enabled) { this.imageRenderer.sprite = this.sprites[this.currentIndex]; } } } else if (Time.realtimeSinceStartup > this.updateTime + this.updateInterval + num) { this.updateTime = Time.realtimeSinceStartup; this.currentIndex++; if (this.currentIndex > this.sprites.Count - 1) { this.currentIndex = 0; if (!this.looping) { this.End(); } } if (base.enabled) { this.imageRenderer.sprite = this.sprites[this.currentIndex]; } } } HannahAnimator.type type = this.animationType; if (this.animationType == HannahAnimator.type.positionX && Time.realtimeSinceStartup > this.updateTime + this.updateInterval + num) { this.updateTime = Time.realtimeSinceStartup; Vector3 anchoredPosition3D = this.rt.anchoredPosition3D; this.currentIndex++; if (this.currentIndex > this.positionsIn.Count - 1) { this.End(); } else { anchoredPosition3D.x = this.positionsIn[this.currentIndex]; this.rt.anchoredPosition3D = anchoredPosition3D; } } if (this.animationType == HannahAnimator.type.book && Time.realtimeSinceStartup > this.updateTime + this.updateInterval + num) { this.updateTime = Time.realtimeSinceStartup; if (this.currentAnimation.Contains("Open")) { if (this.currentIndex + 1 > this.sprites.Count - 1) { this.End(); } else { this.updateTime = Time.realtimeSinceStartup; this.currentIndex++; this.imageRenderer.sprite = this.sprites[this.currentIndex]; } } else if (this.currentAnimation.Contains("Close")) { if (this.currentIndex + 1 > this.sprites2.Count - 1) { this.End(); } else { this.updateTime = Time.realtimeSinceStartup; this.currentIndex++; this.imageRenderer.sprite = this.sprites2[this.currentIndex]; } } else if (this.currentIndex + 1 > this.sprites3.Count - 1) { this.End(); } else { this.updateTime = Time.realtimeSinceStartup; this.currentIndex++; this.imageRenderer.sprite = this.sprites3[this.currentIndex]; } } if ((this.animationType == HannahAnimator.type.skillBag || this.animationType == HannahAnimator.type.skillBagWarrior) && Time.realtimeSinceStartup > this.updateTime + this.updateInterval + num) { this.updateTime = Time.realtimeSinceStartup; Vector3 anchoredPosition3D2 = this.rt.anchoredPosition3D; this.currentIndex++; if (this.currentAnimation.Contains("out")) { if (this.currentIndex > this.positionsOut.Count - 1 || (this.animationType != HannahAnimator.type.skillBagWarrior && this.currentIndex > 1)) { this.End(); } else { anchoredPosition3D2.x = this.positionsOut[this.currentIndex]; this.rt.anchoredPosition3D = anchoredPosition3D2; } } else if (this.currentAnimation.Contains("full")) { if (this.currentIndex > this.positionsOut2.Count - 1) { this.End(); } else { anchoredPosition3D2.x = this.positionsOut2[this.currentIndex]; this.rt.anchoredPosition3D = anchoredPosition3D2; } } else if (this.currentIndex > this.positionsIn.Count - 1 || (this.animationType == HannahAnimator.type.skillBagWarrior && this.currentIndex > 2)) { this.End(); } else { anchoredPosition3D2.x = this.positionsIn[this.currentIndex]; this.rt.anchoredPosition3D = anchoredPosition3D2; } } } if (this.animationType == HannahAnimator.type.closeButton && Time.realtimeSinceStartup > this.updateTime + this.updateInterval + num) { this.updateTime = Time.realtimeSinceStartup; if (this.currentAnimation.Contains("Up")) { if (this.currentIndex + 1 > this.sprites.Count - 1) { this.End(); } else { this.updateTime = Time.realtimeSinceStartup; this.currentIndex++; this.imageRenderer.sprite = this.sprites[this.currentIndex]; } } else if (this.currentAnimation.Contains("Clicked")) { if (this.currentIndex + 1 > this.sprites2.Count - 1) { this.End(); } else { this.updateTime = Time.realtimeSinceStartup; this.currentIndex++; this.imageRenderer.sprite = this.sprites2[this.currentIndex]; } } else if (this.currentIndex + 1 > this.sprites3.Count - 1) { this.End(); } else { this.updateTime = Time.realtimeSinceStartup; this.currentIndex++; this.imageRenderer.sprite = this.sprites3[this.currentIndex]; } } if (this.animationType == HannahAnimator.type.sheen) { if (Records.x.paused) { if (Records.x.filming) { this.t += Time.deltaTime * this.speed; } else { this.t += Time.deltaTime * Records.x.filmingAnimatorSpeed * this.speed; } } else { this.t += Time.deltaTime * this.speed; } if (this.target == 0f || this.target == 1f) { this.imageRenderer.fillAmount = Mathf.Lerp(this.start, this.target, this.t); Color color = this.imageRenderer.color; color.a = Mathf.Lerp(this.start, this.target, this.t); this.imageRenderer.color = color; } if (this.t >= 1f) { if (this.target == 1f) { this.start = 0f; this.target = 0.5f; this.imageRenderer.fillOrigin = 0; this.t = 0f; } else if (this.target == 0.5f) { this.start = 1f; this.target = 0f; this.t = 0f; } else { this.start = 0f; this.target = 1f; this.imageRenderer.fillOrigin = 1; this.t = 0f; } } if (!this.imageRenderer.enabled) { this.imageRenderer.enabled = true; } } } // Token: 0x04001A35 RID: 6709 [Header("ANIMATION INFO")] private float updateTime; // Token: 0x04001A36 RID: 6710 public float speed = 1f; // Token: 0x04001A37 RID: 6711 public float updateInterval = 0.2f; // Token: 0x04001A38 RID: 6712 public HannahAnimator.type animationType; // Token: 0x04001A39 RID: 6713 public bool useRealTime = true; // Token: 0x04001A3A RID: 6714 private int currentIndex; // Token: 0x04001A3B RID: 6715 [Header("OBJECTS")] public Image imageRenderer; // Token: 0x04001A3C RID: 6716 public SpriteRenderer spriteRenderer; // Token: 0x04001A3D RID: 6717 public RectTransform rt; // Token: 0x04001A3E RID: 6718 public List sprites = new List(); // Token: 0x04001A3F RID: 6719 public List sprites2 = new List(); // Token: 0x04001A40 RID: 6720 public List sprites3 = new List(); // Token: 0x04001A41 RID: 6721 public List positionsIn = new List(); // Token: 0x04001A42 RID: 6722 public List positionsOut = new List(); // Token: 0x04001A43 RID: 6723 public List positionsOut2 = new List(); // Token: 0x04001A44 RID: 6724 public List meshes = new List(); // Token: 0x04001A45 RID: 6725 public List meshes2 = new List(); // Token: 0x04001A46 RID: 6726 public TileEffects currentTileEffect; // Token: 0x04001A47 RID: 6727 [Header("LOOPING OR NAMES")] public bool looping; // Token: 0x04001A48 RID: 6728 public bool randomStart; // Token: 0x04001A49 RID: 6729 public bool deactivateOnEnd; // Token: 0x04001A4A RID: 6730 public bool returnToCellar; // Token: 0x04001A4B RID: 6731 public string currentAnimation; // Token: 0x04001A4C RID: 6732 public bool stopDuringPocketPause; // Token: 0x04001A4D RID: 6733 private float t; // Token: 0x04001A4E RID: 6734 private float start; // Token: 0x04001A4F RID: 6735 private float target; // Token: 0x04001A50 RID: 6736 private float delay; // Token: 0x04001A51 RID: 6737 private float startTime; // Token: 0x02000221 RID: 545 public enum type { // Token: 0x04003365 RID: 13157 sprite, // Token: 0x04003366 RID: 13158 image, // Token: 0x04003367 RID: 13159 menu, // Token: 0x04003368 RID: 13160 positionX, // Token: 0x04003369 RID: 13161 positionY, // Token: 0x0400336A RID: 13162 skillBag, // Token: 0x0400336B RID: 13163 skillBagWarrior, // Token: 0x0400336C RID: 13164 closeButton, // Token: 0x0400336D RID: 13165 sheen, // Token: 0x0400336E RID: 13166 book, // Token: 0x0400336F RID: 13167 meshes } }