void LateUpdate()
    {
        if (SharedUnits.Count == 0 || SharedUnits[0] == null)
        {
            return;
        }

        Vector3 screenPoint = RaidSceneManager.DungeonPositionToScreen(SharedUnits[0].RectTransform.position);

        rectTransform.position = new Vector3(rectTransform.position.x, screenPoint.y, rectTransform.position.z);
    }
    private void Update()
    {
        RectTransform.localPosition = Vector3.SmoothDamp(RectTransform.localPosition, targetPosition, ref velocity, smoothTime);

        if (followBone)
        {
            if (targetBone != null && targetUnit != null)
            {
                Vector3 screenPosition = RaidSceneManager.DungeonPositionToScreen
                                             (targetUnit.RectTransform.TransformPoint(targetBone.WorldX, targetBone.WorldY, 0));
                RectTransform.position = new Vector3(screenPosition.x, RectTransform.position.y, RectTransform.position.z);
            }
        }
    }
    public void Show(FormationUnit monsterUnit)
    {
        Slot = monsterUnit.OverlaySlot;

        if (IsDisabled)
        {
            return;
        }

        Vector3 screenPoint = RaidSceneManager.DungeonPositionToScreen(monsterUnit.RectTransform.position);

        if (monsterUnit.Team == Team.Monsters)
        {
            targetPosition = screenPoint.x;
        }

        animator.SetBool("IsActive", true);

        if (RaidSceneManager.BattleGround.Round.TurnType == TurnType.HeroTurn)
        {
            if (Slot.TargetUnit.IsTargetable && RaidSceneManager.RaidPanel.SelectedUnit != null)
            {
                var combatSkill = (CombatSkill)RaidSceneManager.RaidPanel.bannerPanel.skillPanel.SelectedSkill;
                if (combatSkill != null)
                {
                    BattleSolver.CalculateSkillPotential(RaidSceneManager.RaidPanel.SelectedUnit, monsterUnit, combatSkill);
                    if (BattleSolver.HeroActionInfo.IsValid)
                    {
                        UpdateTooltip(monsterUnit, BattleSolver.HeroActionInfo.ChanceToHit, BattleSolver.HeroActionInfo.ChanceToCrit,
                                      BattleSolver.HeroActionInfo.MinDamage, BattleSolver.HeroActionInfo.MaxDamage);
                        return;
                    }
                }
            }
        }

        UpdateTooltiop(monsterUnit);
    }
    private void LateUpdate()
    {
        Vector3 screenPoint = RaidSceneManager.DungeonPositionToScreen(TargetUnit.RectTransform.position);

        RectTransform.position = new Vector3(screenPoint.x, screenPoint.y, RectTransform.position.z);
    }
Exemple #5
0
    public void ShowPopupMessage(FormationUnit unit, PopupMessageType type, string parameter = "", float ripOffset = 0)
    {
        PopupMessage popupMessage = Instantiate(popupText.gameObject).GetComponent<PopupMessage>();
        popupMessage.RectTransform.SetParent(eventRect, false);
        Spine.Bone bone = unit.CurrentState.Skeleton.FindBone("fxhead") ?? unit.CurrentState.Skeleton.FindBone("fxskill");

        switch(type)
        {
            case PopupMessageType.DeathBlow:
                popupMessage.SetColor(PopupColors["pop_text_deathblow"], PopupColors["pop_text_outline_deathblow"]);
                popupMessage.SetMessage(LocalizationManager.GetString("str_ui_deathblow"));
                popupMessage.SetRotation(new Vector3(0, 0, 8));
                break;
            case PopupMessageType.DeathsDoor:
                bone = unit.CurrentState.Skeleton.FindBone("fxchest");
                popupMessage.SetColor(PopupColors["pop_text_death_avoided"], PopupColors["pop_text_outline_death_avoided"]);
                popupMessage.SetMessage(LocalizationManager.GetString("str_ui_death_avoided"));
                popupMessage.SetIcon("poptext_death_avoided");
                popupMessage.SetRotation(new Vector3(0, 0, 8));
                FMODUnity.RuntimeManager.PlayOneShot("event:/general/combat/deaths_door");
                break;
            case PopupMessageType.HeartAttack:
                popupMessage.SetColor(PopupColors["pop_text_heart_attack"], PopupColors["pop_text_outline_heart_attack"]);
                popupMessage.SetMessage(LocalizationManager.GetString("str_ui_heart_attack"));
                popupMessage.SetOffset(new Vector3(0, ripOffset, 0));
                FMODUnity.RuntimeManager.PlayOneShot("event:/general/char/heart_attack");
                break;
            case PopupMessageType.RetreatFailed:
                popupMessage.SetColor(PopupColors["pop_text_heart_attack"], PopupColors["pop_text_outline_heart_attack"]);
                popupMessage.SetMessage(LocalizationManager.GetString("retreat_fail_announcement"));
                popupMessage.SetOffset(new Vector3(0, ripOffset, 0));
                FMODUnity.RuntimeManager.PlayOneShot("event:/general/combat/retreat_fail");
                break;
            case PopupMessageType.Miss:
                popupMessage.SetColor(PopupColors["pop_text_miss"], PopupColors["pop_text_outline_miss"]);
                popupMessage.SetMessage(LocalizationManager.GetString("str_ui_miss"));
                popupMessage.SetOffset(new Vector3(0, ripOffset, 0));
                break;
            case PopupMessageType.Dodge:
                popupMessage.SetColor(PopupColors["pop_text_miss"], PopupColors["pop_text_outline_miss"]);
                popupMessage.SetMessage(LocalizationManager.GetString("str_ui_dodge"));
                popupMessage.SetRotation(new Vector3(0, 0, 4));
                popupMessage.SetOffset(new Vector3(0, ripOffset, 0));
                break;
            case PopupMessageType.ZeroDamage:
                popupMessage.SetColor(PopupColors["pop_text_no_damage"], PopupColors["pop_text_outline_no_damage"]);
                popupMessage.SetMessage(LocalizationManager.GetString("str_ui_no_damage"));
                popupMessage.SetOffset(new Vector3(0, ripOffset, 0));
                break;
            case PopupMessageType.Damage:
                popupMessage.SetColor(PopupColors["pop_text_damage"], PopupColors["pop_text_outline_damage"]);
                popupMessage.SetMessage(parameter);
                popupMessage.SetOffset(new Vector3(0, ripOffset, 0));
                popupMessage.SkillMessage.fontSize = 70;
                break;
            case PopupMessageType.CritDamage:
                popupMessage.SetColor(PopupColors["pop_text_crit_damage"], PopupColors["pop_text_outline_crit_damage"]);
                popupMessage.SetMessage(LocalizationManager.GetString("str_ui_crittxt") + "\n" + parameter);
                popupMessage.SetOffset(new Vector3(0, ripOffset, 0));
                popupMessage.SkillMessage.fontSize = 72;
                break;
            case PopupMessageType.Stress:
                popupMessage.SetColor(PopupColors["pop_text_stress_damage"], PopupColors["pop_text_outline_stress_damage"]);
                popupMessage.SetMessage(parameter);
                FMODUnity.RuntimeManager.PlayOneShot("event:/general/status/stress_up");
                popupMessage.SkillMessage.fontSize = 70;
                break;
            case PopupMessageType.StressHeal:
                popupMessage.SetColor(PopupColors["pop_text_stress_reduce"], PopupColors["pop_text_outline_stress_reduce"]);
                popupMessage.SetMessage(parameter);
                FMODUnity.RuntimeManager.PlayOneShot("event:/general/status/stress_down");
                popupMessage.SkillMessage.fontSize = 70;
                break;
            case PopupMessageType.Heal:
                popupMessage.SetColor(PopupColors["pop_text_heal"], PopupColors["pop_text_outline_heal"]);
                popupMessage.SetMessage(parameter);
                popupMessage.SkillMessage.fontSize = 70;
                break;
            case PopupMessageType.CritHeal:
                popupMessage.SetColor(PopupColors["pop_text_heal_crit"], PopupColors["pop_text_outline_heal_crit"]);
                popupMessage.SetMessage(parameter);
                popupMessage.SkillMessage.fontSize = 72;
                break;
            case PopupMessageType.Pass:
                popupMessage.SetColor(PopupColors["pop_text_pass"], PopupColors["pop_text_outline_pass"]);
                popupMessage.SetMessage(LocalizationManager.GetString("str_ui_pass"));
                FMODUnity.RuntimeManager.PlayOneShot("event:/general/char/pass");
                break;
            case PopupMessageType.Tagged:
                popupMessage.SetColor(PopupColors["pop_text_tagged"], PopupColors["pop_text_outline_tagged"]);
                popupMessage.SetMessage(LocalizationManager.GetString("str_ui_tagged"));
                popupMessage.SetIcon("poptext_tagged");
                FMODUnity.RuntimeManager.PlayOneShot("event:/general/status/marked");
                break;
            case PopupMessageType.Untagged:
                popupMessage.SetColor(PopupColors["pop_text_tagged"], PopupColors["pop_text_outline_tagged"]);
                popupMessage.SetMessage(LocalizationManager.GetString("str_ui_untagged"));
                FMODUnity.RuntimeManager.PlayOneShot("event:/general/status/marked");
                popupMessage.SetRotation(new Vector3(0, 0, 6));
                break;
            case PopupMessageType.Bleed:
                popupMessage.SetColor(PopupColors["pop_text_bleed"], PopupColors["pop_text_outline_bleed"]);
                popupMessage.SetMessage(LocalizationManager.GetString("str_ui_bleed"));
                popupMessage.SetIcon("poptext_bleed");
                FMODUnity.RuntimeManager.PlayOneShot("event:/general/status/bleed_onset");
                break;
            case PopupMessageType.Poison:
                popupMessage.SetColor(PopupColors["pop_text_poison"], PopupColors["pop_text_outline_poison"]);
                popupMessage.SetMessage(LocalizationManager.GetString("str_ui_poison"));
                popupMessage.SetIcon("poptext_poison");
                FMODUnity.RuntimeManager.PlayOneShot("event:/general/status/poison_onset");
                break;
            case PopupMessageType.Buff:
                popupMessage.SetColor(PopupColors["pop_text_buff"], PopupColors["pop_text_outline_buff"]);
                popupMessage.SetMessage(LocalizationManager.GetString("str_ui_buff"));
                popupMessage.SetIcon("poptext_buff");
                FMODUnity.RuntimeManager.PlayOneShot("event:/general/status/buff");
                break;
            case PopupMessageType.Debuff:
                popupMessage.SetColor(PopupColors["pop_text_debuff"], PopupColors["pop_text_outline_debuff"]);
                popupMessage.SetMessage(LocalizationManager.GetString("str_ui_debuff"));
                popupMessage.SetIcon("poptext_debuff");
                FMODUnity.RuntimeManager.PlayOneShot("event:/general/status/debuff");
                break;
            case PopupMessageType.Stunned:
                popupMessage.SetColor(PopupColors["pop_text_stun"], PopupColors["pop_text_outline_stun"]);
                popupMessage.SetMessage(LocalizationManager.GetString("str_ui_stun"));
                FMODUnity.RuntimeManager.PlayOneShot("event:/general/status/stun_onset");
                break;
            case PopupMessageType.Unstun:
                popupMessage.SetColor(PopupColors["pop_text_stun_clear"], PopupColors["pop_text_outline_stun_clear"]);
                popupMessage.SetMessage(LocalizationManager.GetString("str_ui_stun"));
                FMODUnity.RuntimeManager.PlayOneShot("event:/general/status/stun_off");
                break;
            case PopupMessageType.Cured:
                popupMessage.SetColor(PopupColors["pop_text_cured"], PopupColors["pop_text_outline_cured"]);
                popupMessage.SetMessage(LocalizationManager.GetString("str_ui_cured"));
                FMODUnity.RuntimeManager.PlayOneShot("event:/general/status/cured");
                break;
            case PopupMessageType.BleedResist:
                if(unit.Character.DisplayModifier != null && unit.Character.DisplayModifier.DisabledPopups.Contains("resist"))
                {
                    Destroy(popupMessage.gameObject);
                    return;
                }
                popupMessage.SetColor(PopupColors["pop_text_bleed_resist"], PopupColors["pop_text_outline_bleed_resist"]);
                popupMessage.SetMessage(LocalizationManager.GetString("str_ui_bleed_resist"));
                popupMessage.SetIcon("poptext_bleed_resist");
                FMODUnity.RuntimeManager.PlayOneShot("event:/general/status/resist");
                break;
            case PopupMessageType.PoisonResist:
                if (unit.Character.DisplayModifier != null && unit.Character.DisplayModifier.DisabledPopups.Contains("resist"))
                {
                    Destroy(popupMessage.gameObject);
                    return;
                }
                popupMessage.SetColor(PopupColors["pop_text_poison_resist"], PopupColors["pop_text_outline_poison_resist"]);
                popupMessage.SetMessage(LocalizationManager.GetString("str_ui_blight_resist"));
                popupMessage.SetIcon("poptext_poison_resist");
                FMODUnity.RuntimeManager.PlayOneShot("event:/general/status/resist");
                break;
            case PopupMessageType.StunResist:
                if (unit.Character.DisplayModifier != null && unit.Character.DisplayModifier.DisabledPopups.Contains("resist"))
                {
                    Destroy(popupMessage.gameObject);
                    return;
                }
                popupMessage.SetColor(PopupColors["pop_text_stun_resist"], PopupColors["pop_text_outline_stun_resist"]);
                popupMessage.SetMessage(LocalizationManager.GetString("str_ui_stun_resist"));
                popupMessage.SetIcon("poptext_stun_resist");
                FMODUnity.RuntimeManager.PlayOneShot("event:/general/status/resist");
                break;
            case PopupMessageType.MoveResist:
                if (unit.Character.DisplayModifier != null && unit.Character.DisplayModifier.DisabledPopups.Contains("resist"))
                {
                    Destroy(popupMessage.gameObject);
                    return;
                }
                popupMessage.SetColor(PopupColors["pop_text_move_resist"], PopupColors["pop_text_outline_move_resist"]);
                popupMessage.SetMessage(LocalizationManager.GetString("str_ui_move_resist"));
                popupMessage.SetIcon("poptext_move_resist");
                FMODUnity.RuntimeManager.PlayOneShot("event:/general/status/resist");
                break;
            case PopupMessageType.DebuffResist:
                if (unit.Character.DisplayModifier != null && unit.Character.DisplayModifier.DisabledPopups.Contains("resist"))
                {
                    Destroy(popupMessage.gameObject);
                    return;
                }
                popupMessage.SetColor(PopupColors["pop_text_debuff_resist"], PopupColors["pop_text_outline_debuff_resist"]);
                popupMessage.SetMessage(LocalizationManager.GetString("str_ui_debuff_resist"));
                popupMessage.SetIcon("poptext_debuff_resist");
                FMODUnity.RuntimeManager.PlayOneShot("event:/general/status/resist");
                break;
            case PopupMessageType.DiseaseResist:
                if (unit.Character.DisplayModifier != null && unit.Character.DisplayModifier.DisabledPopups.Contains("resist"))
                {
                    Destroy(popupMessage.gameObject);
                    return;
                }
                popupMessage.SetColor(PopupColors["pop_text_disease_resist"], PopupColors["pop_text_outline_disease_resist"]);
                popupMessage.SetMessage(LocalizationManager.GetString("str_ui_disease_resist"));
                popupMessage.SetIcon("poptext_disease_resist");
                FMODUnity.RuntimeManager.PlayOneShot("event:/general/status/resist");
                break;
            case PopupMessageType.Disease:
                popupMessage.SetColor(PopupColors["pop_text_disease_resist"], PopupColors["pop_text_outline_disease_resist"]);
                popupMessage.SetMessage(parameter);
                popupMessage.SetOffset(new Vector3(0, 70, 0));
                FMODUnity.RuntimeManager.PlayOneShot("event:/general/char/quirk_neg");
                break;
            case PopupMessageType.PositiveQuirk:
                popupMessage.SetColor(PopupColors["notable"], Color.black);
                popupMessage.SetMessage(parameter);
                popupMessage.SetOffset(new Vector3(0, 70, 0));
                FMODUnity.RuntimeManager.PlayOneShot("event:/general/char/quirk_pos");
                break;
            case PopupMessageType.NegativeQuirk:
                popupMessage.SetColor(PopupColors["harmful"], Color.black);
                popupMessage.SetMessage(parameter);
                popupMessage.SetOffset(new Vector3(0, 70, 0));
                FMODUnity.RuntimeManager.PlayOneShot("event:/general/char/quirk_neg");
                break;
            case PopupMessageType.QuirkRemoved:
                popupMessage.SetColor(PopupColors["notable"], Color.black);
                popupMessage.SetMessage(parameter + LocalizationManager.GetString("curio_announcement_purge_format"));
                popupMessage.SetOffset(new Vector3(0, 70, 0));
                FMODUnity.RuntimeManager.PlayOneShot("event:/general/char/quirk_pos");
                break;
            case PopupMessageType.DiseaseCured:
                popupMessage.SetMessage(string.Format(LocalizationManager.GetString("str_ui_disease_cured"), parameter));
                popupMessage.SetColor(PopupColors["pop_text_disease_resist"], PopupColors["pop_text_outline_disease_resist"]);
                popupMessage.SetIcon("poptext_disease_resist");
                popupMessage.SetOffset(new Vector3(0, 30, 0));
                FMODUnity.RuntimeManager.PlayOneShot("event:/general/status/cured");
                break;
            case PopupMessageType.Guard:
                popupMessage.SetColor(PopupColors["pop_text_guard"], PopupColors["pop_text_outline_guard"]);
                popupMessage.SetMessage(LocalizationManager.GetString("str_ui_guard"));
                popupMessage.SetIcon("poptext_guard");
                FMODUnity.RuntimeManager.PlayOneShot("event:/general/status/guard");
                break;
            case PopupMessageType.Riposte:
                popupMessage.SetColor(PopupColors["pop_text_riposte"], PopupColors["pop_text_outline_riposte"]);
                popupMessage.SetMessage(LocalizationManager.GetString("str_ui_riposte"));
                popupMessage.SetIcon("poptext_riposte");
                FMODUnity.RuntimeManager.PlayOneShot("event:/general/status/riposte_enabled");
                break;
        }

        Vector3 screenPosition = RaidSceneManager.DungeonPositionToScreen(
            unit.RectTransform.TransformPoint(bone.WorldX, bone.WorldY, 0));
        popupMessage.RectTransform.position = new Vector3(screenPosition.x, screenPosition.y, 0);
        popupMessage.FollowXBone(bone, unit);
        popupMessage.gameObject.SetActive(true);
    }