Exemplo n.º 1
0
        /// <summary>
        /// 响应角色死亡的消息
        /// </summary>
        /// <param name="pack"></param>
        public void HandleUnitDead(S2CNwarUnitDead pack)
        {
            var uuid = pack.id;

            if (ActorHelper.IsPlayer(uuid))
            {
                // 玩家死亡暂时不用做任何处理
            }
            else
            {
                var monster = GetWildMonsterInfo(uuid, false);
                if (monster != null)
                {
                    if (pack.killer_id == xc.Game.Instance.LocalPlayerID.obj_idx)
                    {
                        ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_MONSTER_DEAD, new CEventBaseArgs(uuid));
                    }

                    monster.HandleDead();

                    mAppearWildMonstersInfo.Remove(uuid);
                    mDisappearWildMonstersInfo.Remove(uuid);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 响应aoi消失的消息
        /// </summary>
        /// <param name="pack"></param>
        public void HandleUnitDisapper(S2CNwarDisappear pack)
        {
#if TEST_WILD_PROTOCOL
            if (IsPlayer(pack.uuid))
            {
                GameDebug.Log(">>>MSG_NWAR_DISAPPEAR player id = " + pack.uuid);
            }
            else if (IsSummon(pack.uuid))
            {
                GameDebug.Log(">>>MSG_NWAR_DISAPPEAR summon id = " + pack.uuid);
            }
            else
            {
                GameDebug.Log(">>>MSG_NWAR_DISAPPEAR monster id = " + pack.uuid);
            }
#endif

            var uuid = pack.uuid;

            // 不需要处理本地玩家的disappear
            if (uuid == Game.Instance.LocalPlayerID.obj_idx)
            {
                return;
            }

            // 如果是玩家或者人形怪
            if (ActorHelper.IsPlayer(uuid) || ActorHelper.IsShemale(uuid))
            {
                var player_info = GetWildPlayerInfo(uuid, false);
                if (player_info != null)
                {
                    player_info.HandleDisappear();

                    AddPlayerToDisappear(player_info);
                }
            }
            // 如果是召唤怪
            else if (ActorHelper.IsSummon(uuid))
            {
                var monster_info = GetWildMonsterInfo(uuid, false);
                if (monster_info != null)
                {
                    monster_info.HandleDisappear();
                    AddMonsterToDisappear(monster_info);
                }
            }
            // 如果是普通怪物
            else
            {
                var monster_info = GetWildMonsterInfo(uuid, false);
                if (monster_info != null)
                {
                    monster_info.HandleDisappear();
                    AddMonsterToDisappear(monster_info);
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 响应aoi出现的消息
        /// </summary>
        /// <param name="pack"></param>
        public void HandleUnitAppear(S2CNwarAppear pack)
        {
            var uuid = pack.move.id;

            // 如果是玩家或者人形怪
            if (ActorHelper.IsPlayer(uuid) || ActorHelper.IsShemale(uuid))
            {
#if TEST_WILD_PROTOCOL
                GameDebug.Log(">>>MSG_NWAR_APPEAR player id = " + pack.moves.id);
#endif
                // 不需要处理本地玩家的appear
                if (uuid == Game.GetInstance().LocalPlayerID.obj_idx)
                {
                    return;
                }

                // 超出极限了,直接抛弃
                if (IsPlayerReachLimit())
                {
                    return;
                }

                var info = GetWildPlayerInfo(pack.move.id, true);
                if (info != null)
                {
                    info.HandleAppear(pack.move, pack.version, pack.buffs, (uint)pack.appear_bit);
                }
            }
            // 如果是召唤怪物
            else if (ActorHelper.IsSummon(uuid))
            {
#if TEST_WILD_PROTOCOL
                GameDebug.Log(">>>MSG_NWAR_APPEAR summon id = " + pack.moves.id);
#endif
                // 不需要处理本地玩家的召唤怪
                if (ActorHelper.IsMySummon(uuid))
                {
                    return;
                }

                var monster_info = GetWildMonsterInfo(pack.move.id, true);
                if (monster_info != null)
                {
                    monster_info.HandleAppear(pack.move, pack.buffs);
                }
            }
            // 如果是普通怪物
            else
            {
#if TEST_WILD_PROTOCOL
                GameDebug.Log(">>>MSG_NWAR_APPEAR monster id = " + pack.moves.id);
#endif
                var monster_info = GetWildMonsterInfo(pack.move.id, true);
                if (monster_info != null)
                {
                    monster_info.HandleAppear(pack.move, pack.buffs);
                }
            }

            var monBrief = pack.mon_brief;
            if (monBrief != null)
            {
                GetWildMonsterInfo(monBrief.uuid, true).HandleBriefInfo(monBrief);
            }
        }