Exemplo n.º 1
0
        private void DamagePopup(Transform target, SkillDamage damage, int uniqId)
        {
            if (damage.isResist == false)
            {
                switch (damage.valueTarget)
                {
                    case SkillValueTarget.SLEEP:
                        SleepPopup(uniqId);
                        break;
                    default:
                        string color = SkillsDicionary.SkillColor(damage.valueTarget);
                        string damageText = $"<color={color}>{damage.damage}";
                        GameObject text =
                            Instantiate(Resources.Load("Prefabs/Text/DamageText", typeof(GameObject)) as GameObject);
                        var pos = target.GetComponent<Transform>().localPosition;
                        pos = PopupPos(pos);

                        text.GetComponent<Transform>().localPosition = pos;
                        var tMesh = text.GetComponent<TextMeshPro>();
                        tMesh.rectTransform.localScale = new Vector3(1.4f, 1.4f);
                        tMesh.rectTransform.pivot = new Vector2(0, 0);
                        tMesh.color = new Color(tMesh.color.r, tMesh.color.g, tMesh.color.b, 0);
                        tMesh.text = damageText;
                        TextPopUpFadeInOut(tMesh, text);
                        break;
                }
            }
            else
            {
                ResistPopup(target);
            }
        }
Exemplo n.º 2
0
        public void PoisonText(BattlerSerializable battler, int value, bool isDead)
        {
            StringBuilder sb         = new StringBuilder();
            var           nameColor  = GuiDictionary.GetBattlerNameColor(battler.battlerType);
            var           skillColor = SkillsDicionary.SkillColor(SkillValueTarget.TARGET_POISON);
            var           texts      = new List <string>();

            sb.Append($"<color={nameColor}>{battler.name}は</color><color={skillColor}>{value}</color>の毒ダメージを受けた");
            texts.Add(sb.ToString());
            if (isDead)
            {
                texts.Add(DeadText(battler));
            }
            AddText(texts);
        }
Exemplo n.º 3
0
        public void AddDamageText(BattlerSerializable fromBattler, string skillName, List <SkillDamages> damageses)
        {
            List <string> texts = new List <string>();
            StringBuilder sb    = new StringBuilder();

            var fromColor = GuiDictionary.GetBattlerNameColor(fromBattler.battlerType);

            sb.Append($"<color={fromColor}>").Append(fromBattler.name).Append("</color>の").Append(skillName)
            .Append("!");
            texts.Add(sb.ToString());
            List <BattlerSerializable> deadBattlers = new List <BattlerSerializable>();

            damageses.ForEach(x =>
            {
                sb.Clear();
                var toBattler =
                    BattlerDictionary.GetBattlerByUniqId(x.targetUniqId);
                var toColor = GuiDictionary.GetBattlerNameColor(toBattler.battlerType);
                if (x.isHit)
                {
                    x.SkillDamage.ForEach(damage =>
                    {
                        var targetText = SkillsDicionary.SkillAnnounceValueTargetText(damage.valueTarget);
                        if (SkillsDicionary.IsDamageSkill(damage.valueTarget))
                        {
                            sb.Clear();
                            var damageColor = SkillsDicionary.SkillColor(damage.valueTarget);
                            sb.Append($"<color={toColor}>").Append(toBattler.name).Append("</color>に")
                            .Append($"<color={damageColor}>").Append(damage.damage)
                            .Append($"</color>の{targetText}");
                            texts.Add(sb.ToString());
                        }
                        else
                        {
                            sb.Clear();
                            if (damage.damage != 0)
                            {
                                sb.Append($"<color={toColor}>").Append(toBattler.name).Append("</color>は")
                                .Append($"{targetText}");
                                texts.Add(sb.ToString());
                            }
                            else
                            {
                                var missText = SkillsDicionary.SkillAnnounceStateMissText(damage.valueTarget);
                                sb.Append($"<color={toColor}>").Append(toBattler.name).Append("</color>は")
                                .Append($"{missText}");
                                texts.Add(sb.ToString());
                            }
                        }
                    });
                }
                else
                {
                    sb.Append($"<color={toColor}>").Append(toBattler.name).Append("</color>は回避した!");
                    texts.Add(sb.ToString());
                }

                if (x.isDead && deadBattlers.Find(battler => battler == toBattler) == null)
                {
                    deadBattlers.Add(toBattler);
                }
            });
            deadBattlers.ForEach(battler => { texts.Add(DeadText(battler)); });
            AddText(texts);
        }