예제 #1
0
    protected virtual void ShowUI()
    {
        if (other.Count <= 1)
        {
            expectationUI.transform.Find("Left").gameObject.SetActive(false);
            expectationUI.transform.Find("Right").gameObject.SetActive(false);
        }
        foreach (var o in other)
        {
            var             a               = o.GetComponent <CharacterStatus>().attributes;
            var             atk             = a.Find(d => d.eName == "atk").value.ToString();
            var             def             = a.Find(d => d.eName == "def").value.ToString();
            var             dex             = a.Find(d => d.eName == "dex").value.ToString();
            var             currentHp       = a.Find(d => d.eName == "hp").value.ToString();
            var             currentMp       = a.Find(d => d.eName == "mp").value.ToString();
            FinalDamageBuff finalDamageBuff = (FinalDamageBuff)character.GetComponent <Unit>().Buffs.Find(b => b.GetType() == typeof(FinalDamageBuff));
            var             expectation     = DamageSystem.Expect(character, o, damage, hit, hoverRange == 0, finalDamageBuff == null ? 0 : finalDamageBuff.Factor);
            var             finalRate       = DamageSystem.HitRateSystem(character, o, skillRate).ToString();

            if (originSkill != null && originSkill is AttackSkill)
            {
                var originAttackSkill = (AttackSkill)originSkill;
                expectation += DamageSystem.Expect(character, o, originAttackSkill.damage, originAttackSkill.hit, hoverRange == 0, finalDamageBuff == null ? 0 : finalDamageBuff.Factor);
                finalRate    = DamageSystem.HitRateSystem(character, o, (skillRate * hit + originAttackSkill.skillRate * originAttackSkill.hit) / (hit + originAttackSkill.hit)).ToString();
            }

            string roleName     = o.GetComponent <CharacterStatus>().roleCName.Replace(" ", "");
            string roleIdentity = o.GetComponent <CharacterStatus>().IsEnemy(character.GetComponent <CharacterStatus>()) ? "" : o.GetComponent <CharacterStatus>().identity;
            string roleState    = o.GetComponent <Unit>().UnitEnd ? "结束" : "待机";
            string hp           = currentHp;
            string mp           = currentMp;
            string hpMax        = a.Find(d => d.eName == "hp").valueMax.ToString();
            string mpMax        = a.Find(d => d.eName == "mp").valueMax.ToString();
            string effectTitle  = expectation > 0 ? "损伤" : "恢复";
            string effectInfo   = Mathf.Abs(expectation).ToString();
            string rateInfo     = finalRate + "%";
            string atkInfo      = atk;
            string defInfo      = def;
            string dexInfo      = dex;

            expectationList.Add(new KeyValuePair <CharacterStatus, string[]>(o.GetComponent <CharacterStatus>(),
                                                                             new string[13] {
                roleName,
                roleIdentity,
                roleState,
                hp,
                mp,
                hpMax,
                mpMax,
                effectInfo,
                rateInfo,
                atkInfo,
                defInfo,
                dexInfo,
                effectTitle
            }));
        }

        RefreshExpectionData(0);
        pointer.transform.SetParent(expectationList[pointerIterator].Key.transform);
        pointer.transform.localPosition = expectationList[pointerIterator].Key.arrowPosition;
        pointer.SetActive(true);
        expectationUI.SetActive(true);
    }