Exemplo n.º 1
0
    void InitPlayerExp()
    {
        Obj_MainPlayer mainPlayer = Singleton <ObjManager> .Instance.MainPlayer;

        if (null == mainPlayer)
        {
            return;
        }

        m_PlayerLevelBuffer = mainPlayer.BaseAttr.Level;
        m_CurExp            = mainPlayer.BaseAttr.Exp;

        Tab_LevelUp curTabLevelup = TableManager.GetLevelUpByID(m_PlayerLevelBuffer, 0);

        if (null == curTabLevelup)
        {
            return;
        }
        m_MaxExp = curTabLevelup.ExpNeed;

        if (m_MaxExp != 0)
        {
            m_ExpProgress.value = (float)m_CurExp / (float)m_MaxExp;
            m_CurExpBuffer      = m_CurExp;
            m_MaxExpBuffer      = m_MaxExp;
            m_ExpLabel.text     = m_CurExp.ToString() + "/" + m_MaxExp.ToString();
            //m_ExpLabel.text = Utils.ConvertLargeNumToString(m_CurExp) + "/" + Utils.ConvertLargeNumToString(m_MaxExp);
            //m_bExpAni = true;
        }
        UpdateOffLineProgress();
    }
Exemplo n.º 2
0
    public void OnLevelChange()
    {
        Obj_MainPlayer mainPlayer = Singleton <ObjManager> .Instance.MainPlayer;

        if (null == mainPlayer)
        {
            return;
        }
        Tab_LevelUp curTabLevelup = TableManager.GetLevelUpByID(mainPlayer.BaseAttr.Level, 0);

        if (null == curTabLevelup)
        {
            return;
        }

        m_MaxExp = curTabLevelup.ExpNeed;
        m_CurExp = mainPlayer.BaseAttr.Exp;
        if (m_MaxExp > 0)
        {
            m_ExpProgress.value = (float)m_CurExp / (float)m_MaxExp;
        }
        m_ExpLabel.text = m_CurExp.ToString() + "/" + m_MaxExp.ToString();
        //m_ExpLabel.text = Utils.ConvertLargeNumToString(m_CurExp) + "/" + Utils.ConvertLargeNumToString(m_MaxExp);
        UpdateOffLineExp();
    }
Exemplo n.º 3
0
        public int GetFellowLevelUpNeedExp()
        {
            Tab_LevelUp line = TableManager.GetLevelUpByID(m_nLevel, 0);

            if (line != null)
            {
                return(line.FellowExpNeed);
            }
            return(GlobeVar.INVALID_ID);
        }
Exemplo n.º 4
0
    int GetCurLevelPlayerTotalExp()
    {
        int            m_CurLevelPlayerTotalExp = 0;
        Obj_MainPlayer mainPlayer = Singleton <ObjManager> .Instance.MainPlayer;

        if (null != mainPlayer)
        {
            Tab_LevelUp curTabLevelup = TableManager.GetLevelUpByID(mainPlayer.BaseAttr.Level, 0);
            m_CurLevelPlayerTotalExp = curTabLevelup.ExpNeed;
        }
        return(m_CurLevelPlayerTotalExp);
    }
Exemplo n.º 5
0
    void UpdateExpAnimation()
    {
        if (m_CurExpBuffer != m_CurExp || m_MaxExpBuffer != m_MaxExp)
        {
            // 普通增长经验
            if (m_MaxExp == m_MaxExpBuffer)
            {
                if (m_CurExpBuffer + AddExpRatio * m_MaxExpBuffer >= m_CurExp)
                {
                    // 增长结束
                    m_CurExpBuffer = m_CurExp;
                }
                else
                {
                    m_CurExpBuffer += (int)(AddExpRatio * m_MaxExpBuffer);
                }
                m_ExpProgress.value = (float)m_CurExpBuffer / (float)m_MaxExpBuffer;
                m_ExpLabel.text     = m_CurExpBuffer.ToString() + "/" + m_MaxExpBuffer.ToString();
                //m_ExpLabel.text = Utils.ConvertLargeNumToString(m_CurExpBuffer) + "/" + Utils.ConvertLargeNumToString(m_MaxExpBuffer);
            }
            // 升级
            else if (m_MaxExp > m_MaxExpBuffer)
            {
                if (m_CurExpBuffer + AddExpRatio * m_MaxExpBuffer >= m_MaxExpBuffer)
                {
                    // 经验满了
                    m_CurExpBuffer = m_MaxExpBuffer;
                    m_ExpProgress.GetComponent <UISlider>().value = (float)m_CurExpBuffer / (float)m_MaxExpBuffer;

                    // 计算下一级经验
                    m_PlayerLevelBuffer++;
                    Tab_LevelUp nextTabLevelup = TableManager.GetLevelUpByID(m_PlayerLevelBuffer, 0);
                    if (null == nextTabLevelup)
                    {
                        return;
                    }
                    m_MaxExpBuffer = nextTabLevelup.ExpNeed;
                    m_CurExpBuffer = 0;
                }
                else
                {
                    m_CurExpBuffer += (int)(AddExpRatio * m_MaxExpBuffer);
                }
                m_ExpProgress.GetComponent <UISlider>().value = (float)m_CurExpBuffer / (float)m_MaxExpBuffer;
                m_ExpLabel.text = m_CurExpBuffer.ToString() + "/" + m_MaxExpBuffer.ToString();
                //m_ExpLabel.text = Utils.ConvertLargeNumToString(m_CurExpBuffer) + "/" + Utils.ConvertLargeNumToString(m_MaxExpBuffer);
            }
        }
    }
Exemplo n.º 6
0
    int GetCurLevelBattleFellowTotalExp()
    {
        int             nCurLevelTotalFexp = 0;
        FellowContainer container          = GameManager.gameManager.PlayerDataPool.FellowContainer;

        if (container != null)
        {
            Fellow fellow = container.GetFellowByGuid(Singleton <ObjManager> .GetInstance().MainPlayer.CurFellowObjGuid);
            if (fellow != null)
            {
                Tab_LevelUp curTabLevelup = TableManager.GetLevelUpByID(fellow.Level, 0);
                nCurLevelTotalFexp = curTabLevelup.FellowExpNeed;
            }
        }
        return(nCurLevelTotalFexp);
    }