Exemple #1
0
    void init()
    {
        var rate            = (float)CollectExp / (float)NextExp;
        var isReachMaxLevel = false;

        if (Level == MaxLevel)
        {
            isReachMaxLevel = true;
            rate            = 1;
        }

        if (textLevel != null)
        {
            textLevel.text = useFormatForInfo ? RPGLanguageManager.FormatInfo(GameText.TITLE_LEVEL, Level) : Level.ToString("N0");
            if (showMaxLevelInTextLevel)
            {
                textLevel.text += "/" + MaxLevel.ToString("N0");
            }
        }

        if (textCollectExp != null)
        {
            textCollectExp.text = useFormatForInfo ? RPGLanguageManager.FormatInfo(GameText.TITLE_COLLECT_EXP, CollectExp) : CollectExp.ToString("N0");
            if (isReachMaxLevel)
            {
                textCollectExp.text = "0";
            }
        }

        if (textNextExp != null)
        {
            textNextExp.text = useFormatForInfo ? RPGLanguageManager.FormatInfo(GameText.TITLE_NEXT_EXP, NextExp) : NextExp.ToString("N0");
            if (isReachMaxLevel)
            {
                textNextExp.text = "0";
            }
        }

        if (textCollectPerNextExp != null)
        {
            textCollectPerNextExp.text = CollectExp.ToString("N0") + "/" + NextExp.ToString("N0");
            if (isReachMaxLevel)
            {
                textCollectPerNextExp.text = RPGLanguageManager.GetText(GameText.TITLE_EXP_MAX);
            }
        }

        if (textRequireExp != null)
        {
            textRequireExp.text = useFormatForInfo ? RPGLanguageManager.FormatInfo(GameText.TITLE_REQUIRE_EXP, this.RequireExp()) : this.RequireExp().ToString("N0");
            if (isReachMaxLevel)
            {
                textRequireExp.text = "0";
            }
        }

        if (textExpPercent != null)
        {
            textExpPercent.text = (rate * 100).ToString("N2") + "%";
        }

        if (imageExpGage != null)
        {
            imageExpGage.fillAmount = rate;
        }
    }
Exemple #2
0
    public void SetupInfo(CalculationAttributes data)
    {
        if (data == null)
        {
            data = new CalculationAttributes();
        }

        if (textHp != null)
        {
            textHp.text = useFormatForInfo ? RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_HP, data.hp) : RPGLanguageManager.FormatNumber(data.hp);
            if (hideInfoIfEmpty && containerHp != null)
            {
                containerHp.SetActive(Mathf.Abs(data.hp) > 0);
            }
        }

        if (textPAtk != null)
        {
            textPAtk.text = useFormatForInfo ? RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_PATK, data.pAtk) : RPGLanguageManager.FormatNumber(data.pAtk);
            if (hideInfoIfEmpty && containerPAtk != null)
            {
                containerPAtk.SetActive(Mathf.Abs(data.pAtk) > 0);
            }
        }

        if (textPDef != null)
        {
            textPDef.text = useFormatForInfo ? RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_PDEF, data.pDef) : RPGLanguageManager.FormatNumber(data.pDef);
            if (hideInfoIfEmpty && containerPDef != null)
            {
                containerPDef.SetActive(Mathf.Abs(data.pDef) > 0);
            }
        }

        if (textMAtk != null)
        {
            textMAtk.text = useFormatForInfo ? RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_MATK, data.mAtk) : RPGLanguageManager.FormatNumber(data.mAtk);
            if (hideInfoIfEmpty && containerMAtk != null)
            {
                containerMAtk.SetActive(Mathf.Abs(data.mAtk) > 0);
            }
        }

        if (textMDef != null)
        {
            textMDef.text = useFormatForInfo ? RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_MDEF, data.mDef) : RPGLanguageManager.FormatNumber(data.mDef);
            if (hideInfoIfEmpty && containerMDef != null)
            {
                containerMDef.SetActive(Mathf.Abs(data.mDef) > 0);
            }
        }

        if (textSpd != null)
        {
            textSpd.text = useFormatForInfo ? RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_SPD, data.spd) : RPGLanguageManager.FormatNumber(data.spd);
            if (hideInfoIfEmpty && containerSpd != null)
            {
                containerSpd.SetActive(Mathf.Abs(data.spd) > 0);
            }
        }

        if (textEva != null)
        {
            textEva.text = useFormatForInfo ? RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_EVA, data.eva) : RPGLanguageManager.FormatNumber(data.eva);
            if (hideInfoIfEmpty && containerEva != null)
            {
                containerEva.SetActive(Mathf.Abs(data.eva) > 0);
            }
        }

        if (textAcc != null)
        {
            textAcc.text = useFormatForInfo ? RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_ACC, data.acc) : RPGLanguageManager.FormatNumber(data.acc);
            if (hideInfoIfEmpty && containerAcc != null)
            {
                containerAcc.SetActive(Mathf.Abs(data.acc) > 0);
            }
        }

        if (textHpRate != null)
        {
            textHpRate.text = useFormatForInfo ? RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_HP_RATE, data.exp_hpRate, true) : RPGLanguageManager.FormatNumber(data.exp_hpRate, true);
            if (hideInfoIfEmpty && containerHpRate != null)
            {
                containerHpRate.SetActive(Mathf.Abs(data.exp_hpRate) > 0);
            }
        }

        if (textPAtkRate != null)
        {
            textPAtkRate.text = useFormatForInfo ? RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_PATK_RATE, data.exp_pAtkRate, true) : RPGLanguageManager.FormatNumber(data.exp_pAtkRate, true);
            if (hideInfoIfEmpty && containerPAtkRate != null)
            {
                containerPAtkRate.SetActive(Mathf.Abs(data.exp_pAtkRate) > 0);
            }
        }

        if (textPDefRate != null)
        {
            textPDefRate.text = useFormatForInfo ? RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_PDEF_RATE, data.exp_pDefRate, true) : RPGLanguageManager.FormatNumber(data.exp_pDefRate, true);
            if (hideInfoIfEmpty && containerPDefRate != null)
            {
                containerPDefRate.SetActive(Mathf.Abs(data.exp_pDefRate) > 0);
            }
        }

        if (textMAtkRate != null)
        {
            textMAtkRate.text = useFormatForInfo ? RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_MATK_RATE, data.exp_mAtkRate, true) : RPGLanguageManager.FormatNumber(data.exp_mAtkRate, true);
            if (hideInfoIfEmpty && containerMAtkRate != null)
            {
                containerMAtkRate.SetActive(Mathf.Abs(data.exp_mAtkRate) > 0);
            }
        }

        if (textMDefRate != null)
        {
            textMDefRate.text = useFormatForInfo ? RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_MDEF_RATE, data.exp_mDefRate, true) : RPGLanguageManager.FormatNumber(data.exp_mDefRate, true);
            if (hideInfoIfEmpty && containerMDefRate != null)
            {
                containerMDefRate.SetActive(Mathf.Abs(data.exp_mDefRate) > 0);
            }
        }

        if (textSpdRate != null)
        {
            textSpdRate.text = useFormatForInfo ? RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_SPD_RATE, data.exp_spdRate, true) : RPGLanguageManager.FormatNumber(data.exp_spdRate, true);
            if (hideInfoIfEmpty && containerSpdRate != null)
            {
                containerSpdRate.SetActive(Mathf.Abs(data.exp_spdRate) > 0);
            }
        }

        if (textEvaRate != null)
        {
            textEvaRate.text = useFormatForInfo ? RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_EVA_RATE, data.exp_evaRate, true) : RPGLanguageManager.FormatNumber(data.exp_evaRate, true);
            if (hideInfoIfEmpty && containerEvaRate != null)
            {
                containerEvaRate.SetActive(Mathf.Abs(data.exp_evaRate) > 0);
            }
        }

        if (textAccRate != null)
        {
            textAccRate.text = useFormatForInfo ? RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_ACC_RATE, data.exp_accRate, true) : RPGLanguageManager.FormatNumber(data.exp_accRate, true);
            if (hideInfoIfEmpty && containerAccRate != null)
            {
                containerAccRate.SetActive(Mathf.Abs(data.exp_accRate) > 0);
            }
        }

        if (textCritChance != null)
        {
            textCritChance.text = useFormatForInfo ? RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_CRIT_CHANCE, data.exp_critChance, true) : RPGLanguageManager.FormatNumber(data.exp_critChance, true);
            if (hideInfoIfEmpty && containerCritChance != null)
            {
                containerCritChance.SetActive(Mathf.Abs(data.exp_critChance) > 0);
            }
        }

        if (textCritDamageRate != null)
        {
            textCritDamageRate.text = useFormatForInfo ? RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_CRIT_DAMAGE_RATE, data.exp_critDamageRate, true) : RPGLanguageManager.FormatNumber(data.exp_critDamageRate, true);
            if (hideInfoIfEmpty && containerCritDamageRate != null)
            {
                containerCritDamageRate.SetActive(Mathf.Abs(data.exp_critDamageRate) > 0);
            }
        }

        if (textBlockChance != null)
        {
            textBlockChance.text = useFormatForInfo ? RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_BLOCK_CHANCE, data.exp_blockChance, true) : RPGLanguageManager.FormatNumber(data.exp_blockChance, true);
            if (hideInfoIfEmpty && containerBlockChance != null)
            {
                containerBlockChance.SetActive(Mathf.Abs(data.exp_blockChance) > 0);
            }
        }

        if (textBlockDamageRate != null)
        {
            textBlockDamageRate.text = useFormatForInfo ? RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_BLOCK_DAMAGE_RATE, data.exp_blockDamageRate, true) : RPGLanguageManager.FormatNumber(data.exp_blockDamageRate, true);
            if (hideInfoIfEmpty && containerBlockDamageRate != null)
            {
                containerBlockDamageRate.SetActive(Mathf.Abs(data.exp_blockDamageRate) > 0);
            }
        }
    }
Exemple #3
0
    private void UpdateDisplayStats()
    {
        if (textDisplayStats == null)
        {
            return;
        }

        if (IsEmpty())
        {
            textDisplayStats.text = "";
            return;
        }

        var attributes = data.GetAttributes().GetSubAttributes();

        switch (displayStats)
        {
        case DisplayStats.Level:
            textDisplayStats.text = RPGLanguageManager.FormatInfo(GameText.TITLE_LEVEL, 99999);    //data.Level);
            return;

        case DisplayStats.SellPrice:
            textDisplayStats.text = "unknown";    //data.SellPrice.ToString("N0");
            return;

        case DisplayStats.RewardExp:
            textDisplayStats.text = "unknown";     //data.RewardExp.ToString("N0");
            return;

        case DisplayStats.SelectedAmount:
            textDisplayStats.text = SelectedAmount.ToString("N0");
            return;

        case DisplayStats.AttributeHp:
            textDisplayStats.text = attributes == null ? "" : RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_HP, attributes.hp);
            return;

        case DisplayStats.AttributePAtk:
            textDisplayStats.text = attributes == null ? "" : RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_PATK, attributes.pAtk);
            return;

        case DisplayStats.AttributePDef:
            textDisplayStats.text = attributes == null ? "" : RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_PDEF, attributes.pDef);
            return;

        case DisplayStats.AttributeMAtk:
            textDisplayStats.text = attributes == null ? "" : RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_MATK, attributes.mAtk);
            return;

        case DisplayStats.AttributeMDef:
            textDisplayStats.text = attributes == null ? "" : RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_MDEF, attributes.mDef);
            return;

        case DisplayStats.AttributeSpd:
            textDisplayStats.text = attributes == null ? "" : RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_SPD, attributes.spd);
            return;

        case DisplayStats.AttributeEva:
            textDisplayStats.text = attributes == null ? "" : RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_EVA, attributes.eva);
            return;

        case DisplayStats.AttributeAcc:
            textDisplayStats.text = attributes == null ? "" : RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_ACC, attributes.acc);
            return;

        case DisplayStats.AttributeHpRate:
            textDisplayStats.text = attributes == null ? "" : RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_HP_RATE, attributes.exp_hpRate);
            return;

        case DisplayStats.AttributePAtkRate:
            textDisplayStats.text = attributes == null ? "" : RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_PATK_RATE, attributes.exp_pAtkRate);
            return;

        case DisplayStats.AttributePDefRate:
            textDisplayStats.text = attributes == null ? "" : RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_PDEF_RATE, attributes.exp_pDefRate);
            return;

        case DisplayStats.AttributeMAtkRate:
            textDisplayStats.text = attributes == null ? "" : RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_MATK_RATE, attributes.exp_mAtkRate);
            return;

        case DisplayStats.AttributeMDefRate:
            textDisplayStats.text = attributes == null ? "" : RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_MDEF_RATE, attributes.exp_mDefRate);
            return;

        case DisplayStats.AttributeSpdRate:
            textDisplayStats.text = attributes == null ? "" : RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_SPD_RATE, attributes.exp_spdRate);
            return;

        case DisplayStats.AttributeEvaRate:
            textDisplayStats.text = attributes == null ? "" : RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_EVA_RATE, attributes.exp_evaRate);
            return;

        case DisplayStats.AttributeAccRate:
            textDisplayStats.text = attributes == null ? "" : RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_ACC_RATE, attributes.exp_accRate);
            return;

        case DisplayStats.AttributeCritChance:
            textDisplayStats.text = attributes == null ? "" : RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_CRIT_CHANCE, attributes.exp_critChance);
            return;

        case DisplayStats.AttributeCritDamageRate:
            textDisplayStats.text = attributes == null ? "" : RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_CRIT_DAMAGE_RATE, attributes.exp_critDamageRate);
            return;

        case DisplayStats.AttributeBlockChance:
            textDisplayStats.text = attributes == null ? "" : RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_BLOCK_CHANCE, attributes.exp_blockChance);
            return;

        case DisplayStats.AttributeBlockDamageRate:
            textDisplayStats.text = attributes == null ? "" : RPGLanguageManager.FormatInfo(GameText.TITLE_ATTRIBUTE_BLOCK_DAMAGE_RATE, attributes.exp_blockDamageRate);
            return;

        default:
            textDisplayStats.text = "";
            return;
        }
    }