/// <summary> /// 点击英雄头像 /// </summary> /// <param name="nHeroID"></param> public void onClickHeroHeadPortrait(int nHeroID) { SSchemeHeroTypeConfig config = HeroTypeConfig.Instance.GetHeroTypeConfig(nHeroID); PersonSkinModelItem ModelItem = new PersonSkinModelItem(); if (config == null || !GameLogicAPI.GetPersonModel((ushort)nHeroID, ref ModelItem) || TxtHeroName == null || TxtHeroDes == null) { return; } TopLeftGameObj.SetActive(true); TxtHeroName.text = ModelItem.szHeroName; TxtHeroDes.text = config.strHeroDesc; DataCenter.CreateHeroDataManager.Instance.PlayerCreateHeroID = nHeroID; SetChangeHeroSkin(ModelItem.nDefaultSkinID, nHeroID); }
/// <summary> /// 汇总并排序伤害总量,返回按伤害总量排血的角色ID表 /// </summary> /// <returns></returns> private List <int> SummaryAndSortData() { m_DeathReplayDataList.Clear(); List <int> enemyOrderList = new List <int>(); m_endTime = GameLogicAPI.GetUnityTickCount(); bool tempFlag = true; //先汇总8次承受伤害数据 foreach (HurtDataItem hurtData in m_ActorHurtDataList) { if (m_endTime - hurtData.hurtTime > DamageCalculationsTime) { continue; } if (tempFlag) { //保存符合条件的第一次受伤时间 m_startTime = hurtData.hurtTime; tempFlag = false; } DeathReplayData damageData = new DeathReplayData(); EntityView ev = EntityFactory.getEntityViewByID(hurtData.uidOperator); if (ev == null || ev.Property == null) { continue; } int skinID = ev.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_SKIN); if (m_DeathReplayDataList.ContainsKey(skinID)) { damageData = m_DeathReplayDataList[skinID]; if (damageData.skillDamageList.ContainsKey(hurtData.skillID)) { damageData.skillDamageList[hurtData.skillID] += hurtData.hurtNum; } else { damageData.skillDamageList.Add(hurtData.skillID, hurtData.hurtNum); } m_DeathReplayDataList[skinID] = damageData; } else { damageData.uidOperator = hurtData.uidOperator; damageData.pdbID = LogicDataCenter.recordTableDataManager.getWarPersonPDBIDByUID(damageData.uidOperator); damageData.skinID = skinID; EntityView view = EntityFactory.getEntityViewByID(Convert.ToInt32(hurtData.uidOperator)); if (view != null && view.Property != null) { damageData.entityType = view.Type; if (view.Type == ENTITY_TYPE.TYPE_MONSTER) { ///////////////////////////////////////////// damageData.monsterID = view.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_ID); } damageData.roleName = view.Property.CreatureName; damageData.skinName = view.Property.CreatureName; if (view.Type == ENTITY_TYPE.TYPE_PLAYER_ROLE) { int heroId = view.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_VOCATION); SSchemeHeroTypeConfig config = HeroTypeConfig.Instance.GetHeroTypeConfig(heroId); if (config != null) { damageData.heroDesc = config.strAgainstWay; } } } WarRecordTableDataManager.WarPlayerVsInfo vsInfo = LogicDataCenter.recordTableDataManager.GetWarPlayerVsInfo(damageData.pdbID); if (null != vsInfo) { damageData.skinName = vsInfo.szVocationName; } damageData.skillDamageList.Add(hurtData.skillID, hurtData.hurtNum); damageData.goodsInfo = LogicDataCenter.warMobaGoodsDataManager.GetPlayerGoodsInfo(damageData.pdbID); damageData.personInfo = LogicDataCenter.recordTableDataManager.getWarPersonInfoByPDBID(damageData.pdbID); m_DeathReplayDataList.Add(skinID, damageData); } } //再排汇总后的敌方角色的技能伤害表 foreach (DeathReplayData data in m_DeathReplayDataList.Values) { foreach (KeyValuePair <int, int> kvp in data.skillDamageList) { SkillDamageItem item = new SkillDamageItem(); item.skillID = kvp.Key; item.damageNum = kvp.Value; IntPtr Ptr = GameLogicAPI.getSpellData(kvp.Key); if (Ptr != IntPtr.Zero) { SPELL.SPELL_DATA spellData = IntPtrHelper.toData <SPELL.SPELL_DATA>(Ptr); item.spellEffectType = spellData.nSpellEffectType; item.skillIcon = spellData.nIcon; IntPtr strPtr = GameLogicAPI.getSpellStrData(kvp.Key, (int)SPELL_DATA_ID.SPDATA_NAME); if (strPtr != null) { item.szSkillName = IntPtrHelper.Ptr2Str(strPtr); } strPtr = GameLogicAPI.getSpellStrData(kvp.Key, (int)SPELL_DATA_ID.SPDATA_DESC); if (strPtr != null) { item.szSkillDesc = IntPtrHelper.Ptr2Str(strPtr); } } //如果是普通攻击 if ((item.spellEffectType & (int)SPELL.SPELL_EFFECT_TYPE.SpellEffectType_NormalAttack) != 0) { //判断表里是否已经有普通攻击了,如果有就直接加值 SkillDamageItem temp = data.skillInfoList.Find(x => (x.spellEffectType & (int)SPELL.SPELL_EFFECT_TYPE.SpellEffectType_NormalAttack) != 0); if (null != temp) { temp.damageNum += item.damageNum; } else { data.skillInfoList.Add(item); } } else { data.skillInfoList.Add(item); } } data.skillInfoList.Sort((x, y) => - x.damageNum.CompareTo(y.damageNum)); } //再排序 var dicSort = from objDic in m_DeathReplayDataList orderby objDic.Value.totalDamage descending select objDic; foreach (KeyValuePair <int, DeathReplayData> kvp in dicSort) { enemyOrderList.Add(kvp.Key); } //返回角色ID表 return(enemyOrderList); }