Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public int GetEatExp()
        {
            Tab_SwordsManAttr SwordsmanAttrTable = TableManager.GetSwordsManAttrByID(m_nDataId, 0);

            if (null == SwordsmanAttrTable)
            {
                return(0);
            }
            Tab_SwordsManLevelUp SwordsManLevelUpTable = TableManager.GetSwordsManLevelUpByID(m_nDataId, 0);

            if (null == SwordsManLevelUpTable)
            {
                return(0);
            }
            int nBaseExp     = SwordsmanAttrTable.SwordsManExp;
            int nTotalEatExp = Exp;

            for (int i = 0; i < SwordsManLevelUpTable.getExpNeedLvCount() && i < m_nLevel; i++)
            {
                nTotalEatExp += SwordsManLevelUpTable.GetExpNeedLvbyIndex(i);
            }
            //float fTotalEatExp = (float)nTotalEatExp * (float)0.4;
            int nTotalExp = nBaseExp + nTotalEatExp;

            return(nTotalExp);
        }
Beispiel #2
0
        /// <summary>
        /// 侠客附加的战斗属性值
        /// </summary>
        /// <param name="attrtype"></param>
        /// <returns></returns>
        public int GetComBatAttrById(COMBATATTE attrtype)
        {
            int nBaseAttrValue = 0;

            if (IsValidAttrType((int)attrtype) == false)
            {
                return(nBaseAttrValue);
            }
            Tab_SwordsManAttr SwordsMmanTable = TableManager.GetSwordsManAttrByID(m_nDataId, 0);

            if (null == SwordsMmanTable)
            {
                return(nBaseAttrValue);
            }

            //附加属性
            for (int attrIndex = 0; attrIndex < SwordsMmanTable.getAddAttrTypeCount(); ++attrIndex)
            {
                int   addAttrType  = SwordsMmanTable.GetAddAttrTypebyIndex(attrIndex);
                float addAttrValue = SwordsMmanTable.GetAddAttrValuebyIndex(attrIndex);
                if ((int)attrtype == addAttrType || MaxBatAttrUtil.IsContainType((MIXBATATTR)addAttrType, attrtype))
                {
                    nBaseAttrValue += (int)addAttrValue;
                }
            }
            float fAddValue  = (float)nBaseAttrValue + (float)(m_nLevel - 1) * (float)0.4 * (float)nBaseAttrValue;
            int   nAttrValue = (int)fAddValue;

            return(nAttrValue);
        }
Beispiel #3
0
        /// <summary>
        /// 描述信息
        /// </summary>
        /// <returns></returns>
        public string GetTips()
        {
            Tab_SwordsManAttr SwordsMmanTable = TableManager.GetSwordsManAttrByID(m_nDataId, 0);

            if (null == SwordsMmanTable)
            {
                return(null);
            }
            //todo_xiake
            return(SwordsMmanTable.Tips);
        }
Beispiel #4
0
        /// <summary>
        /// IsValid
        /// </summary>
        /// <returns></returns>
        public bool IsValid()
        {
            if (m_nDataId < 0)
            {
                return(false);
            }
            Tab_SwordsManAttr line = TableManager.GetSwordsManAttrByID(m_nDataId, 0);

            if (line != null)
            {
                return(true);
            }
            return(false);
        }
Beispiel #5
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="ShopSwordsManTable"></param>
    public void SetShopSwordsMan(Tab_SwordsManScoreShop ShopSwordsManTable)
    {
        if (null == ShopSwordsManTable)
        {
            LogModule.ErrorLog("SetShopSwordsManShop::ShopSwordsManTable is null");
            return;
        }
        Tab_SwordsManAttr SwordsManAttrTable = TableManager.GetSwordsManAttrByID(ShopSwordsManTable.Id, 0);

        if (null == SwordsManAttrTable)
        {
            LogModule.ErrorLog("m_SwordsManAttrTable::SwordsManAttrTable is null");
            return;
        }
        m_SwordsManDataID = SwordsManAttrTable.Id;
        m_nPrice          = ShopSwordsManTable.ScorePrice;
        m_strName         = SwordsManAttrTable.Name;

        if (m_LableName != null)
        {
            m_LableName.text = SwordsManAttrTable.Name;
        }
        if (m_LabelDesc != null)
        {
            m_LabelDesc.text = SwordsManAttrTable.Tips;
        }
        if (m_LabelPrice != null)
        {
            if (GameManager.gameManager.PlayerDataPool != null && GameManager.gameManager.PlayerDataPool.SwordsManScore >= m_nPrice)
            {
                m_LabelPrice.text = ShopSwordsManTable.ScorePrice.ToString();
            }
            else
            {
                m_LabelPrice.text = "[ff0000]" + ShopSwordsManTable.ScorePrice.ToString();
            }
        }
        if (m_IconSprite != null)
        {
            m_IconSprite.spriteName = SwordsManAttrTable.Icon;
        }
        if (m_QualitySprite != null)
        {
            m_QualitySprite.spriteName = SwordsMan.GetQualitySpriteName((SwordsMan.SWORDSMANQUALITY)SwordsManAttrTable.Quality);
        }
        if (m_HightLightBkSprite != null)
        {
            m_HightLightBkSprite.SetActive(false);
        }
    }
Beispiel #6
0
    void OnClickShopItem()
    {
        if (null == m_Parent)
        {
            LogModule.ErrorLog("OnClickShopItem::m_Parent null");
            return;
        }
        Tab_SwordsManAttr SwordsManAttrTable = TableManager.GetSwordsManAttrByID(m_SwordsManDataID, 0);

        if (null == SwordsManAttrTable)
        {
            LogModule.ErrorLog("OnClickShopItem::SwordsManAttrTable is null");
            return;
        }
        SwordsMan oSwordsMan = new SwordsMan();

        oSwordsMan.DataId  = m_SwordsManDataID;
        oSwordsMan.Name    = SwordsManAttrTable.Name;
        oSwordsMan.Quality = SwordsManAttrTable.Quality;
        oSwordsMan.Level   = 1;
        SwordsManToolTipsLogic.ShowSwordsManTooltip(oSwordsMan, SwordsManToolTipsLogic.SwordsMan_ShowType.ScoreShop);
        m_Parent.OnShopSwordsManClick(this);
    }
    void ShowSwordsManEffect()
    {
        SwordsManContainer Container = GameManager.gameManager.PlayerDataPool.GetSwordsManContainer(m_PackType);

        if (Container == null)
        {
            return;
        }
        SwordsMan oSwordsMan = Container.GetSwordsManByGuid(m_SwordsManGuid);

        if (oSwordsMan == null)
        {
            LogModule.ErrorLog("ShowSwordsManEffect::oSwordsMan is null");
            return;
        }
        Tab_SwordsManAttr pAttrTable = TableManager.GetSwordsManAttrByID(oSwordsMan.DataId, 0);

        if (null == pAttrTable)
        {
            LogModule.ErrorLog("ShowSwordsManEffect::pAttrTable is null");
            return;
        }

        for (int i = 0; i < m_LabelCurEffect.Length; i++)
        {
            m_LabelCurEffect[i].gameObject.SetActive(false);
        }
        for (int i = 0; i < m_LabelNextEffect.Length; i++)
        {
            m_LabelNextEffect[i].gameObject.SetActive(false);
        }
        int nCurEffectIndex  = 0;
        int nNextEffectIndex = 0;

        for (int i = 0; i < pAttrTable.getAddAttrTypeCount(); i++)
        {
            COMBATATTE nAttrType           = (COMBATATTE)pAttrTable.GetAddAttrTypebyIndex(i);
            int        nAttrValue          = oSwordsMan.GetComBatAttrById(nAttrType);
            int        nNextLevelAttrValue = oSwordsMan.GetNextLevelComBatAttrById(nAttrType);
            if (nAttrValue > 0 && nCurEffectIndex < m_LabelCurEffect.Length && nCurEffectIndex >= 0)
            {
                //m_LabelCurEffect[nCurEffectIndex].text = string.Format("{0}+{1}", ItemTool.ConvertAttrToString(nAttrType), nAttrValue.ToString());
                m_LabelCurEffect[nCurEffectIndex].text = StrDictionary.GetClientDictionaryString("#{3339}", ItemTool.ConvertAttrToString(nAttrType), nAttrValue.ToString());
                m_LabelCurEffect[nCurEffectIndex].gameObject.SetActive(true);
                ++nCurEffectIndex;
            }
            if (nNextLevelAttrValue > 0 && nNextEffectIndex < m_LabelNextEffect.Length && nNextEffectIndex >= 0)
            {
                //m_LabelNextEffect[nNextEffectIndex].text = string.Format("{0}+{1}", ItemTool.ConvertAttrToString(nAttrType), nNextLevelAttrValue.ToString());
                m_LabelNextEffect[nNextEffectIndex].text = StrDictionary.GetClientDictionaryString("#{3339}", ItemTool.ConvertAttrToString(nAttrType), nNextLevelAttrValue.ToString());
                m_LabelNextEffect[nNextEffectIndex].gameObject.SetActive(true);
                ++nNextEffectIndex;
            }
        }

        if (m_CurEffectGrid != null)
        {
            m_CurEffectGrid.SetActive(true);
        }
        if (m_CurEffectTitle != null)
        {
            m_CurEffectTitle.SetActive(true);
        }
        if (oSwordsMan.IsFullLevel())
        {
            if (m_NextEffectGrid != null)
            {
                m_NextEffectGrid.SetActive(false);
            }
            if (m_NextEffectTitle != null)
            {
                m_NextEffectTitle.SetActive(false);
            }
        }
        else
        {
            if (m_NextEffectGrid != null)
            {
                m_NextEffectGrid.SetActive(true);
            }
            if (m_NextEffectTitle != null)
            {
                m_NextEffectTitle.SetActive(true);
            }
        }
    }
    /// <summary>
    /// 侠客属性加成效果
    /// </summary>
    void ShowSwordsManEffect()
    {
        if (m_SwordsMan == null)
        {
            LogModule.ErrorLog("ShowSwordsManEffect::m_SwordsMan is null");
            return;
        }
        Tab_SwordsManAttr pAttrTable = TableManager.GetSwordsManAttrByID(m_SwordsMan.DataId, 0);

        if (null == pAttrTable)
        {
            LogModule.ErrorLog("ShowSwordsManEffect::pAttrTable is null");
            return;
        }
        for (int i = 0; i < m_LabelCurEffect.Length; i++)
        {
            m_LabelCurEffect[i].gameObject.SetActive(false);
        }
        for (int i = 0; i < m_LabelNextEffect.Length; i++)
        {
            m_LabelNextEffect[i].gameObject.SetActive(false);
        }

        int nNextEffectIndex = 0;
        int nCurEffectIndex  = 0;

        for (int i = 0; i < pAttrTable.getAddAttrTypeCount(); i++)
        {
            COMBATATTE nAttrType           = (COMBATATTE)pAttrTable.GetAddAttrTypebyIndex(i);
            int        nAttrValue          = m_SwordsMan.GetComBatAttrById(nAttrType);
            int        nNextLevelAttrValue = m_SwordsMan.GetNextLevelComBatAttrById(nAttrType);
            if (nAttrValue > 0 && nCurEffectIndex < m_LabelCurEffect.Length && nCurEffectIndex >= 0)
            {
                m_LabelCurEffect[nCurEffectIndex].text = string.Format("{0}+{1}", ItemTool.ConvertAttrToString(nAttrType), nAttrValue.ToString());
                m_LabelCurEffect[nCurEffectIndex].gameObject.SetActive(true);
                ++nCurEffectIndex;
            }
            if (nNextLevelAttrValue > 0 && nNextEffectIndex < m_LabelNextEffect.Length && nNextEffectIndex >= 0)
            {
                m_LabelNextEffect[nNextEffectIndex].text = string.Format("{0}+{1}", ItemTool.ConvertAttrToString(nAttrType), nNextLevelAttrValue.ToString());
                m_LabelNextEffect[nNextEffectIndex].gameObject.SetActive(true);
                ++nNextEffectIndex;
            }
        }

        if (m_ShowType == SwordsMan_ShowType.Equiped || m_ShowType == SwordsMan_ShowType.UnEquiped)
        {
            if (m_SwordsMan.IsFullLevel())
            {
                if (m_NextEffectGrid != null)
                {
                    m_NextEffectGrid.SetActive(false);
                }
                if (m_NextEffectTitle != null)
                {
                    m_NextEffectTitle.SetActive(false);
                }
            }
            else
            {
                if (m_NextEffectGrid != null)
                {
                    m_NextEffectGrid.SetActive(true);
                }
                if (m_NextEffectTitle != null)
                {
                    m_NextEffectTitle.SetActive(true);
                }
            }
        }
        else if (m_ShowType == SwordsMan_ShowType.ScoreShop || m_ShowType == SwordsMan_ShowType.ChatLink)
        {
            if (m_NextEffectTitle != null)
            {
                m_NextEffectTitle.SetActive(false);
            }
            if (m_NextEffectGrid != null)
            {
                m_NextEffectGrid.SetActive(false);
            }
        }
    }