Ejemplo n.º 1
0
    void CreateContent(Transform chess)
    {
        int  seg       = 3;
        int  texWidthA = 25;
        int  texWidthB = 35;
        int  texWidthC = 15;
        Rect startRect = new Rect();

        if (chess == leftChess)
        {
            startRect = posLeftContent;
        }
        else
        {
            startRect = posRightContent;
        }

        CharacterProperty cp  = chess.GetComponent <CharacterProperty>();
        CharacterPassive  cpp = chess.GetComponent <CharacterPassive>();

        GUI.DrawTexture(startRect, iconVault.GetIcon(BuffType.MoveRange, chess));
        Rect secCol = new Rect(startRect.x + iconWidth + seg, startRect.y - 10, 25, 30);

        GUI.Label(secCol, cp.BuffMoveRange.ToString(), numberStyle[1]);
        Rect thirdCol = new Rect(secCol.x + texWidthA, startRect.y, iconWidth, iconWidth);

        GUI.DrawTexture(thirdCol, iconVault.GetIcon(BuffType.AttackRange, chess));
        Rect forthCol = new Rect(thirdCol.x + iconWidth + seg, secCol.y, 25, 30);

        GUI.Label(forthCol, cp.BuffAtkRange.ToString(), numberStyle[1]);
        Rect fifthCol = new Rect(forthCol.x + texWidthA, startRect.y, iconWidth, iconWidth);

        GUI.DrawTexture(fifthCol, iconVault.GetIcon(BuffType.Attack, chess));
        Rect sixthCol = new Rect(fifthCol.x + iconWidth + seg, startRect.y - 24, 30, 44);

        if (cp.Damage <= 0)
        {
            cp.Damage = 0;
        }
        GUI.Label(sixthCol, cp.Damage.ToString(), numberStyle[2]);
        Rect seventhCol = new Rect(sixthCol.x + texWidthB, startRect.y, iconWidth, iconWidth);

        GUI.DrawTexture(seventhCol, iconVault.GetIcon(BuffType.Defense, chess));
        Rect eightCol = new Rect(seventhCol.x + iconWidth + seg, sixthCol.y, 50, 44);

        if (cp.Hp <= 0)
        {
            cp.Hp = 0;
        }
        GUI.Label(eightCol, cp.Hp.ToString(), numberStyle[2]);
        Rect ninthCol = new Rect(startRect.x, startRect.y + 35, iconWidth, iconWidth);

        GUI.DrawTexture(ninthCol, iconVault.GetIcon(BuffType.CriticalHit, chess));
        Rect tenthCol = new Rect(secCol.x, ninthCol.y - 4, texWidthC * 3, 24);

        if (cp.BuffCriticalHit <= 0)
        {
            cp.BuffCriticalHit = 0;
        }
        GUI.Label(tenthCol, cp.BuffCriticalHit.ToString(), numberStyle[0]);
        Rect elevthCol = new Rect(tenthCol.x + tenthCol.width, ninthCol.y, iconWidth, iconWidth);

        GUI.DrawTexture(elevthCol, iconVault.GetIcon(BuffType.SkillRate, chess));
        Rect twelvthCol = new Rect(elevthCol.x + iconWidth + seg, tenthCol.y, texWidthC * 3, 24);

        if (cp.BuffSkillRate <= 0)
        {
            cp.BuffSkillRate = 0;
        }
        GUI.Label(twelvthCol, cp.BuffSkillRate.ToString(), numberStyle[0]);
        Rect posPass = new Rect(twelvthCol.x + twelvthCol.width, elevthCol.y, iconWidth, iconWidth);

        if (cpp.PassiveAbility.Length > 0)
        {
            int sg = 0; int sq = 20;
            foreach (var pt in cpp.PassiveDict)
            {
                if (pt.Value)
                {
                    GUI.DrawTexture(new Rect(posPass.x + sq * sg + seg * (sg - 1), posPass.y, sq, sq), iconVault.GetPassiveTexture(pt.Key));
                    sg += 1;
                }
            }
        }
        if (cp.Hp <= 0)
        {
            GUI.DrawTexture(new Rect(startRect.x, startRect.y - 50, 220, 110), Dead);
        }
        if (Critical)
        {
            GUI.DrawTexture(new Rect(posLeftContent.x, posLeftContent.y - 70, 180, 90), criticalImg);
        }
        if (CriticalRight)
        {
            GUI.DrawTexture(new Rect(posRightContent.x, posRightContent.y - 70, 180, 90), criticalImg);
        }
    }