コード例 #1
0
        private void AddDamageValue(ref HurtEventResultInfo prm)
        {
            PoolObjHandle <ActorRoot> atker   = prm.atker;
            SkillSlotType             atkSlot = prm.hurtInfo.atkSlot;
            int                 hurtTotal     = prm.hurtTotal;
            HurtTypeDef         hurtType      = prm.hurtInfo.hurtType;
            SKILL_USE_FROM_TYPE skillUseFrom  = prm.hurtInfo.SkillUseFrom;

            if (this.m_listDamageActorValue != null && atkSlot <= SkillSlotType.SLOT_SKILL_VALID && atker)
            {
                uint objID = atker.handle.ObjID;
                this.DeleteTimeoutDamageValue(objID, 0uL);
                DAMAGE_ACTOR_INFO dAMAGE_ACTOR_INFO;
                if (!this.m_listDamageActorValue.TryGetValue(objID, ref dAMAGE_ACTOR_INFO))
                {
                    dAMAGE_ACTOR_INFO           = default(DAMAGE_ACTOR_INFO);
                    dAMAGE_ACTOR_INFO.actorType = atker.handle.TheActorMeta.ActorType;
                    dAMAGE_ACTOR_INFO.actorName = atker.handle.name;
                    dAMAGE_ACTOR_INFO.ConfigId  = atker.handle.TheActorMeta.ConfigId;
                    if (dAMAGE_ACTOR_INFO.actorType == ActorTypeDef.Actor_Type_Monster)
                    {
                        MonsterWrapper monsterWrapper = atker.handle.AsMonster();
                        dAMAGE_ACTOR_INFO.bMonsterType = monsterWrapper.GetActorSubType();
                        dAMAGE_ACTOR_INFO.actorSubType = monsterWrapper.GetActorSubSoliderType();
                    }
                    Player player = Singleton <GamePlayerCenter> .instance.GetPlayer(atker.handle.TheActorMeta.PlayerId);

                    if (player != null)
                    {
                        dAMAGE_ACTOR_INFO.playerName = player.Name;
                    }
                    dAMAGE_ACTOR_INFO.listDamage = new SortedList <ulong, SKILL_SLOT_HURT_INFO[]>();
                    this.m_listDamageActorValue.Add(objID, dAMAGE_ACTOR_INFO);
                }
                ulong logicFrameTick = Singleton <FrameSynchr> .instance.LogicFrameTick;
                SKILL_SLOT_HURT_INFO[] array;
                if (!dAMAGE_ACTOR_INFO.listDamage.TryGetValue(logicFrameTick, ref array))
                {
                    array = new SKILL_SLOT_HURT_INFO[12];
                    dAMAGE_ACTOR_INFO.listDamage.Add(logicFrameTick, array);
                }
                if (array[(int)atkSlot].listHurtInfo == null)
                {
                    array[(int)atkSlot].listHurtInfo = new List <HURT_INFO>();
                }
                if (array[(int)atkSlot].listHurtInfo != null)
                {
                    string text    = null;
                    string strName = null;
                    if (skillUseFrom == SKILL_USE_FROM_TYPE.SKILL_USE_FROM_TYPE_SKILL)
                    {
                        SkillSlot skillSlot;
                        if (atkSlot < SkillSlotType.SLOT_SKILL_COUNT && atker.handle.SkillControl != null && (atker.handle.TheActorMeta.ActorType != ActorTypeDef.Actor_Type_Hero || atkSlot != SkillSlotType.SLOT_SKILL_0) && atker.handle.SkillControl.TryGetSkillSlot(atkSlot, out skillSlot) && skillSlot.SkillObj != null && skillSlot.SkillObj.cfgData != null)
                        {
                            if (!string.IsNullOrEmpty(skillSlot.SkillObj.IconName))
                            {
                                text = skillSlot.SkillObj.IconName;
                            }
                            if (!string.IsNullOrEmpty(skillSlot.SkillObj.cfgData.szSkillName))
                            {
                                strName = skillSlot.SkillObj.cfgData.szSkillName;
                            }
                        }
                    }
                    else if (skillUseFrom == SKILL_USE_FROM_TYPE.SKILL_USE_FROM_TYPE_EQUIP)
                    {
                        uint             uiFromId  = prm.hurtInfo.uiFromId;
                        ResEquipInBattle dataByKey = GameDataMgr.m_equipInBattleDatabin.GetDataByKey(uiFromId);
                        if (dataByKey != null)
                        {
                            text    = dataByKey.szIcon;
                            strName = dataByKey.szName;
                        }
                    }
                    else if (skillUseFrom == SKILL_USE_FROM_TYPE.SKILL_USE_FROM_TYPE_AREATRIGGER)
                    {
                        uint uiFromId2 = prm.hurtInfo.uiFromId;
                        ResSkillCombineCfgInfo dataByKey2 = GameDataMgr.skillCombineDatabin.GetDataByKey(uiFromId2);
                        if (dataByKey2 != null)
                        {
                            text    = dataByKey2.szIconPath;
                            strName = dataByKey2.szSkillCombineName;
                        }
                    }
                    int count = array[(int)atkSlot].listHurtInfo.get_Count();
                    int i;
                    for (i = 0; i < count; i++)
                    {
                        if (array[(int)atkSlot].listHurtInfo.get_Item(i).strIconName == text)
                        {
                            HURT_INFO hURT_INFO;
                            array[(int)atkSlot].listHurtInfo.get_Item(i).iValue = hURT_INFO.iValue + hurtTotal;
                            break;
                        }
                    }
                    if (i >= count)
                    {
                        HURT_INFO hURT_INFO2 = new HURT_INFO(hurtType, text, strName, hurtTotal, skillUseFrom);
                        array[(int)atkSlot].listHurtInfo.Add(hURT_INFO2);
                    }
                }
                dAMAGE_ACTOR_INFO.listDamage.set_Item(logicFrameTick, array);
                this.m_listDamageActorValue.set_Item(objID, dAMAGE_ACTOR_INFO);
            }
        }
コード例 #2
0
        public bool GetActorDamage(uint uiObjId, ref HURT_INFO[] arrDamageInfo, ref int iActorTotalDamageValue)
        {
            iActorTotalDamageValue = 0;
            DAMAGE_ACTOR_INFO dAMAGE_ACTOR_INFO;

            if (this.m_listDamageActorValue == null || this.m_listDamageActorValue.get_Count() <= 0 || arrDamageInfo == null || !this.m_listDamageActorValue.TryGetValue(uiObjId, ref dAMAGE_ACTOR_INFO))
            {
                return(false);
            }
            List <HURT_INFO> list = new List <HURT_INFO>();
            int count             = dAMAGE_ACTOR_INFO.listDamage.get_Count();

            if (count <= 0)
            {
                return(false);
            }
            if (this.m_ulHeroDeadTime - dAMAGE_ACTOR_INFO.listDamage.get_Keys().get_Item(count - 1) > (ulong)((long)this.m_iDamageIntervalTimeMax))
            {
                return(false);
            }
            IEnumerator <KeyValuePair <ulong, SKILL_SLOT_HURT_INFO[]> > enumerator = dAMAGE_ACTOR_INFO.listDamage.GetEnumerator();

            while (enumerator.MoveNext())
            {
                ulong ulHeroDeadTime = this.m_ulHeroDeadTime;
                KeyValuePair <ulong, SKILL_SLOT_HURT_INFO[]> current = enumerator.get_Current();
                if (ulHeroDeadTime - current.get_Key() <= (ulong)((long)this.m_iDamageStatisticsTimeMax))
                {
                    KeyValuePair <ulong, SKILL_SLOT_HURT_INFO[]> current2 = enumerator.get_Current();
                    SKILL_SLOT_HURT_INFO[] value = current2.get_Value();
                    if (value != null)
                    {
                        for (int i = 0; i <= 11; i++)
                        {
                            if (value[i].listHurtInfo != null)
                            {
                                int count2 = value[i].listHurtInfo.get_Count();
                                for (int j = 0; j < count2; j++)
                                {
                                    int count3 = list.get_Count();
                                    int k;
                                    for (k = 0; k < count3; k++)
                                    {
                                        if (list.get_Item(k).strIconName == value[i].listHurtInfo.get_Item(j).strIconName&& list.get_Item(k).strName == value[i].listHurtInfo.get_Item(j).strName)
                                        {
                                            HURT_INFO hURT_INFO = list.get_Item(k);
                                            hURT_INFO.iValue += value[i].listHurtInfo.get_Item(j).iValue;
                                            list.set_Item(k, hURT_INFO);
                                            break;
                                        }
                                    }
                                    if (k >= count3)
                                    {
                                        list.Add(value[i].listHurtInfo.get_Item(j));
                                    }
                                    iActorTotalDamageValue += value[i].listHurtInfo.get_Item(j).iValue;
                                }
                            }
                        }
                    }
                }
            }
            list.Sort(delegate(HURT_INFO a, HURT_INFO b)
            {
                if (a.iValue < b.iValue)
                {
                    return(1);
                }
                if (a.iValue > b.iValue)
                {
                    return(-1);
                }
                return(0);
            });
            int count4 = list.get_Count();
            int num    = arrDamageInfo.Length;
            int num2   = 0;

            while (num2 < count4 && num2 < num)
            {
                arrDamageInfo[num2] = list.get_Item(num2);
                num2++;
            }
            return(true);
        }