Exemplo n.º 1
0
            //--------------------------------------------------------
            //  客户端消息
            //--------------------------------------------------------

            //--------------------------------------------------------
            //  网络消息
            //--------------------------------------------------------
            void HandleServerData(ushort protocol, byte[] data)
            {
                switch (protocol)
                {
                case NetMsg.MSG_DEPOSIT_ACT_LIST:
                {
                    S2CPackBase       s2cPackBase = new S2CPackBase();
                    S2CDepositActList msg         = s2cPackBase.DeserializePack <S2CDepositActList>(data);

                    PayManager.Instance.UpdatePayActivitys(msg.list);

                    DBPay dbPay = DBManager.GetInstance().GetDB <DBPay>();
                    foreach (DBPay.PayItemInfo payItem in dbPay.PayItemList)
                    {
                        InsertOneItem(mItemListGrid, mItemGameObject, payItem.mRmbLow, payItem.mDiamond, payItem.mIcon, PayManager.Instance.GetPayActivity(payItem.mId));
                    }
                    mItemListScrollView.ResetPosition();
                    mItemListGrid.repositionNow = true;

                    break;
                }

                default:
                    break;
                }
            }
Exemplo n.º 2
0
        void ProcessServerData(ushort protocol, byte[] data)
        {
            switch (protocol)
            {
            case (ushort)NetMsg.MSG_PLAYER_PAYMENT_BOUGHT:
            {
                var payment_bought = S2CPackBase.DeserializePack <S2CPlayerPaymentBought>(data);

                mBoughtTimes.Clear();
                foreach (var bought in payment_bought.all_bought)
                {
                    mBoughtTimes[bought.k] = bought.v;
                }

                mLimitTimes.Clear();
                foreach (var limit in payment_bought.limit_bought)
                {
                    mLimitTimes[limit.k] = limit.v;
                }

                ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_CHARGEINFO_UPDATE, null);
            }
            break;

            case (ushort)NetMsg.MSG_BIND_GOLD_BOX_INFO:
                var info = S2CPackBase.DeserializePack <S2CBindGoldBoxInfo>(data);
                mBuyTime = info.buy_time;
                mGotTime = info.got_time;
                FireRedPoint();
                ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_CHARGEINFO_UPDATE, null);
                break;
            }
        }
Exemplo n.º 3
0
        public void HandleServerData(ushort protocol, byte[] data)
        {
            var pack = new S2CPackBase();

            switch (protocol)
            {
//                case NetMsg.MSG_EQUIP:
//                    {
//                        var pack2 = pack.DeserializePack<S2CEquip>(data);
//                        if (pack2.type == 1)
//                            HandleEquipBag(pack2.equips);
//                        if (pack2.type == 2)
//                        {
                //更新当前是第几套装备
//                            InstalledEquips.EquipSchemeIndex = pack2.index;
//                            HandleEquipPlayer(pack2.equips);
//                        }
//                        else if (pack2.type == 3)
//                            HandleEquipWare(pack2.equips);
//                        else if (pack2.type == 4)
//                            HandleEquipChat(pack2.equips);
//                        else if (pack2.type == 5)
//                            HandleEquipTmpBag(pack2.equips);
//                        else if (pack2.type == 6)
//                            HandleTradingEquips(pack2.equips);
//                        break;
//                    }
//                case NetMsg.MSG_EQUIP_RESULT:
//                    {
//                        HandleEquipResult(pack.DeserializePack<S2CEquipResult>(data));
//                        break;
//                    }
            }
        }
Exemplo n.º 4
0
        // Events
        void HandleServerData(ushort protocol, byte[] data)
        {
            if (m_DBGuide == null)
            {
                m_DBGuide = DBManager.GetInstance().GetDB <DBGuide>();
            }

            if (m_DBGuide == null)
            {
                return;
            }

            switch (protocol)
            {
            case NetMsg.MSG_PLAYER_GUIDE_INFO:
            {
                var guide_info = S2CPackBase.DeserializePack <S2CPlayerGuideInfo>(data);
                foreach (uint guide_id in guide_info.guide_ids)
                {
                    var guide = m_DBGuide.GetGuideById(guide_id);
                    if (guide == null)
                    {
                        continue;
                    }

                    guide.IsFinished = true;
                    GameDebug.Log("Finished guide id : " + guide_id);
                }

                StartupListener();
                break;
            }
            }
        }
Exemplo n.º 5
0
        protected virtual void HandleServerData(ushort protocol, byte[] data)
        {
            switch (protocol)
            {
            case NetMsg.MSG_NWAR_INIT_INFO:
            {
                var pack = S2CPackBase.DeserializePack <S2CNwarInitInfo>(data);
                OnPlayerInfo(pack);

                //GameDebug.LogError(">>>MSG_NWAR_INIT_INFO pos: " + pack.init_pos.px + ", " + pack.init_pos.py);

                GameDebug.Log(">>>MSG_NWAR_INIT_INFO");
            }
                return;

            case NetMsg.MSG_NWAR_ALL_READY:                                  // 副本开始
            {
                xc.LocalPlayerManager.Instance.m_canShowBuffTips     = true; //不允许显示buff提示
                xc.LocalPlayerManager.Instance.m_isFirstLoadingScene = false;

                // 服务端可能会发两次ready过来,第一次是副本准备倒计时结束,第二次是本地的资源加载好,只有在本地资源加载好才是真正的ready
                if (IsInState(GameState.GS_LOADING_RES) == true)
                {
                    OnWarReady();

                    ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_INSTANCE_START, null);
                }

                GameDebug.Log(">>>MSG_NWAR_ALL_READY");
            }
                return;
            }
        }
Exemplo n.º 6
0
        void HandleServerData(ushort protocol, byte[] data)
        {
            switch (protocol)
            {
            case NetMsg.MSG_SKILLS_USING:    //更新技能面板上的技能列表
            {
                S2CSkillsUsing s2cNwarSkill = S2CPackBase.DeserializePack <S2CSkillsUsing>(data);
                RockCommandSystem.Instance.DataSkillsUsingArray = s2cNwarSkill.skills;
            }
            break;

            case NetMsg.MSG_SKILLS_INFO:    //更新所有技能列表
            {
                S2CSkillsInfo s2cNwarSkill = S2CPackBase.DeserializePack <S2CSkillsInfo>(data);
                RockCommandSystem.Instance.AddSkillList(s2cNwarSkill.skills);
            }
            break;

            case NetMsg.MSG_SKILLS_DELETE:    //删除某个技能
            {
                S2CSkillsDelete s2cNwarSkill = S2CPackBase.DeserializePack <S2CSkillsDelete>(data);
                RockCommandSystem.Instance.DeleteOneSkill(s2cNwarSkill.id);
            }
            break;
            }
        }
Exemplo n.º 7
0
        void HandleServerData(ushort protocol, byte[] data)
        {
            switch (protocol)
            {
            case NetMsg.MSG_DUNGEON_WEDDING_FOODS:
            {
                var pack = S2CPackBase.DeserializePack <S2CDungeonWeddingFoods>(data);

                WeddingInstanceFoodsCount = pack.count;

                break;
            }

            case NetMsg.MSG_DUNGEON_WEDDING_BOX:
            {
                var pack = S2CPackBase.DeserializePack <S2CDungeonWeddingBox>(data);

                WeddingInstanceBoxCount = pack.coll_box;

                break;
            }

            default:
                break;
            }
        }
Exemplo n.º 8
0
        private void HandleAccAccountToken(ushort protocol, byte[] data)
        {
            Game.Instance.UnsubscribeNetNotify(NetMsg.MSG_ACC_ACCOUNT_TOKEN, HandleAccAccountToken);
            var pack = S2CPackBase.DeserializePack <S2CAccAccountToken>(data);

            GlobalConfig.Instance.Token = pack.token;
            PreUuid = LocalPlayerManager.Instance.LocalActorAttribute.UnitId.obj_idx;
            Game.Instance.Reset();
            Connect();
        }
Exemplo n.º 9
0
        void OnMsgPlayerClientData(ushort protocol, byte[] data)
        {
            S2CPlayerClientData msg = S2CPackBase.DeserializePack <S2CPlayerClientData>(data);

            m_data.Clear();

            foreach (var kv in msg.settings)
            {
                m_data.Add(kv.type, kv.vals);
            }

            ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_CUSTOM_DATA_UPDATE, null);
        }
Exemplo n.º 10
0
        /// <summary>
        /// 队伍成员位置信息
        /// </summary>
        /// <param name="args"></param>
        void OnTeamMemberPos(ushort protocol, byte[] data)
        {
            if (IsEnable == false || protocol != NetMsg.MSG_TEAM_MEMBER_POS)
            {
                return;
            }

            // 有的场景没有地图
            if (m_uiScalex <= 0 || m_uiScaley <= 0)
            {
                return;
            }

            m_bNetAnswer = true;

            var msg = S2CPackBase.DeserializePack <S2CTeamMemberPos>(data);

            if (m_teamListPointObjs.Count != msg.list.Count)
            {
                for (int i = 0; i < m_teamListPointObjs.Count; i++)
                {
                    UIResourceManager.Instance.ReturnObjectToPool(m_teamListPointObjs[i]);
                }

                m_teamListPointObjs.Clear();

                for (int i = 0; i < msg.list.Count; i++)
                {
                    var rect = GetItem(m_teamPoint);
                    if (null != rect)
                    {
                        m_teamListPointObjs.Add(rect.gameObject);
                    }
                }
            }



            for (int i = 0; i < m_teamListPointObjs.Count; i++)
            {
                if (msg.list.Count > i)
                {
                    var   pos = msg.list[i];
                    float x   = (pos.pos.px * GlobalConst.UnitScale - m_minX) / m_uiScalex;
                    float y   = (pos.pos.py * GlobalConst.UnitScale - m_minY) / m_uiScaley;

                    m_teamListPointObjs[i].transform.localPosition = new Vector3(x, y);
                }
            }
        }
Exemplo n.º 11
0
        protected virtual void HandleServerData(ushort protocol, byte[] data)
        {
            switch (protocol)
            {
            case NetMsg.MSG_NWAR_DROP:
            {
                var pack = S2CPackBase.DeserializePack <S2CNwarDrop>(data);

                //GameDebug.LogError(">>>MSG_NWAR_DROP");
                CreateDrops(pack.drops, (DropComponent.EDropType)pack.drop_type, pack.em_id);
                return;
            }

            case NetMsg.MSG_NWAR_PICK:
            {
                var pack = S2CPackBase.DeserializePack <S2CNwarPick>(data);

                //GameDebug.LogError("Recv MSG_NWAR_PICK: " + pack.oid + ", " + pack.drop_type);

                PickDropImpl(pack.uuid, pack.oid, (DropComponent.EDropType)pack.drop_type);
                return;
            }

            case NetMsg.MSG_NWAR_PICK_FAIL:
            {
                var pack = S2CPackBase.DeserializePack <S2CNwarPickFail>(data);

                if (pack.reason == 1)           // 物品已消失
                {
                    DestroyDrop(pack.oid);
                    UINotice.Instance.ShowMessage(DBConstText.GetText("DROP_IS_DISAPPEAR"));
                }
                else if (pack.reason == 2)          // 物品拾取次数已满
                {
                    UINotice.Instance.ShowMessage(DBConstText.GetText("DROP_REACH_LIMIT"));

                    DropComponent drop = InstanceDropManager.Instance.GetDrop(pack.oid);
                    if (drop != null)
                    {
                        drop.CanPick          = false;
                        drop.CanNotPickReason = pack.reason;
                    }
                }
                return;
            }

            default:
                break;
            }
        }
Exemplo n.º 12
0
        void HandleServerData(ushort protocol, byte[] data)
        {
            switch (protocol)
            {
            case NetMsg.MSG_GLEAGUE_CAMP:
            {
                S2CGleagueCamp msg = S2CPackBase.DeserializePack <S2CGleagueCamp>(data);

                mGuildIds = msg.guild_ids;

                break;
            }

            case NetMsg.MSG_GUILD_LEAGUE_LEVEL_INFO:
            {
                S2CGuildLeagueLevelInfo msg = S2CPackBase.DeserializePack <S2CGuildLeagueLevelInfo>(data);

                mLevelInfos  = msg.infos;
                mBattleInfos = null;

                ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_GUILD_LEAGUE_INFO_CHANGED, null);

                break;
            }

            case NetMsg.MSG_GUILD_LEAGUE_BATTLE_INFO:
            {
                S2CGuildLeagueBattleInfo msg = S2CPackBase.DeserializePack <S2CGuildLeagueBattleInfo>(data);

                mLevelInfos  = null;
                mBattleInfos = msg.infos;

                ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_GUILD_LEAGUE_INFO_CHANGED, null);

                break;
            }

            case NetMsg.MSG_GUILD_LEAGUE_REFRESH:
            {
                C2SGuildLeagueInfo msg = new C2SGuildLeagueInfo();
                NetClient.BaseClient.SendData <C2SGuildLeagueInfo>(NetMsg.MSG_GUILD_LEAGUE_INFO, msg);

                break;
            }

            default:
                break;
            }
        }
Exemplo n.º 13
0
        //--------------------------------------------------------
        //  网络消息
        //--------------------------------------------------------
        void HandleServerData(ushort protocol, byte[] data)
        {
            switch (protocol)
            {
            case NetMsg.MSG_PLAYER_PERSONALITY:
            {
                S2CPlayerPersonality msg = S2CPackBase.DeserializePack <S2CPlayerPersonality>(data);

                mPlayerSettings = msg.settings;

                ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_SETTING_CHANGED, null);
                break;
            }
            }
        }
Exemplo n.º 14
0
        void HandleServerData(ushort protocol, byte[] data)
        {
            switch (protocol)
            {
            case NetMsg.MSG_PLAYER_HANG_SETTLE:
            {
                S2CPlayerHangSettle pack = S2CPackBase.DeserializePack <S2CPlayerHangSettle>(data);
                ClientEventMgr.GetInstance().PostEvent((int)ClientEvent.CE_SETTING_OFFLINE_REWARD, new CEventBaseArgs(pack));
                break;
            }

            default:
                break;
            }
        }
Exemplo n.º 15
0
        //--------------------------------------------------------
        //  内部调用
        //--------------------------------------------------------

        //--------------------------------------------------------
        //  客户端消息
        //--------------------------------------------------------

        //--------------------------------------------------------
        //  网络消息
        //--------------------------------------------------------
        void HandleServerData(ushort protocol, byte[] data)
        {
            switch (protocol)
            {
            case NetMsg.MSG_ACC_SPAN_INFO:
            {
                var pack = S2CPackBase.DeserializePack <S2CAccSpanInfo>(data);

                if (pack.is_spaning == 1)
                {
                    IsSpaning = true;
                    ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_SPAN_SERVER_OPEN, null);
                }
                else
                {
                    IsSpaning = false;
                    ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_SPAN_SERVER_CLOSE, null);
                }

                break;
            }

            case NetMsg.MSG_ACC_SPAN_NAME:
            {
                var pack = S2CPackBase.DeserializePack <S2CAccSpanName>(data);

                mSpanServerNames.Clear();
                foreach (PkgKvStr kv in pack.names)
                {
                    mSpanServerNames.Add(kv.k, System.Text.Encoding.UTF8.GetString(kv.v));
                }

                break;
            }

            case NetMsg.MSG_ACC_MERGED_ENTRANCE:
            {
                var pack = S2CPackBase.DeserializePack <S2CAccMergedEntrance>(data);

                mMergedEntrances = pack.ids;

                break;
            }

            default:
                break;
            }
        }
Exemplo n.º 16
0
        void HandleReceiveURL(ushort protocol, byte[] data)
        {
            if (protocol != NetMsg.MSG_KR_PROB_URL)
            {
                return;
            }
            var url_data = S2CPackBase.DeserializePack <S2CKrProbUrl>(data);

            if (url_data == null || url_data.sys_id != mSysID)
            {
                return;
            }
            string url = System.Text.Encoding.UTF8.GetString(url_data.url.First());

            SetOpenURL(url);
        }
Exemplo n.º 17
0
        public PkgPlayerBrief GetPkgBrief(ushort protocol, byte[] data)
        {
            switch (protocol)
            {
            case NetMsg.MSG_PLAYER_QRY_PLAYER_BRIEF_MINI:
            {
                var            pack  = S2CPackBase.DeserializePack <S2CPlayerQryPlayerBriefMini>(data);
                PkgPlayerBrief brief = pack.info;

                return(brief);
            }

            default:
                return(null);
            }
        }
Exemplo n.º 18
0
        void HandleServerData(ushort protocol, byte[] data)
        {
            switch (protocol)
            {
            case NetMsg.MSG_NWAR_BAR_APPEAR:
            {
                S2CNwarBarAppear pack = S2CPackBase.DeserializePack <S2CNwarBarAppear>(data);

                foreach (PkgNwarBarPos barPos in pack.poss)
                {
                    if (GetCollectionObject((int)(barPos.bar_id)) != null)
                    {
                        RemoveCollectionObject((int)(barPos.bar_id));
                    }
                    Neptune.Collection collection = Neptune.DataManager.Instance.Data.GetNode <Neptune.Collection>((int)(barPos.bar_id));
                    if (collection != null)
                    {
                        collection.ExcelId  = barPos.type;
                        collection.Position = PhysicsHelp.GetPosition(barPos.pos.px * GlobalConst.UnitScale, barPos.pos.py * GlobalConst.UnitScale);
                        CreateCollectionObject(collection);
                    }
                    else
                    {
                        CreateCollectionObject((int)barPos.bar_id, barPos.type, PhysicsHelp.GetPosition(barPos.pos.px * GlobalConst.UnitScale, barPos.pos.py * GlobalConst.UnitScale));
                    }
                }

                ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_COLLECTION_OBJECTS_COUNT_CHANGED, null);

                break;
            }

            case NetMsg.MSG_NWAR_BAR_DISAPPEAR:
            {
                S2CNwarBarDisappear pack = S2CPackBase.DeserializePack <S2CNwarBarDisappear>(data);

                RemoveCollectionObject((int)(pack.bar_id));

                ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_COLLECTION_OBJECTS_COUNT_CHANGED, null);

                break;
            }

            default:
                break;
            }
        }
Exemplo n.º 19
0
        void HandleServerData(ushort protocol, byte[] data)
        {
            switch (protocol)
            {
            case NetMsg.MSG_MAP_LINE_STATE:     // 处理换线逻辑
            {
                S2CMapLineState msg = S2CPackBase.DeserializePack <S2CMapLineState>(data);
                SceneHelp.Instance.ProcessLineInfo(msg);
            }
            break;

            case NetMsg.MSG_PLAYER_DISPLAY_INFO:     // 处理查看其他玩家信息
            {
                var msg = S2CPackBase.DeserializePack <S2CPlayerDisplayInfo>(data);

                var equip_infos = msg.equips;
                m_OtherPlayerEquip.Clear();
                foreach (var info in equip_infos)
                {
                    var equip_goods = GoodsHelper.CreateEquipGoodsFromNet(info);
                    equip_goods.IsInstalledByOtherPlayer = true;
                    m_OtherPlayerEquip.Add(equip_goods);
                }
                Equip.EquipHelper.CalculatorSuitNum(m_OtherPlayerEquip);

                m_OtherPlayerEquipPosInfos = Equip.EquipHelper.GetEquipPosInfosByPkgInfos(msg.strengths, msg.baptizes);

                ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_CLICKPLAY_DISPLAY_INFO, new CEventEventParamArgs(msg.info, m_OtherPlayerEquip, m_OtherPlayerEquipPosInfos));
            }
            break;

            case NetMsg.MSG_MAP_GET_HANG_POS:     // 请求挂机位置
            {
                S2CMapGetHangPos msg = S2CPackBase.DeserializePack <S2CMapGetHangPos>(data);

                Vector3 pos = new Vector3(msg.pos.px * GlobalConst.UnitScale, 0f, msg.pos.py * GlobalConst.UnitScale);
                pos = PhysicsHelp.GetPosition(pos.x, pos.z);
                TargetPathManager.Instance.GoToConstPosition(msg.dungeon_id, msg.line_id, pos, null, () => { InstanceManager.Instance.SetOnHook(true); });
            }
            break;

            default:
                break;
            }
        }
Exemplo n.º 20
0
        // 强制位置同步
        public static void ReceiveSetPos(byte[] data)
        {
            S2CNwarSetPos pack = S2CPackBase.DeserializePack <S2CNwarSetPos>(data);

            Actor actor = ActorManager.Instance.GetPlayer(pack.move.id);

            if (null == actor)
            {
                return;
            }

            MoveCtrl ctrl = actor.MoveCtrl;

            if (null != ctrl)
            {
                ctrl.ReceiveSetPos(pack);
            }
        }
Exemplo n.º 21
0
    void HandleServerData(ushort protocol, byte[] data)
    {
        switch (protocol)
        {
        case NetMsg.MSG_DUNGEON_GUILD_BOSS_FIRE:
        {
            S2CDungeonGuildBossFire pack = S2CPackBase.DeserializePack <S2CDungeonGuildBossFire>(data);

            sFiresState = pack.fires;
            UpdateFireState();

            break;
        }

        default:
            break;
        }
    }
Exemplo n.º 22
0
        /// <summary>
        /// 响应删除buff的消息
        /// </summary>
        public static void HandleNotifyDeleteBuff(ushort protocol, byte[] data)
        {
            S2CNwarBuffDel kMsg = S2CPackBase.DeserializePack <S2CNwarBuffDel>(data);

            Actor kTarget = ActorManager.Instance.GetPlayer(kMsg.act_id);

            if (kTarget == null)
            {
                mBuffActorUID.obj_idx = kMsg.act_id;
                var cache_info = ActorManager.Instance.GetUnitCacheInfo(mBuffActorUID);
                if (cache_info != null && cache_info.CacheType == UnitCacheInfo.EType.ET_Create)
                {
                    if (cache_info.UnitType == EUnitType.UNITTYPE_PLAYER)
                    {
                        if (cache_info.AOIPlayer.leave_buff_id_list != null)
                        {
                            var find_data = cache_info.AOIPlayer.leave_buff_id_list.Find((a) => { return(a.id == kMsg.buff_id); });
                            if (find_data != null)
                            {
                                cache_info.AOIPlayer.leave_buff_id_list.Remove(find_data);
                            }
                        }
                    }
                    else if (cache_info.UnitType == EUnitType.UNITTYPE_MONSTER)
                    {
                        if (cache_info.AOIMonster.leave_buff_id_list != null)
                        {
                            var find_data = cache_info.AOIMonster.leave_buff_id_list.Find((a) => { return(a.id == kMsg.buff_id); });
                            if (find_data != null)
                            {
                                cache_info.AOIMonster.leave_buff_id_list.Remove(find_data);
                            }
                        }
                    }
                }
                return;
            }
            DBBuffSev.DBBuffInfo kInfo = DBBuffSev.GetInstance().GetBuffInfo(kMsg.buff_id);
            if (kInfo != null)
            {
                kTarget.BuffCtrl.DelBuff(kMsg.buff_id);
            }
        }
Exemplo n.º 23
0
        public void HandleServerData(ushort protocol, byte[] data)
        {
            switch (protocol)
            {
            case NetMsg.MSG_NWAR_BAR_READ_FINISH:
            {
                S2CNwarBarReadFinish pack = S2CPackBase.DeserializePack <S2CNwarBarReadFinish>(data);

                if (pack.bar_id == mId)
                {
                    InterruptCollect(false);
                }

                break;
            }

            case NetMsg.MSG_NWAR_BAR_READ_FAIL:
            {
                S2CNwarBarReadFail pack = S2CPackBase.DeserializePack <S2CNwarBarReadFail>(data);

                if (pack.bar_id == mId)
                {
                    InterruptCollect(false);
                }

                break;
            }

            case NetMsg.MSG_NWAR_BAR_DISAPPEAR:
            {
                S2CNwarBarDisappear pack = S2CPackBase.DeserializePack <S2CNwarBarDisappear>(data);

                HandleBarDisappear(pack.bar_id);

                break;
            }

            default:
                break;
            }
        }
Exemplo n.º 24
0
        /// <summary>
        /// 响应网络消息
        /// </summary>
        /// <param name="protocol"></param>
        /// <param name="data"></param>
        private void HandleServerData(ushort protocol, byte[] data)
        {
            switch (protocol)
            {
            case NetMsg.MSG_SYS_PREVIEW_REWARDED_LISTS:     // 已领奖励的系统
            {
                var pack = S2CPackBase.DeserializePack <S2CSysPreviewRewardedLists>(data);
                mRewardSysIds = pack.sys_ids;
                ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_SYS_PREVIEW_REWARDED_LISTS, new CEventBaseArgs());
            }
            break;

            case NetMsg.MSG_SYS_PREVIEW_REWARD:     // 应答领取奖励
            {
                var pack = S2CPackBase.DeserializePack <S2CSysPreviewReward>(data);
                mRewardSysIds.Add(pack.sys_id);
                ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_SYS_PREVIEW_REWARD, new CEventBaseArgs(pack.sys_id));
            }
            break;
            }
        }
Exemplo n.º 25
0
        /// <summary>
        /// 响应增加buff的消息
        /// </summary>
        public static void HandleNotifyAddBuff(ushort protocol, byte[] data)
        {
            S2CNwarBuffAdd buff_add_msg = S2CPackBase.DeserializePack <S2CNwarBuffAdd>(data);

            Actor actor = ActorManager.Instance.GetPlayer(buff_add_msg.act_id);

            if (actor == null)
            {
                if (Game.Instance.LocalPlayerID != null && Game.Instance.LocalPlayerID.obj_idx == buff_add_msg.act_id &&
                    buff_add_msg.no_tips == 2)
                {
                    m_mustShowBuffIds[buff_add_msg.buff_id] = Time.realtimeSinceStartup;
                }

                mBuffActorUID.obj_idx = buff_add_msg.act_id;
                var cache_info = ActorManager.Instance.GetUnitCacheInfo(mBuffActorUID);
                if (cache_info != null && cache_info.CacheType == UnitCacheInfo.EType.ET_Create)
                {
                    if (cache_info.UnitType == EUnitType.UNITTYPE_PLAYER)
                    {
                        if (cache_info.AOIPlayer.leave_buff_id_list == null)
                        {
                            cache_info.AOIPlayer.leave_buff_id_list = new List <LeaveBuff>();
                        }
                        cache_info.AOIPlayer.leave_buff_id_list.Add(new LeaveBuff(buff_add_msg.buff_id, buff_add_msg.expire, buff_add_msg.layer, buff_add_msg.no_tips));
                    }
                    else if (cache_info.UnitType == EUnitType.UNITTYPE_MONSTER)
                    {
                        if (cache_info.AOIMonster.leave_buff_id_list == null)
                        {
                            cache_info.AOIMonster.leave_buff_id_list = new List <LeaveBuff>();
                        }
                        cache_info.AOIMonster.leave_buff_id_list.Add(new LeaveBuff(buff_add_msg.buff_id, buff_add_msg.expire, buff_add_msg.layer, buff_add_msg.no_tips));
                    }
                }
                return;
            }
            actor.BuffCtrl.AddBuff_out(buff_add_msg.buff_id, buff_add_msg.expire * GlobalConst.MilliToSecond, buff_add_msg.layer, buff_add_msg.no_tips);
        }
Exemplo n.º 26
0
        public void UpdateTeam(ushort protocol, byte[] data)
        {
            if (IsEnable == false)
            {
                return;
            }
            if (protocol == NetMsg.MSG_TEAM_MEMBER_POS)
            {
                m_bNetAnswer = true;

                var msg = S2CPackBase.DeserializePack <S2CTeamMemberPos>(data);
                if (mTeamListPointObjs.Count != msg.list.Count)
                {
                    for (int i = 0; i < mTeamListPointObjs.Count; i++)
                    {
                        UIResourceManager.Instance.ReturnObjectToPool(mTeamListPointObjs[i]);
                    }
                    mTeamListPointObjs.Clear();
                    for (int i = 0; i < msg.list.Count; i++)
                    {
                        uint          uuid   = msg.list[i].uuid;
                        PkgTeamMember member = TeamManager.Instance.GetMember(uuid);
                        if (member.dungeon_id.Equals(m_CurSceneId))
                        {
                            var rect = GetItem(m_TeamPoint);
                            mTeamListPointObjs.Add(rect.gameObject);
                        }
                    }
                }
                for (int i = 0; i < mTeamListPointObjs.Count; i++)
                {
                    if (msg.list.Count > i)
                    {
                        var pos = msg.list[i];
                        mTeamListPointObjs[i].transform.localPosition = new Vector3((pos.pos.px * GlobalConst.UnitScale - minX) / uiScalex, (pos.pos.py * GlobalConst.UnitScale - minY) / uiScalex);
                    }
                }
            }
        }
Exemplo n.º 27
0
        //沿着指定方向行走 结束
        public static void ReceiveWalkEnd(byte[] data)
        {
            S2CNwarMoveStop playerWalkStop = S2CPackBase.DeserializePack <S2CNwarMoveStop>(data);

            if (playerWalkStop.stop.id.Equals(Game.GetInstance().LocalPlayerID.obj_idx))
            {
                return;
            }

            Actor actor = ActorManager.Instance.GetPlayer(playerWalkStop.stop.id);

            if (null == actor)
            {
                return;
            }

            MoveCtrl ctrl = actor.MoveCtrl;

            if (null != ctrl)
            {
                ctrl.ReceiveWalkEnd(playerWalkStop);
            }
        }
Exemplo n.º 28
0
        public void HandleServerData(ushort protocol, byte[] data)
        {
            switch (protocol)
            {
            case NetMsg.MSG_NWAR_SKILL_CLEAR_CD:    // 清除本地玩家的技能cd
            {
                S2CNwarSkillClearCd clearCd = S2CPackBase.DeserializePack <S2CNwarSkillClearCd>(data);
                if (clearCd.uuid == Game.GetInstance().LocalPlayerID.obj_idx)
                {
                    Actor localplayer = Game.GetInstance().GetLocalPlayer();
                    if (localplayer != null)
                    {
                        for (int i = 0; i < clearCd.skill_ids.Count; ++i)
                        {
                            localplayer.CDCtrl.RemoveCD(clearCd.skill_ids[i]);
                        }
                    }
                }
                else
                {
                    GameDebug.LogError("Not need rev others clear cd");
                }
            }
            break;

            case NetMsg.MSG_SKILLS_CD:     // 服务端更新技能的cd
            {
                S2CSkillsCd skills_cd = S2CPackBase.DeserializePack <S2CSkillsCd>(data);
                foreach (var cd_info in skills_cd.sks)
                {
                    m_SkillCDInfo[cd_info.id] = cd_info.cd;
                }
            }
            break;
            }
        }
Exemplo n.º 29
0
            //--------------------------------------------------------
            //  外部调用
            //--------------------------------------------------------

            //--------------------------------------------------------
            //  网络消息
            //--------------------------------------------------------
            public void HandleDeleteRole(ushort protocol, byte[] data)
            {
                if (protocol != NetMsg.MSG_DELETE_ROLE)
                {
                    return;
                }

                S2CDeleteRole s2cDeleteRolePack = S2CPackBase.DeserializePack <S2CDeleteRole>(data);

                //此时还不知道客户端还不知道服务器当前时间,所以改为直接返回倒计时
                float delta = s2cDeleteRolePack.deadline;// - Game.Instance.ServerTime;

                if (delta > 0)
                {
                    string s = string.Format(xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_94"), Utils.Timer.GetFMTTime2(delta * 1000));
                    ui.UIWidgetHelp.GetInstance().ShowNoticeDlg(s);
                    return;
                }

                if (s2cDeleteRolePack.result != 1) // 删除不成功
                {
                    return;
                }

                // 删除选中的角色
                if (mActorGameObjects.Count > mSelectIndex)
                {
                    ClientModel actor = mActorGameObjects[mSelectIndex];
                    if (actor != null)
                    {
                        actor.mVisibleCtrl.SetActorVisible(true, VisiblePriority.EXCEPT);
                        ActorManager.Instance.DestroyActor(actor.UID);
                        mActorGameObjects.RemoveAt(mSelectIndex);
                    }
                }
                // 删除角色数据
                mData.RemoveAt(mSelectIndex);

                // 刷新角色选择框以及显示新角色
                UpdateButtonList();

                if (mSelectIndex > 0)
                {
                    mSelectIndex -= 1;
                    ShowActor(mSelectIndex);
                }
                else if (mSelectIndex == 0)
                {
                    //没有角色了
                    if (mData.Count == 0)
                    {
                        SetReomveBtnActive(false);
                        mSelectIndex    = -1;
                        mPowerText.text = "";
                    }
                    else
                    {
                        ShowActor(0);
                    }
                }
            }
Exemplo n.º 30
0
            public virtual void HandleServerData(ushort protocol, byte[] data)
            {
                switch (protocol)
                {
                case NetMsg.MSG_SPAN_BOSS_INFO:
                {
                    var pack      = S2CPackBase.DeserializePack <S2CSpanBossInfo>(data);
                    var boss_list = pack.mon_boss;

                    UpdateInfo(boss_list);

                    ClientEventMgr.Instance.FireEvent(xc.EnumUtil.EnumToInt(xc.ClientEvent.CE_WORLD_BOSS_UPDATE_BOSS_INFO_ALL), null);
                    break;
                }

                case NetMsg.MSG_BOSS_INFO:
                {
                    var pack      = S2CPackBase.DeserializePack <S2CBossInfo>(data);
                    var boss_list = pack.mons;
                    //m_isNeedUpdate = true;

                    UpdateInfo(boss_list);

                    ClientEventMgr.Instance.FireEvent(xc.EnumUtil.EnumToInt(xc.ClientEvent.CE_WORLD_BOSS_UPDATE_BOSS_INFO_ALL), null);
                    break;
                }

                case NetMsg.MSG_BOSS_AFFILIS:
                {
                    S2CBossAffilis pack = S2CPackBase.DeserializePack <S2CBossAffilis>(data);

                    mBossAffiTeamIds[pack.boss] = pack.team_id;

                    List <UpdateBossAffiItem> item_array = GetOneBossAffiItemArray_tryAdd(pack.boss);
                    for (int index = 0; index < item_array.Count; ++index)
                    {
                        item_array[index].m_before_isAffi = item_array[index].m_now_isAffi;
                        item_array[index].m_now_isAffi    = false;
                    }
                    //GameDebug.LogError("************** start");
                    //GameDebug.LogError(string.Format("[pack.uuids] pack.uuids.Count = {0}", pack.uuids.Count));
                    for (int index = 0; index < pack.uuids.Count; ++index)
                    {
                        //GameDebug.LogError(string.Format("[pack.uuids] index = {0} player_id = {1}", index, pack.uuids[index]));
                        UpdateBossAffiItem item = item_array.Find((a) =>
                            {
                                return(a.m_player_id == pack.uuids[index]);
                            });
                        if (item == null)
                        {
                            UpdateBossAffiItem tmp_item = new UpdateBossAffiItem();
                            tmp_item.m_player_id  = pack.uuids[index];
                            tmp_item.m_now_isAffi = true;
                            item_array.Add(tmp_item);
                        }
                        else
                        {
                            item.m_now_isAffi = true;
                        }
                    }
//
//                             for(int index = 0; index < m_updateBossAffiItemArray.Count; ++index)
//                             {
//                                 GameDebug.LogError(string.Format("index = {0} player_id = {1} m_now_isAffi = {2}", index, m_updateBossAffiItemArray[index].m_player_id,
//                                     m_updateBossAffiItemArray[index].m_now_isAffi));
//                             }

                    // GameDebug.LogError("************** end");
                    UpdateAffiliation(item_array);
                    break;
                }

                case NetMsg.MSG_BOSS_INFO_ALL:
                {
                    var pack = S2CPackBase.DeserializePack <S2CBossInfoAll>(data);
                    m_affili_times = pack.affili_times;
                    mBossInfoAll.Clear();
                    for (int index = 0; index < pack.mons.Count; ++index)
                    {
                        var tmp_protocol_info = RedefineBossInfo.GetInfo(pack.mons[index]);
                        mBossInfoAll.Add(tmp_protocol_info);
                    }

                    C2SSpanBossInfo pkg = new C2SSpanBossInfo();
                    Net.NetClient.GetBaseClient().SendData <C2SSpanBossInfo>(NetMsg.MSG_SPAN_BOSS_INFO, pkg);

                    ClientEventMgr.Instance.FireEvent(xc.EnumUtil.EnumToInt(xc.ClientEvent.CE_WORLD_BOSS_UPDATE_BOSS_INFO_ALL), null);
                    break;
                }

                case NetMsg.MSG_DUNGEON_BOSS_GUIDE_AFFI:
                {
                    if (SceneHelp.Instance.IsInWorldBossExperienceInstance == false)
                    {
                        return;
                    }
                    S2CDungeonBossGuideAffi   pack       = S2CPackBase.DeserializePack <S2CDungeonBossGuideAffi>(data);
                    List <UpdateBossAffiItem> item_array = GetOneBossAffiItemArray_tryAdd(1);
                    for (int index = 0; index < item_array.Count; ++index)
                    {
                        item_array[index].m_before_isAffi = item_array[index].m_now_isAffi;
                        item_array[index].m_now_isAffi    = false;
                    }
                    //GameDebug.LogError("************** start");
                    //GameDebug.LogError(string.Format("[pack.uuids] pack.uuids.Count = {0}", pack.uuids.Count));
                    for (int index = 0; index < pack.uuids.Count; ++index)
                    {
                        //GameDebug.LogError(string.Format("[pack.uuids] index = {0} player_id = {1}", index, pack.uuids[index]));
                        UpdateBossAffiItem item = item_array.Find((a) =>
                            {
                                return(a.m_player_id == pack.uuids[index]);
                            });
                        if (item == null)
                        {
                            UpdateBossAffiItem tmp_item = new UpdateBossAffiItem();
                            tmp_item.m_player_id  = pack.uuids[index];
                            tmp_item.m_now_isAffi = true;
                            item_array.Add(tmp_item);
                        }
                        else
                        {
                            item.m_now_isAffi = true;
                        }
                    }
                    UpdateAffiliation(item_array);
                    break;
                }

                default:
                    break;
                }
            }