Esempio n. 1
0
    public float GetHeroExpRatio(int uid)
    {
        float result = 0f;

        if (Singleton <PvpManager> .Instance.IsInPvp)
        {
            PvpStatisticMgr.HeroData heroData = Singleton <PvpManager> .Instance.StatisticMgr.GetHeroData(uid);

            if (heroData != null)
            {
                int exp2LevelUp = UtilExpData.Instance.GetExp2LevelUp(heroData.CurLv);
                if (exp2LevelUp == -1)
                {
                    result = 1f;
                }
                else
                {
                    result = (float)heroData.CurExp / (float)exp2LevelUp;
                }
            }
        }
        else
        {
            ExpCounter expCounter = this.GetCounter(UtilType.Exp) as ExpCounter;
            if (expCounter != null)
            {
                ExpValue expValue = expCounter.GetValue(uid) as ExpValue;
                if (expValue != null)
                {
                    result = expValue.RicherExpRatio;
                }
            }
        }
        return(result);
    }
Esempio n. 2
0
    public int GetHerolv(int uid)
    {
        int result = 1;

        if (Singleton <PvpManager> .Instance.IsInPvp)
        {
            PvpStatisticMgr.HeroData heroData = Singleton <PvpManager> .Instance.StatisticMgr.GetHeroData(uid);

            if (heroData != null)
            {
                result = heroData.CurLv;
            }
        }
        else
        {
            ExpCounter expCounter = this.GetCounter(UtilType.Exp) as ExpCounter;
            if (expCounter != null)
            {
                ExpValue expValue = expCounter.GetValue(uid) as ExpValue;
                if (expValue != null)
                {
                    result = expValue.CurLv;
                }
            }
        }
        return(result);
    }
Esempio n. 3
0
 private bool FindCounter(ExpCounter counter)
 {
     if (m_searchExp == counter.Exp)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Esempio n. 4
0
    private bool GetDeadExpByUnitId(int inUnitId, int inCurLv, out float outDeadExpVal)
    {
        outDeadExpVal = 0f;
        ExpCounter expCounter = this.GetCounter(UtilType.Exp) as ExpCounter;

        if (expCounter == null)
        {
            return(false);
        }
        ExpValue expValue = expCounter.GetValue(inUnitId) as ExpValue;

        if (expValue == null)
        {
            return(false);
        }
        outDeadExpVal = expValue.GetDeadExp(inCurLv);
        return(true);
    }
Esempio n. 5
0
    private void AddExpByUnitId(int inUnitId, float inExpVal)
    {
        if (inExpVal < 0.1f)
        {
            return;
        }
        ExpCounter expCounter = this.GetCounter(UtilType.Exp) as ExpCounter;

        if (expCounter == null)
        {
            return;
        }
        ExpValue expValue = expCounter.GetValue(inUnitId) as ExpValue;

        if (expValue == null)
        {
            return;
        }
        expValue.AddExp(inExpVal);
    }
Esempio n. 6
0
        public void AddExp(int exp)
        {
            m_searchExp = exp;

            int index = m_counter.FindIndex(new Predicate <ExpCounter>(FindCounter));

            if (index != -1)
            {
                m_counter[index].Counter++;

                lvwCounter.Items[m_counter[index].ListViewIndex].SubItems[1].Text = m_counter[index].Counter.ToString("n0");
            }
            else
            {
                ExpCounter counter = new ExpCounter();
                counter.Exp     = exp;
                counter.Counter = 1;

                int insertIndex = 0;
                for (int i = 0; i < m_counter.Count; i++)
                {
                    if (m_counter[i].Exp > exp)
                    {
                        m_counter[i].ListViewIndex++;
                    }
                    else
                    {
                        insertIndex++;
                    }
                }

                m_counter.Insert(insertIndex, counter);

                ListViewItem newItem = new ListViewItem();
                newItem.Text = exp.ToString("n0");
                newItem.SubItems.Add("1");
                lvwCounter.Items.Insert(insertIndex, newItem);
            }
        }