using System; using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI; // Token: 0x020000A9 RID: 169 public class GameCard : MonoBehaviour { // Token: 0x06000F8E RID: 3982 RVA: 0x0012CFA2 File Offset: 0x0012B1A2 private void Awake() { } // Token: 0x06000F8F RID: 3983 RVA: 0x0012CFA4 File Offset: 0x0012B1A4 private void Start() { this.ToggleState(false); } // Token: 0x06000F90 RID: 3984 RVA: 0x0012CFB0 File Offset: 0x0012B1B0 public int GetDiceCountModifier(int type) { int num = 0; this.diceCountMods = this.hoverCharacter.stats.diceCountMods; this.diceSideMods = this.hoverCharacter.stats.diceSideMods; this.diceTypeMods = this.hoverCharacter.stats.diceTypeMods; for (int i = 0; i < this.diceTypeMods.Count; i++) { if (this.diceTypeMods[i] == type) { int num2 = this.diceCountMods[i]; if (num2 < 0) { num2 *= -1; } int num3 = this.diceSideMods[i]; int num4 = 0; for (int j = 0; j < num2; j++) { num4 += Random.Range(1, num3 + 1); } if (this.diceCountMods[i] < 0) { num4 *= -1; } num += num4; } } return num; } // Token: 0x06000F91 RID: 3985 RVA: 0x0012D084 File Offset: 0x0012B284 private void FixedUpdate() { if (Records.x.partySailing) { this.Positions(); } } // Token: 0x06000F92 RID: 3986 RVA: 0x0012D098 File Offset: 0x0012B298 private void LateUpdate() { if (!Records.x.partySailing) { this.Positions(); } } // Token: 0x06000F93 RID: 3987 RVA: 0x0012D0AC File Offset: 0x0012B2AC private void Positions() { if (this.hoverCharacter) { if (this.stopPlaying) { this.currIndex = -1; } if (!this.animator.enabled || !this.animator.GetBool("On")) { this.animator.enabled = true; this.animator.SetBool("On", true); } if (this.fullCard && Records.x.InCombat(false)) { this.SetHealth(); } Vector3 anchoredPosition3D = this.statusRT.anchoredPosition3D; if ((this.t >= 1.3f || anchoredPosition3D.y >= this.target - 0.2f) && this.target != 0f && this.t > 0f) { this.t = 0f; this.start = anchoredPosition3D.y; this.target = 0f; } else if (anchoredPosition3D.y <= 0f && this.t > 0f) { this.t = 0f; this.start = anchoredPosition3D.y; this.target = this.statusRT.sizeDelta.y - 20.15f; } else { this.t += Time.deltaTime / 3f; anchoredPosition3D.y = Mathf.Lerp(this.start, this.target, this.t); this.statusRT.anchoredPosition3D = anchoredPosition3D; } if (this.hoverCharacter.dead || this.hoverCharacter != Links.x.gameplay.gameCardCharacter) { this.EndHover(this.hoverCharacter, false); } } if (this.characterName.color.a > 0f && this.body) { float num = 0f; if (!Links.x.worldCamera.orthographic) { num = -0.1f; } if (this.controlsText.text == "" && this.status.text == "") { num += 0.15f; } if (this.controlsText.text == "" || this.status.text == "") { num += 0.15f; } if (this.body.character) { if (this.body.character.statusRing) { num -= 0.5f; } if (this.body.character.isBoro) { num += 0.01f; } } if (Links.x.joy && Records.x.pocketPause) { num -= 1f; } Vector3 vector = Vector3.zero; this.body.GetBounds(); vector = this.body.bounds.center + new Vector3(0f, this.body.bounds.extents.y / 2f, 0f); Vector3 vector2 = Links.x.worldCamera.WorldToScreenPoint(vector + new Vector3(0f, 1f - num, 0f)); vector2.z = 0f; vector2.x = vector2.x * (1920f / (float)Screen.width) - 960f; vector2.y = vector2.y * (Links.x.canvasRT.sizeDelta.y / (float)Screen.height) - Links.x.canvasRT.sizeDelta.y / 2f; this.rt.localPosition = vector2; } } // Token: 0x06000F94 RID: 3988 RVA: 0x0012D47B File Offset: 0x0012B67B public void SetPortrait(RenderTexture t) { if (t != null) { this.portrait.texture = t; } } // Token: 0x06000F95 RID: 3989 RVA: 0x0012D494 File Offset: 0x0012B694 public void StartHover(Character character, string health) { this.currIndex = -1; this.updateTime = Time.realtimeSinceStartup + 0.14f; this.str.Clear(); if (this.portraitCharacterToRemove && this.portraitCharacterToRemove.npc) { if (this.fullCard) { Links.x.renderPortraits.RemoveCharacter(this.portraitCharacterToRemove, "", null); } this.portraitCharacterToRemove = null; } if (character) { if (character.stats.xmlName.Contains("Boro") && !character.isBoro && !character.hasActions && !character.stunned && Records.x.BoroInParty()) { Records.x.ShowBoroStats(character); return; } this.body = character.body; if (character.party && this.fullCard) { Links.x.renderPortraits.RemoveCharacter(character, character.stats.xmlName, null); } } bool flag = false; if (Records.x.pocketPause && Links.x.pocketWheel.Charming()) { flag = true; } if (this.coroutine != null) { base.StopCoroutine(this.coroutine); this.coroutine = null; } if (Records.x.mainCharacterDead || !character) { return; } this.hoverCharacter = character; if (this.hoverCharacter.isBoro) { this.str.Append(Records.x.boroName); } else { this.str.Append(this.hoverCharacter.stats.GetName()); } if (this.hoverCharacter.stats.initiateDialogue >= 10 && !this.hoverCharacter.isBoro && this.hoverCharacter.stats.characterRow._GenericName != this.hoverCharacter.stats.GetName()) { this.str.Append(", "); this.str.Append(this.hoverCharacter.stats.characterRow._GenericName); } if (this.hoverCharacter.stunned) { if (this.hoverCharacter.stats.xmlName.Contains("LocalGraveKeeper")) { this.str.Append(" (Dormant)"); } else { this.str.Append(" (Stunned)"); } } if (this.hoverCharacter.sleeping && !this.hoverCharacter.stunned) { this.str.Append(" (Asleep)"); } if (this.hoverCharacter.dayNightVanishing && !this.hoverCharacter.stunned && !this.hoverCharacter.sleeping && !Records.x.pocketPause && !this.hoverCharacter.hasActions) { this.str.Append(" (Busy)"); } this.status.text = ""; this.characterName.text = this.str.ToString(); this.savedHealth = character.stats.HealthCurrent(); this.str.Clear(); this.controlsText.spriteAsset = Links.x.GetSpriteSheetAsset(Links.x.gameplay.currentSpriteSheetAsset); bool flag2 = false; if (Links.x.joy) { flag2 = true; } if (!character.stunned || (character.stunned && Records.x.kill)) { if (flag) { if ((this.hoverCharacter.stats.characterRow._Race == "Forest" || this.hoverCharacter.stats.characterRow._Race == "Fish" || this.hoverCharacter.stats.characterRow._Race == "Shroom") && !this.hoverCharacter.stats.xmlName.Contains("Cat")) { string text = "CharmShroom"; if (character.stats.race == "Forest") { text = "CharmForest"; } if (character.stats.race == "Fish") { text = "CharmFish"; } float num = Links.x.main.stats.Charming(text, true); float num2 = this.hoverCharacter.stats.CharmResistance(false, (float)this.hoverCharacter.stats.HealthCurrent()); num2 += Links.x.main.stats.SummonModCharm(); float num3 = num - num2; if (Links.x.combat.CanAttackTarget(this.hoverCharacter)) { string text2 = "Bind"; if (num3 <= 2f) { text2 = "Roll to bind"; } if (this.hoverCharacter.stats.characterRow._Race == "Forest") { text2 += " (Forest)"; } if (this.hoverCharacter.stats.characterRow._Race == "Fish") { text2 += " (Fish)"; } if (this.hoverCharacter.stats.characterRow._Race == "Shroom") { text2 += " (Shroom)"; } if (Links.x.mk || Links.x.pocketWheel.targetSelection) { this.str.Append(text2); this.str.Append(" "); if (Links.x.mk) { this.str.Append(" "); } else { this.str.Append(" "); } } else { this.str.Append(" "); } } else { string text3 = "Will resist"; if (num3 < 2f) { text3 = "Barely resist"; } if (Records.x.partySailing) { text3 = "Cannot bind at sea"; } if (this.hoverCharacter.stats.characterRow._Race == "Forest") { text3 += " (Forest)"; } if (this.hoverCharacter.stats.characterRow._Race == "Fish") { text3 += " (Fish)"; } if (this.hoverCharacter.stats.characterRow._Race == "Shroom") { text3 += " (Shroom)"; } if (Links.x.main.HasRosary() < 0) { text3 = "No charm bells"; } this.str.Append("\n"); this.str.Append(text3); this.str.Append(" "); } } else { this.str.Append("\nCannot bind "); } flag2 = true; } else if (character.hostility < 2 && !character.attackingUntilBribe && character.npc && !Records.x.pocketPause) { if (Links.x.hudControl.CharacterIsNear(character)) { if (!character.stats.animal && !character.sleeping && !character.dayNightVanishing && character.stats.dialogueFile != "" && character.IsSentient()) { this.str.Append("Talk "); if (Links.x.mk) { this.str.Append(" "); } else { this.str.Append(" "); } flag2 = false; } else { if (!character.sleeping && !character.stunned) { this.str.Append("\n(Cannot talk) "); } flag2 = true; } } else { if (character.stats.animal) { if (!character.dayNightVanishing) { this.str.Append("\n(Cannot talk) "); } } else if (character.IsSentient()) { this.str.Append("\n(Too far away to talk) "); } flag2 = true; } } else if ((character.hostility < 2 && !character.attackingUntilBribe) || Records.x.pocketPause) { if (Links.x.gameplay.spellTargetingParty && !character.npc) { if (!character.stats.animal && !character.sleeping && !character.dayNightVanishing && (Links.x.mk || Links.x.pocketWheel.targetSelection)) { this.str.Append("Cast Spell "); if (Links.x.mk) { this.str.Append(" "); } else { this.str.Append(" "); } } else { this.str.Append(" "); } flag2 = false; } else if (Links.x.gameplay.spellTargetingEnemy && character.npc) { if (!character.stats.animal && !character.sleeping && !character.dayNightVanishing && (Links.x.mk || Links.x.pocketWheel.targetSelection)) { this.str.Append("Cast Spell "); if (Links.x.mk) { this.str.Append(" "); } else { this.str.Append(" "); flag2 = false; } } else { this.str.Append(" "); } } else if (Links.x.combat.CanAttackTarget(character)) { if (Links.x.pocketWheel.targetSelection || Links.x.mk) { if (Links.x.pocketWheel.selected == "Heavy Attack") { flag2 = Links.x.mk; if ((this.hoverCharacter.currentPosition - Links.x.main.currentPosition).sqrMagnitude < 6.25f) { this.str.Append("Kick "); } else { this.str.Append("Charge "); } } else { if (Records.x.kill || character.ghost) { this.str.Append("Attack "); } else { this.str.Append("Stun "); } flag2 = false; } } if (Links.x.mk || Links.x.pocketWheel.targetSelection) { if (Links.x.mk) { this.str.Append(" "); } else { this.str.Append(" "); } } else { this.str.Append(" "); } } else if (!flag && Links.x.gameplay.attackingCharacter.CanAttack() && !Links.x.combat.inPocketAttack) { if (!Links.x.gameplay.attackingCharacter.HasAmmoOrMelee(Links.x.gameplay.attackingCharacter.invRow1, false)) { this.str.Append("\n(No ammo) "); } flag2 = true; } } } if (flag2) { this.controlsText.text = this.str.ToString(); } else { this.controlsText.text = ""; } if (this.controlsText.text != "") { this.scrollViewRT.anchoredPosition3D = new Vector3(2.74f, -8.5f, 0f); } else { this.scrollViewRT.anchoredPosition3D = new Vector3(2.74f, 15.7f, 0f); } this.vignetteRT.sizeDelta = new Vector2(this.characterName.preferredWidth + 20f, this.vignetteRT.sizeDelta.y); if (Links.x.main) { this.ToggleState(true); } this.hp.text = ""; if (this.fullCard) { this.SetHealth(); } if (this.fullCard) { if (!this.hoverCharacter.ghost) { Links.x.renderPortraits.AddCharacter(this.hoverCharacter, this.hoverCharacter.stats.xmlName, null, false, null, null, this, null); if (this.texturesIdle != null) { this.portrait.texture = this.texturesIdle; } } else { this.portrait.texture = this.ghostTexture; } } if (this.animator.enabled) { float normalizedTime = this.animator.GetCurrentAnimatorStateInfo(0).normalizedTime; if (!this.animator.GetCurrentAnimatorStateInfo(0).IsName("GameCardOff")) { this.animator.Play("GameCardIdle", -1, 0f); } else { this.animator.Play("GameCardOn"); } } else { this.animator.enabled = true; this.animator.Play("GameCardOn"); } this.animator.SetBool("On", true); this.targetAlpha = 0f; } // Token: 0x06000F96 RID: 3990 RVA: 0x0012E492 File Offset: 0x0012C692 public RenderTexture GetTexturePortrait() { if (this.texturesIdle != null) { return this.texturesIdle; } return null; } // Token: 0x06000F97 RID: 3991 RVA: 0x0012E4AC File Offset: 0x0012C6AC private void SetHealth() { if (Records.x.InCombat(false) && !this.hoverCharacter.stunned && !this.hoverCharacter.dead) { this.healthBar.gameObject.SetActive(true); this.healthBarBack.gameObject.SetActive(true); this.healthBar.fillAmount = (float)this.hoverCharacter.stats.HealthCurrent() / (float)this.hoverCharacter.stats.HealthMax(); this.fatigueBar.gameObject.SetActive(true); this.fatigueBarBack.gameObject.SetActive(true); } else { this.healthBar.gameObject.SetActive(false); this.healthBarBack.gameObject.SetActive(false); this.fatigueBar.gameObject.SetActive(false); this.fatigueBarBack.gameObject.SetActive(false); } if (this.hoverCharacter.stats.HealthCurrent() <= 0) { this.fatigueBar.fillAmount = 0f; return; } this.fatigueBar.fillAmount = this.hoverCharacter.stats.stamina / this.hoverCharacter.stats.maxStamina; } // Token: 0x06000F98 RID: 3992 RVA: 0x0012E5F0 File Offset: 0x0012C7F0 public void EndHover(Character character, bool wait) { if (character.stats.xmlName.Contains("Boro") && !character.isBoro && Records.x.BoroInParty() && Links.x.hudControl.boroHoverCard.activeSelf) { this.hoverCharacter = null; Links.x.hudControl.CloseBoroHoverCard(); return; } if (this.hoverCharacter == character && wait) { this.coroutine = this.StartEnd(); base.StartCoroutine(this.coroutine); } else { this.EndHoverContinued(); } if (this.hoverCharacter) { this.portraitCharacterToRemove = this.hoverCharacter; } this.hoverCharacter = null; } // Token: 0x06000F99 RID: 3993 RVA: 0x0012E6A8 File Offset: 0x0012C8A8 public void EndHoverContinued() { this.targetAlpha = 1f; if (this.hoverCharacter) { this.portraitCharacterToRemove = this.hoverCharacter; } float num = this.animator.GetCurrentAnimatorStateInfo(0).normalizedTime; if (!this.animator.GetCurrentAnimatorStateInfo(0).IsName("GameCardOn")) { num = 1f; } if (this.animator.GetCurrentAnimatorStateInfo(0).IsName("GameCardOn") || this.animator.GetCurrentAnimatorStateInfo(0).IsName("GameCardIdle")) { this.animator.Play("GameCardOff", 0, 1f - num); } this.animator.SetBool("On", false); this.AnimationDone(); } // Token: 0x06000F9A RID: 3994 RVA: 0x0012E774 File Offset: 0x0012C974 public void End() { this.targetAlpha = 1f; this.ToggleState(false); if (this.hoverCharacter) { this.portraitCharacterToRemove = this.hoverCharacter; } this.hoverCharacter = null; float num = this.animator.GetCurrentAnimatorStateInfo(0).normalizedTime; if (!this.animator.GetCurrentAnimatorStateInfo(0).IsName("GameCardOn")) { num = 1f; } if (this.animator.GetCurrentAnimatorStateInfo(0).IsName("GameCardOn") || this.animator.GetCurrentAnimatorStateInfo(0).IsName("GameCardIdle")) { this.animator.Play("GameCardOff", 0, 1f - num); } this.animator.SetBool("On", false); } // Token: 0x06000F9B RID: 3995 RVA: 0x0012E848 File Offset: 0x0012CA48 private IEnumerator StartEnd() { yield return new WaitForSeconds(0.06f); if (!this.hoverCharacter) { this.ToggleState(false); this.EndHoverContinued(); } yield break; } // Token: 0x06000F9C RID: 3996 RVA: 0x0012E858 File Offset: 0x0012CA58 public void AnimationDone() { this.ToggleState(false); this.animator.enabled = false; if (this.portraitCharacterToRemove && this.portraitCharacterToRemove.npc && !this.portraitCharacterToRemove.ghost && !this.portraitCharacterToRemove.party) { if (this.fullCard) { Links.x.renderPortraits.RemoveCharacter(this.portraitCharacterToRemove, "", null); } this.portraitCharacterToRemove = null; } } // Token: 0x06000F9D RID: 3997 RVA: 0x0012E8D8 File Offset: 0x0012CAD8 public void ToggleState(bool state) { for (int i = 0; i < this.images.Count; i++) { this.images[i].enabled = state; } for (int j = 0; j < this.texts.Count; j++) { this.texts[j].enabled = state; } this.portrait.enabled = state; } // Token: 0x040019A7 RID: 6567 public Animator animator; // Token: 0x040019A8 RID: 6568 public RectTransform rt; // Token: 0x040019A9 RID: 6569 public RectTransform scrollViewRT; // Token: 0x040019AA RID: 6570 public RectTransform vignetteRT; // Token: 0x040019AB RID: 6571 public float offset; // Token: 0x040019AC RID: 6572 public List images = new List(); // Token: 0x040019AD RID: 6573 public List texts = new List(); // Token: 0x040019AE RID: 6574 public RawImage portrait; // Token: 0x040019AF RID: 6575 public TextMeshProUGUI characterName; // Token: 0x040019B0 RID: 6576 public TextMeshProUGUI hp; // Token: 0x040019B1 RID: 6577 public TextMeshProUGUI dmg; // Token: 0x040019B2 RID: 6578 public TextMeshProUGUI status; // Token: 0x040019B3 RID: 6579 public TextMeshProUGUI controlsText; // Token: 0x040019B4 RID: 6580 public Character hoverCharacter; // Token: 0x040019B5 RID: 6581 public Image healthBar; // Token: 0x040019B6 RID: 6582 public Image healthBarBack; // Token: 0x040019B7 RID: 6583 public Image fatigueBar; // Token: 0x040019B8 RID: 6584 public Image fatigueBarBack; // Token: 0x040019B9 RID: 6585 private List effects; // Token: 0x040019BA RID: 6586 private List diceCountMods; // Token: 0x040019BB RID: 6587 private List diceSideMods; // Token: 0x040019BC RID: 6588 private List diceTypeMods; // Token: 0x040019BD RID: 6589 public Sprite emptySprite; // Token: 0x040019BE RID: 6590 public RenderTexture texturesIdle; // Token: 0x040019BF RID: 6591 private float updateTime; // Token: 0x040019C0 RID: 6592 public int currIndex; // Token: 0x040019C1 RID: 6593 private IEnumerator coroutine; // Token: 0x040019C2 RID: 6594 private float closeTime; // Token: 0x040019C3 RID: 6595 public bool needToScroll; // Token: 0x040019C4 RID: 6596 private float t; // Token: 0x040019C5 RID: 6597 private float start; // Token: 0x040019C6 RID: 6598 private float target; // Token: 0x040019C7 RID: 6599 public RectTransform statusRT; // Token: 0x040019C8 RID: 6600 private StringFast str = new StringFast(64); // Token: 0x040019C9 RID: 6601 public int savedHealth; // Token: 0x040019CA RID: 6602 public bool stopPlaying; // Token: 0x040019CB RID: 6603 public Texture ghostTexture; // Token: 0x040019CC RID: 6604 public CanvasGroup badgesCanvasGroup; // Token: 0x040019CD RID: 6605 public float targetAlpha; // Token: 0x040019CE RID: 6606 public ItemCard itemCard; // Token: 0x040019CF RID: 6607 private Character portraitCharacterToRemove; // Token: 0x040019D0 RID: 6608 public bool fullCard; // Token: 0x040019D1 RID: 6609 private Body body; }