Exemplo n.º 1
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);
            }
        }