using System; using System.Collections; using DarkTonic.MasterAudio; using TMPro; using UnityEngine; using UnityEngine.UI; // Token: 0x020000CF RID: 207 public class QTE : MonoBehaviour { // Token: 0x06001322 RID: 4898 RVA: 0x00172530 File Offset: 0x00170730 public void StartQTE(string type, float customTimeScale) { this.eventType = type; this.resurrecting = false; if (this.listen != null) { base.StopCoroutine(this.listen); } this.clicked = false; this.canClick = false; this.completed = false; this.canComplete = false; this.main = Links.x.main; this.startHitCount = Links.x.main.stats.hitCount; this.startPosition = this.main.currentPosition; this.raycastBlocker.enabled = false; this.show = Links.x.options.rallyTimePrompt; if (!Records.x.editor) { this.debug = false; } this.animator.enabled = false; this.moonPunch.SetActive(false); this.moonPunchSuccess.SetActive(false); this.moonPunchFail.SetActive(false); this.closeInScaler.SetActive(false); this.closeInHit.SetActive(false); this.closeInMiss.SetActive(false); this.closeInOutside.SetActive(false); this.closeInInside.SetActive(false); this.line.SetActive(false); this.lineSuccess.SetActive(false); this.lineFail.SetActive(false); if (type == "ATB") { this.animator.Play("QTE_ActionClick", -1, 0f); this.listen = this.ListenForClick1(); base.StartCoroutine(this.listen); } if (type == "Revive") { this.listen = this.ListenForRevive2(); base.StartCoroutine(this.listen); } if (type == "Spirit1") { this.listen = this.ListenForClick2(); base.StartCoroutine(this.listen); } if (type == "MoonPunch") { this.listen = this.ListenForClickMoonPunch(customTimeScale); base.StartCoroutine(this.listen); } if (type == "Line") { this.listen = this.ListenForClickLine(); base.StartCoroutine(this.listen); } } // Token: 0x06001323 RID: 4899 RVA: 0x00172750 File Offset: 0x00170950 public void Reset() { this.closeInOutside.SetActive(false); this.closeInInside.SetActive(false); this.closeInScaler.SetActive(false); this.closeInHit.SetActive(false); this.closeInMiss.SetActive(false); this.closeInAnimEarlyOut.enabled = false; } // Token: 0x06001324 RID: 4900 RVA: 0x001727A8 File Offset: 0x001709A8 private bool Clicked() { if (Links.x.joy) { if (Links.x.gameplay.cancelStart || Links.x.gameplay.actionDown || Links.x.gameplay.actionStart || Links.x.gameplay.actionUp || Links.x.gameplay.interactStart) { return true; } } else { if (Input.GetMouseButtonDown(0) || Input.GetMouseButton(0) || Input.GetMouseButtonUp(0)) { return true; } if (Input.anyKey) { return true; } } return false; } // Token: 0x06001325 RID: 4901 RVA: 0x0017283C File Offset: 0x00170A3C private bool Holding() { if (Links.x.joy) { if (Links.x.gameplay.actionDown) { return true; } } else { if (Input.GetMouseButton(0)) { return true; } if (Input.anyKey) { return true; } } return false; } // Token: 0x06001326 RID: 4902 RVA: 0x00172874 File Offset: 0x00170A74 public bool Holding2() { if (Links.x.joy) { if (Links.x.gameplay.actionDown || Links.x.gameplay.actionStart || Links.x.gameplay.actionUp) { return true; } } else if (Input.GetMouseButton(0) || Input.GetMouseButtonDown(0) || Input.GetMouseButtonUp(0)) { return true; } return false; } // Token: 0x06001327 RID: 4903 RVA: 0x001728DD File Offset: 0x00170ADD public void CanClick() { this.canClick = true; } // Token: 0x06001328 RID: 4904 RVA: 0x001728E6 File Offset: 0x00170AE6 private IEnumerator ListenForClick2() { this.listenerCloseIn.canClick = false; this.listenerCloseIn.finished = false; this.raycastBlocker.enabled = true; this.closeOutsideSprite.color = Color.white; this.clicked = false; bool failed = false; while (this.Holding()) { yield return null; } this.closeInOutside.SetActive(true); this.closeInInside.SetActive(true); this.closeInScaler.SetActive(true); this.closeInAnimEarlyOut.enabled = false; this.clickTime = Time.timeSinceLevelLoad; while (!this.listenerCloseIn.canClick && !failed) { if (this.Clicked()) { failed = true; } yield return null; } if (failed && this.closeInScalar.GetCurrentAnimatorStateInfo(0).normalizedTime < 0.47f) { this.closeInAnimEarlyOut.enabled = true; } if (this.Clicked()) { this.clicked = true; } while (this.listenerCloseIn.canClick && !failed && !this.clicked) { if (this.Clicked()) { this.clicked = true; } this.clickTime = Time.timeSinceLevelLoad; yield return null; } if (!this.clicked) { failed = true; } if (failed) { this.closeInInside.SetActive(false); this.closeInMiss.SetActive(true); } if (this.clicked) { this.closeInHit.SetActive(true); } this.raycastBlocker.enabled = false; if (failed) { this.bonus = 1f; } else { this.bonus = 2f; } this.playing = false; if (failed) { float timeToLerp = 0.5f; float percentage = 0f; float startTime = Time.time; while (percentage < 1f) { percentage = (Time.time - startTime) / timeToLerp; this.closeOutsideSprite.color = Color.Lerp(Color.white, Color.clear, percentage); yield return null; } timeToLerp = 0.5f; percentage = 0f; startTime = Time.time; while (percentage < 1f) { percentage = (Time.time - startTime) / timeToLerp; yield return null; } } else { float startTime = 0.5f; float percentage = 0f; float timeToLerp = Time.time; while (percentage < 1f) { percentage = (Time.time - timeToLerp) / startTime; this.closeOutsideSprite.color = Color.Lerp(Color.white, Color.clear, percentage); yield return null; } while (!this.listenerCloseIn.finished) { yield return null; } } this.closeInScaler.SetActive(false); this.closeInHit.SetActive(false); this.closeInMiss.SetActive(false); this.closeInOutside.SetActive(false); this.closeInInside.SetActive(false); this.resurrecting = false; this.listen = null; yield break; } // Token: 0x06001329 RID: 4905 RVA: 0x001728F8 File Offset: 0x00170AF8 private void SetAnimatorSpeedMoonPunch(float customTimeScale) { if (customTimeScale != 1f) { float timeScale = Time.timeScale; float num = 1f / Time.timeScale; this.moonPunchAnimator.speed = num; } } // Token: 0x0600132A RID: 4906 RVA: 0x0017292B File Offset: 0x00170B2B private IEnumerator ListenForClickMoonPunch(float customTimeScale) { this.listenerMoonPunch.canClick = false; this.listenerMoonPunch.finished = false; this.raycastBlocker.enabled = true; this.clicked = false; bool failed = false; this.bonus = 1.5f; if (this.bonusType == "Evasion") { this.bonus = 1f; } float baseBonus = this.bonus; if (!this.show) { this.moonPunchGroup.enabled = true; } else { this.moonPunchGroup.enabled = false; } while (this.Holding2()) { yield return null; } this.moonPunch.SetActive(true); this.moonPunchSuccess.SetActive(false); this.moonPunchFail.SetActive(false); this.clickTime = 0f; this.moonPunchAnimator.speed = 1f; this.SetAnimatorSpeedMoonPunch(customTimeScale); while (!this.listenerMoonPunch.canClick && !failed) { this.SetAnimatorSpeedMoonPunch(customTimeScale); if (this.Clicked() && this.show) { failed = true; this.moonPunch.SetActive(false); this.moonPunchFail.SetActive(true); } yield return null; } if (this.debug) { Debug.Log("Before range - failed? " + failed.ToString() + " " + Time.timeSinceLevelLoad.ToString()); } this.SetAnimatorSpeedMoonPunch(customTimeScale); float startClickTime = this.moonPunchAnimator.GetCurrentAnimatorStateInfo(0).normalizedTime; if (this.Clicked() && this.show) { this.clicked = true; this.clickTime = this.moonPunchAnimator.GetCurrentAnimatorStateInfo(0).normalizedTime + 0.1f; this.moonPunchSuccess.SetActive(true); if (this.debug) { Debug.Log(string.Concat(new string[] { "In range - clicked? ", this.clicked.ToString(), " ", this.clickTime.ToString(), " ", Time.timeSinceLevelLoad.ToString() })); } } while (this.listenerMoonPunch.canClick && !failed && !this.clicked) { this.SetAnimatorSpeedMoonPunch(customTimeScale); if (this.Clicked() && this.show) { this.clickTime = this.moonPunchAnimator.GetCurrentAnimatorStateInfo(0).normalizedTime + 0.1f; this.clicked = true; this.moonPunchSuccess.SetActive(true); } if (this.debug) { Debug.Log(string.Concat(new string[] { "In range - clicked? ", this.clicked.ToString(), " ", this.clickTime.ToString(), " ", Time.timeSinceLevelLoad.ToString() })); } yield return null; } if (!this.clicked) { failed = true; } if (!failed) { this.moonPunch.SetActive(false); float num = 10f; if (this.bonusType == "Evasion") { num = 40f; } this.bonus = baseBonus + (this.clickTime - startClickTime) * num; this.bonus = Mathf.Round(this.bonus * 10f) / 10f; this.moonPunchText.text = this.bonus.ToString() + "x"; if (this.bonusType == "Evasion") { TextMeshProUGUI textMeshProUGUI = this.moonPunchText; textMeshProUGUI.text += " block"; } else if (this.bonusType == "Effects") { TextMeshProUGUI textMeshProUGUI2 = this.moonPunchText; textMeshProUGUI2.text += " effects"; } else { TextMeshProUGUI textMeshProUGUI3 = this.moonPunchText; textMeshProUGUI3.text += " damage"; } if (this.debug) { Debug.Log(string.Concat(new string[] { "Bonus: ", this.bonus.ToString(), " ", this.clickTime.ToString(), " ", startClickTime.ToString() })); } } if (this.debug) { Debug.Log(string.Concat(new string[] { "Range over - clicked? ", this.clicked.ToString(), " ", this.clickTime.ToString(), " ", Time.timeSinceLevelLoad.ToString() })); } this.raycastBlocker.enabled = false; this.playing = false; float startTime = Time.timeSinceLevelLoad; while (!this.listenerMoonPunch.finished && Time.timeSinceLevelLoad < startTime + 2f) { if (this.moonPunch.activeSelf) { this.SetAnimatorSpeedMoonPunch(customTimeScale); } yield return null; } this.moonPunch.SetActive(false); this.moonPunchSuccess.SetActive(false); this.moonPunchFail.SetActive(false); this.listen = null; this.bonusType = ""; yield break; } // Token: 0x0600132B RID: 4907 RVA: 0x00172941 File Offset: 0x00170B41 private IEnumerator ListenForClickLine() { this.listenerLine.canClick = false; this.listenerLine.finished = false; this.raycastBlocker.enabled = true; this.clicked = false; bool failed = false; while (this.Holding()) { yield return null; } this.line.SetActive(true); this.lineSuccess.SetActive(false); this.lineFail.SetActive(false); this.clickTime = Time.timeSinceLevelLoad; this.bonus = 1.5f; while (!this.listenerLine.canClick && !failed) { if (this.Clicked()) { failed = true; Debug.Log("Clicked early " + Time.timeSinceLevelLoad.ToString()); } yield return null; } Debug.Log("In range - failed? " + failed.ToString() + " " + Time.timeSinceLevelLoad.ToString()); float startClickTime = Time.timeSinceLevelLoad; if (this.Clicked()) { this.clicked = true; this.bonus += 0.19999999f; } while (this.listenerLine.canClick && !failed && !this.clicked) { this.clickTime = Time.timeSinceLevelLoad; if (this.Clicked()) { this.clicked = true; this.bonus += (this.clickTime - startClickTime) * 20f; } yield return null; } Debug.Log("Range over - clicked? " + this.clicked.ToString() + " " + Time.timeSinceLevelLoad.ToString()); if (!this.clicked) { failed = true; } if (failed) { this.lineFail.SetActive(true); } else { this.lineSuccess.SetActive(true); } this.raycastBlocker.enabled = false; this.playing = false; while (!this.listenerLine.finished) { yield return null; } this.line.SetActive(false); this.lineSuccess.SetActive(false); this.lineFail.SetActive(false); this.listen = null; yield break; } // Token: 0x0600132C RID: 4908 RVA: 0x00172950 File Offset: 0x00170B50 private IEnumerator ListenForClick1() { while (!this.canClick) { yield return null; } this.clickTime = Time.timeSinceLevelLoad; while (!this.Clicked()) { this.clickTime = Time.timeSinceLevelLoad; yield return null; } this.clicked = true; yield break; } // Token: 0x0600132D RID: 4909 RVA: 0x0017295F File Offset: 0x00170B5F private IEnumerator ListenForClickRevive() { this.resurrecting = true; float startTime = Time.timeSinceLevelLoad; bool failed = false; if (!this.quickStart) { while (this.Holding()) { if (failed) { break; } if (Time.timeSinceLevelLoad > startTime + 5f) { failed = true; this.animator.Play("QTE_ReviveStartFail", -1, 0f); } yield return null; } while (!this.Holding() && !failed) { if (Time.timeSinceLevelLoad > startTime + 5f) { failed = true; this.animator.Play("QTE_ReviveStartFail", -1, 0f); } yield return null; } } this.quickStart = false; if (!failed) { int count = 0; while (this.Holding() && this.CanRevive()) { if (count == 0) { this.animator.Play("QTE_ReviveHold", -1, 0f); } int num = count; count = num + 1; if (this.canComplete) { this.clickTime = Time.timeSinceLevelLoad; } yield return null; } } if (this.playing || failed) { if (failed) { this.completed = false; this.playing = false; } else if (!this.canComplete) { this.completed = false; this.AnimationDone(); this.listen = null; } else { this.completed = true; this.AnimationDone(); this.listen = null; } } yield break; } // Token: 0x0600132E RID: 4910 RVA: 0x0017296E File Offset: 0x00170B6E private IEnumerator ListenForRevive2() { this.listenerCloseIn.canClick = false; this.listenerCloseIn.finished = false; this.raycastBlocker.enabled = true; this.closeOutsideSprite.color = Color.white; this.clicked = false; bool failed = false; while (!this.Holding()) { yield return null; } this.closeInOutside.SetActive(true); this.closeInInside.SetActive(true); this.closeInScaler.SetActive(true); this.closeInAnimEarlyOut.enabled = false; this.clickTime = Time.timeSinceLevelLoad; while (!this.listenerCloseIn.canClick && !failed) { if (!this.CanRevive()) { failed = true; } if (!this.Holding()) { failed = true; } yield return null; } if (failed) { this.closeInAnimEarlyOut.enabled = true; } while (this.listenerCloseIn.canClick && !failed && !this.clicked) { if (!this.Holding()) { this.clicked = true; } if (!this.CanRevive()) { failed = true; } this.clickTime = Time.timeSinceLevelLoad; yield return null; } if (!failed) { this.clicked = true; } if (failed) { this.closeInInside.SetActive(false); this.closeInMiss.SetActive(true); } if (this.clicked) { this.closeInHit.SetActive(true); } this.raycastBlocker.enabled = false; if (!failed) { this.completed = true; } this.endTime = Time.timeSinceLevelLoad; this.bonus = this.endTime - this.clickTime; if (this.bonus < 0f) { this.bonus = 0f; } this.bonus *= 10f; this.bonus += 1f; this.bonus *= 25f; this.bonus = Mathf.Ceil(this.bonus); this.playing = false; this.resurrectText.text = "+" + this.bonus.ToString() + " health"; if (!failed) { MasterAudio.PlaySoundAndForget("Feedback", 0.6f, new float?(1f), 0f, "Song Learned", null); } else { MasterAudio.PlaySoundAndForget("Feedback", 0.6f, new float?(1f), 0f, "Stat Fail", null); } if (failed) { float timeToLerp = 0.5f; float percentage = 0f; float startTime = Time.time; while (percentage < 1f) { percentage = (Time.time - startTime) / timeToLerp; this.closeOutsideSprite.color = Color.Lerp(Color.white, Color.clear, percentage); yield return null; } timeToLerp = 0.5f; percentage = 0f; startTime = Time.time; while (percentage < 1f) { percentage = (Time.time - startTime) / timeToLerp; yield return null; } } else { float startTime = 0.5f; float percentage = 0f; float timeToLerp = Time.time; while (percentage < 1f) { percentage = (Time.time - timeToLerp) / startTime; this.closeOutsideSprite.color = Color.Lerp(Color.white, Color.clear, percentage); yield return null; } while (!this.listenerCloseIn.finished) { yield return null; } } this.closeInScaler.SetActive(false); this.closeInHit.SetActive(false); this.closeInMiss.SetActive(false); this.closeInOutside.SetActive(false); this.closeInInside.SetActive(false); this.resurrecting = false; this.listen = null; yield break; } // Token: 0x0600132F RID: 4911 RVA: 0x00172980 File Offset: 0x00170B80 private bool CanRevive() { return !(Links.x.main != this.main) && this.main && this.main.IsSentient() && this.main.stats.hitCount <= this.startHitCount + 2 && !this.main.stats.pinned && !this.main.dodging && !this.main.evading && !this.main.body.IsHit() && (this.main.currentPosition - this.startPosition).sqrMagnitude <= 16f; } // Token: 0x06001330 RID: 4912 RVA: 0x00172A4E File Offset: 0x00170C4E public void MadeIt() { this.clickTime = Time.timeSinceLevelLoad; this.canComplete = true; } // Token: 0x06001331 RID: 4913 RVA: 0x00172A64 File Offset: 0x00170C64 public void AnimationDone() { if (this.listen != null) { base.StopCoroutine(this.listen); this.listen = null; } if (this.eventType == "ATB") { this.endTime = Time.timeSinceLevelLoad; this.bonus = 1f - (this.endTime - this.clickTime); if (this.bonus < 0f) { this.bonus = 0f; } this.bonus += 1f; this.bonus = this.R1(this.bonus); this.actionText.text = this.bonus.ToString() + " x"; } else if (!(this.eventType == "Spirit1") && this.eventType == "Revive") { this.endTime = Time.timeSinceLevelLoad; this.bonus = this.endTime - this.clickTime; if (this.bonus < 0f) { this.bonus = 0f; } this.bonus *= 10f; this.bonus += 1f; this.bonus *= 25f; this.bonus = Mathf.Ceil(this.bonus); this.reviveText.text = "+" + this.bonus.ToString() + " health"; if (this.canComplete) { this.completed = true; MasterAudio.PlaySoundAndForget("Feedback", 0.6f, new float?(1f), 0f, "Song Learned", null); this.animator.Play("QTE_ReviveSuccess", -1, 0f); } else { MasterAudio.PlaySoundAndForget("Feedback", 0.6f, new float?(1f), 0f, "Stat Fail", null); this.animator.Play("QTE_ReviveFail", -1, 0f); } } this.playing = false; this.resurrecting = false; } // Token: 0x06001332 RID: 4914 RVA: 0x00172C97 File Offset: 0x00170E97 public float R1(float x) { return Mathf.Round(x * 10f) / 10f; } // Token: 0x0400203A RID: 8250 public Animator animator; // Token: 0x0400203B RID: 8251 public Animator closeInAnimEarlyOut; // Token: 0x0400203C RID: 8252 public Animator closeInScalar; // Token: 0x0400203D RID: 8253 public Animator moonPunchAnimator; // Token: 0x0400203E RID: 8254 public GameObject closeInOutside; // Token: 0x0400203F RID: 8255 public GameObject closeInInside; // Token: 0x04002040 RID: 8256 public GameObject closeInScaler; // Token: 0x04002041 RID: 8257 public GameObject closeInHit; // Token: 0x04002042 RID: 8258 public GameObject closeInMiss; // Token: 0x04002043 RID: 8259 public GameObject moonPunch; // Token: 0x04002044 RID: 8260 public GameObject moonPunchSuccess; // Token: 0x04002045 RID: 8261 public GameObject moonPunchFail; // Token: 0x04002046 RID: 8262 public GameObject line; // Token: 0x04002047 RID: 8263 public GameObject lineSuccess; // Token: 0x04002048 RID: 8264 public GameObject lineFail; // Token: 0x04002049 RID: 8265 public bool clicked; // Token: 0x0400204A RID: 8266 public bool canClick; // Token: 0x0400204B RID: 8267 public bool playing; // Token: 0x0400204C RID: 8268 private IEnumerator listen; // Token: 0x0400204D RID: 8269 public float clickTime; // Token: 0x0400204E RID: 8270 public float endTime; // Token: 0x0400204F RID: 8271 public float bonus; // Token: 0x04002050 RID: 8272 public TextMeshProUGUI actionText; // Token: 0x04002051 RID: 8273 public TextMeshProUGUI reviveText; // Token: 0x04002052 RID: 8274 public TextMeshProUGUI moonPunchText; // Token: 0x04002053 RID: 8275 public TextMeshProUGUI resurrectText; // Token: 0x04002054 RID: 8276 public string eventType; // Token: 0x04002055 RID: 8277 public bool completed; // Token: 0x04002056 RID: 8278 public bool canComplete; // Token: 0x04002057 RID: 8279 public bool quickStart; // Token: 0x04002058 RID: 8280 public bool resurrecting; // Token: 0x04002059 RID: 8281 private Character main; // Token: 0x0400205A RID: 8282 private int startHitCount; // Token: 0x0400205B RID: 8283 private Vector3 startPosition; // Token: 0x0400205C RID: 8284 public ListenerQTE listenerCloseIn; // Token: 0x0400205D RID: 8285 public ListenerQTE listenerMoonPunch; // Token: 0x0400205E RID: 8286 public ListenerQTE listenerLine; // Token: 0x0400205F RID: 8287 public Image raycastBlocker; // Token: 0x04002060 RID: 8288 public Image closeOutsideSprite; // Token: 0x04002061 RID: 8289 private bool debug; // Token: 0x04002062 RID: 8290 public bool show; // Token: 0x04002063 RID: 8291 public CanvasGroup moonPunchGroup; // Token: 0x04002064 RID: 8292 public string bonusType; }