/// <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); }
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); } } }