Ejemplo n.º 1
0
    public int GetMaxExp(int id)
    {
        int quality = GetHeroQuality(id);

        int         n           = heroesExpMap.Count;
        DataHeroExp dataHeroExp = heroesExpMap [n];
        int         exp         = dataHeroExp.qualityExp[quality - 1];

        return(exp);
    }
Ejemplo n.º 2
0
    public void LoadHerosExp(string name)
    {
        byte[] bin     = DynamicFileControl.QueryFileContent(name);
        string content = StringHelper.ReadFromBytes(bin);

        LitJson.JSONNode json = LitJson.JSON.Parse(content);

        foreach (LitJson.JSONNode subNode in json.Childs)
        {
            DataHeroExp data = new DataHeroExp();
            data.Load(subNode);

            heroesExpMap[data.level] = data;
        }
    }
Ejemplo n.º 3
0
    public int GetHeroLevel(int id, int exp)
    {
        int quality = GetHeroQuality(id);

        int n = heroesExpMap.Count;

        for (int i = 2; i <= n; ++i)
        {
            DataHeroExp dataHeroExp = heroesExpMap[i];
            int         needExp     = dataHeroExp.qualityExp[quality - 1];
            if (exp < needExp)
            {
                return(i - 1);
            }
        }
        return(n);
    }
Ejemplo n.º 4
0
    public int GetHeroExpToNextLevel(int id, int exp)
    {
        int level    = GetHeroLevel(id, exp);
        int maxLevel = GetMaxLevel(id);

        if (level >= maxLevel)
        {
            return(0);
        }

        int         nextLevel   = level + 1;
        DataHeroExp dataHeroExp = heroesExpMap[nextLevel];

        int quality = GetHeroQuality(id);
        int needExp = dataHeroExp.qualityExp[quality - 1];

        return(needExp - exp);
    }
Ejemplo n.º 5
0
    public int GetHeroTotalExpToNextLevel(int id, int exp)
    {
        int level    = GetHeroLevel(id, exp);
        int maxLevel = GetMaxLevel(id);

        if (level >= maxLevel)
        {
            return(0);
        }

        int         nextLevel    = level + 1;
        DataHeroExp dataHeroExp1 = heroesExpMap[level];
        DataHeroExp dataHeroExp2 = heroesExpMap[nextLevel];

        int quality = GetHeroQuality(id);
        int exp1    = dataHeroExp1.qualityExp[quality - 1];
        int exp2    = dataHeroExp2.qualityExp[quality - 1];

        return(exp2 - exp1);
    }