示例#1
0
    public static PacketDistributed CreatePacket(MessageID packetID)
    {
        PacketDistributed packet = null;

        switch (packetID)
        {
        case MessageID.CSLogin: { packet = new CSLogin(); } break;

        case MessageID.SCLoginRet: { packet = new SCLoginRet(); } break;

        case MessageID.CSLoginThirdPlatform: { packet = new CSLoginThirdPlatform(); } break;

        case MessageID.SCLoginThirdPlatformRet: { packet = new SCLoginThirdPlatformRet(); } break;

        case MessageID.CSThirdPlatformVerifyCharge: { packet = new CSThirdPlatformVerifyCharge(); } break;

        case MessageID.SCThirdPlatformVerifyCharge: { packet = new SCThirdPlatformVerifyCharge(); } break;

        case MessageID.CSAskUserData: { packet = new CSAskUserData(); } break;

        case MessageID.PBUserBaseData: { packet = new PBUserBaseData(); } break;

        case MessageID.PBUserBagData: { packet = new PBUserBagData(); } break;

        case MessageID.PBUserCopyData: { packet = new PBUserCopyData(); } break;

        case MessageID.SCAskUserData: { packet = new SCAskUserData(); } break;

        case MessageID.MissionInfo: { packet = new MissionInfo(); } break;

        case MessageID.CopyInfo: { packet = new CopyInfo(); } break;

        case MessageID.ItemInfo: { packet = new ItemInfo(); } break;

        case MessageID.CardInfo: { packet = new CardInfo(); } break;

        case MessageID.DropBag: { packet = new DropBag(); } break;

        case MessageID.BattleCard: { packet = new BattleCard(); } break;

        case MessageID.CSBattleData: { packet = new CSBattleData(); } break;

        case MessageID.DataBuffInfo: { packet = new DataBuffInfo(); } break;

        case MessageID.DataSingleAction: { packet = new DataSingleAction(); } break;

        case MessageID.DataAction: { packet = new DataAction(); } break;

        case MessageID.DataRound: { packet = new DataRound(); } break;

        case MessageID.DataBattle: { packet = new DataBattle(); } break;

        case MessageID.SCBattleData: { packet = new SCBattleData(); } break;

        case MessageID.CSPVPBattleData: { packet = new CSPVPBattleData(); } break;

        case MessageID.SCPVPBattleData: { packet = new SCPVPBattleData(); } break;

        case MessageID.CSChangeMember: { packet = new CSChangeMember(); } break;

        case MessageID.SCChangeMember: { packet = new SCChangeMember(); } break;

        case MessageID.CSCardCombining: { packet = new CSCardCombining(); } break;

        case MessageID.SCCardCombiningRet: { packet = new SCCardCombiningRet(); } break;

        case MessageID.CSCardEvolve: { packet = new CSCardEvolve(); } break;

        case MessageID.SCCardEvolveRet: { packet = new SCCardEvolveRet(); } break;

        case MessageID.CSCardStrengthen: { packet = new CSCardStrengthen(); } break;

        case MessageID.SCCardStrengthenRet: { packet = new SCCardStrengthenRet(); } break;

        case MessageID.CSFriendsList: { packet = new CSFriendsList(); } break;

        case MessageID.SCFriendsList: { packet = new SCFriendsList(); } break;

        case MessageID.CSSearchFriend: { packet = new CSSearchFriend(); } break;

        case MessageID.SCSearchFriend: { packet = new SCSearchFriend(); } break;

        case MessageID.CSGiveFriendPower: { packet = new CSGiveFriendPower(); } break;

        case MessageID.SCGiveFriendPower: { packet = new SCGiveFriendPower(); } break;

        case MessageID.CSGetFriendPower: { packet = new CSGetFriendPower(); } break;

        case MessageID.SCGetFriendPower: { packet = new SCGetFriendPower(); } break;

        case MessageID.CSADDFriend: { packet = new CSADDFriend(); } break;

        case MessageID.SCADDFriend: { packet = new SCADDFriend(); } break;

        case MessageID.CSDeleteFriend: { packet = new CSDeleteFriend(); } break;

        case MessageID.SCDeleteFriend: { packet = new SCDeleteFriend(); } break;

        case MessageID.CSGetRandomAssistanceList: { packet = new CSGetRandomAssistanceList(); } break;

        case MessageID.SCGetRandomAssistanceList: { packet = new SCGetRandomAssistanceList(); } break;

        case MessageID.PBFriend: { packet = new PBFriend(); } break;

        case MessageID.CSSellCard: { packet = new CSSellCard(); } break;

        case MessageID.SCSellCard: { packet = new SCSellCard(); } break;

        case MessageID.SCErrorMsg: { packet = new SCErrorMsg(); } break;

        case MessageID.CSMailList: { packet = new CSMailList(); } break;

        case MessageID.SCMailList: { packet = new SCMailList(); } break;

        case MessageID.PBMail: { packet = new PBMail(); } break;

        case MessageID.CSMailDelete: { packet = new CSMailDelete(); } break;

        case MessageID.SCMailDelete: { packet = new SCMailDelete(); } break;

        case MessageID.CSMailSend: { packet = new CSMailSend(); } break;

        case MessageID.SCMailSend: { packet = new SCMailSend(); } break;

        case MessageID.CSMailFriend: { packet = new CSMailFriend(); } break;

        case MessageID.SCMailFriend: { packet = new SCMailFriend(); } break;

        case MessageID.CSMailSystem: { packet = new CSMailSystem(); } break;

        case MessageID.SCMailSystem: { packet = new SCMailSystem(); } break;

        case MessageID.CSMailRead: { packet = new CSMailRead(); } break;

        case MessageID.SCMailRead: { packet = new SCMailRead(); } break;

        case MessageID.CSGMcmds: { packet = new CSGMcmds(); } break;

        case MessageID.SCGMcmds: { packet = new SCGMcmds(); } break;

        case MessageID.CSTaskList: { packet = new CSTaskList(); } break;

        case MessageID.SCTaskList: { packet = new SCTaskList(); } break;

        case MessageID.PBTask: { packet = new PBTask(); } break;

        case MessageID.CSFinishTask: { packet = new CSFinishTask(); } break;

        case MessageID.SCFinishTask: { packet = new SCFinishTask(); } break;

        case MessageID.CSShop: { packet = new CSShop(); } break;

        case MessageID.SCShopRet: { packet = new SCShopRet(); } break;

        case MessageID.CSGamble: { packet = new CSGamble(); } break;

        case MessageID.SCGambleRet: { packet = new SCGambleRet(); } break;

        case MessageID.CSGuide: { packet = new CSGuide(); } break;

        case MessageID.SCGuide: { packet = new SCGuide(); } break;

        case MessageID.ButtonInfo: { packet = new ButtonInfo(); } break;

        case MessageID.CSChangeName: { packet = new CSChangeName(); } break;

        case MessageID.SCChangeName: { packet = new SCChangeName(); } break;

        case MessageID.CSBindAccount: { packet = new CSBindAccount(); } break;

        case MessageID.SCBindAccount: { packet = new SCBindAccount(); } break;

        case MessageID.CSAskPVPList: { packet = new CSAskPVPList(); } break;

        case MessageID.SCAskPVPList: { packet = new SCAskPVPList(); } break;

        case MessageID.PVPUserBaseData: { packet = new PVPUserBaseData(); } break;

        case MessageID.CSAskScoreShopFresh: { packet = new CSAskScoreShopFresh(); } break;

        case MessageID.SCAskScoreShopFresh: { packet = new SCAskScoreShopFresh(); } break;

        case MessageID.CSPVPShop: { packet = new CSPVPShop(); } break;

        case MessageID.SCPVPShopRet: { packet = new SCPVPShopRet(); } break;

        case MessageID.ProductInfo: { packet = new ProductInfo(); } break;

        case MessageID.CSProductList: { packet = new CSProductList(); } break;

        case MessageID.SCProductList: { packet = new SCProductList(); } break;

        case MessageID.CSClearBattleData: { packet = new CSClearBattleData(); } break;

        case MessageID.SCClearBattleData: { packet = new SCClearBattleData(); } break;

        case MessageID.CSRandomCardFree: { packet = new CSRandomCardFree(); } break;

        case MessageID.SCRandomCardFree: { packet = new SCRandomCardFree(); } break;

        case MessageID.CS20038: { packet = new CS20038(); } break;

        case MessageID.SC30038: { packet = new SC30038(); } break;

        case MessageID.CS20039: { packet = new CS20039(); } break;

        case MessageID.SC30039: { packet = new SC30039(); } break;

        case MessageID.CS20040: { packet = new CS20040(); } break;

        case MessageID.SC30040: { packet = new SC30040(); } break;

        case MessageID.CS20041: { packet = new CS20041(); } break;

        case MessageID.SC30041: { packet = new SC30041(); } break;

        case MessageID.CSscode: { packet = new CSscode(); } break;

        case MessageID.SCscode: { packet = new SCscode(); } break;

        case MessageID.CSCYouProductList: { packet = new CSCYouProductList(); } break;

        case MessageID.SCCYouProductList: { packet = new SCCYouProductList(); } break;

        case MessageID.CSCYouVerifyCharge: { packet = new CSCYouVerifyCharge(); } break;

        case MessageID.SCCYouVerifyCharge: { packet = new SCCYouVerifyCharge(); } break;

        case MessageID.CSPPProductList: { packet = new CSPPProductList(); } break;

        case MessageID.SCPPProductList: { packet = new SCPPProductList(); } break;

        case MessageID.CSPPVerifyCharge: { packet = new CSPPVerifyCharge(); } break;

        case MessageID.SCPPVerifyCharge: { packet = new SCPPVerifyCharge(); } break;

        case MessageID.CSBuyMoney: { packet = new CSBuyMoney(); } break;

        case MessageID.SCBuyMoney: { packet = new SCBuyMoney(); } break;

        case MessageID.CSBuyPower: { packet = new CSBuyPower(); } break;

        case MessageID.SCBuyPower: { packet = new SCBuyPower(); } break;

        case MessageID.CSSDKLoginThirdPlatform: { packet = new CSSDKLoginThirdPlatform(); } break;

        case MessageID.SCSDKLoginThirdPlatformRet: { packet = new SCSDKLoginThirdPlatformRet(); } break;

        case MessageID.CSSDKRefresh: { packet = new CSSDKRefresh(); } break;

        case MessageID.SCSDKRefreshRet: { packet = new SCSDKRefreshRet(); } break;

        case MessageID.CSCommonProductList: { packet = new CSCommonProductList(); } break;

        case MessageID.SCCommonProductListRet: { packet = new SCCommonProductListRet(); } break;

        case MessageID.CSCYouPayVerifyCharge: { packet = new CSCYouPayVerifyCharge(); } break;

        case MessageID.SCCYouPayVerifyChargeRet: { packet = new SCCYouPayVerifyChargeRet(); } break;

        case MessageID.CSGGL: { packet = new CSGGL(); } break;

        case MessageID.SCGGL: { packet = new SCGGL(); } break;

        case MessageID.CSWuxingActivation: { packet = new CSWuxingActivation(); } break;

        case MessageID.SCWuxingActivation: { packet = new SCWuxingActivation(); } break;

        case MessageID.CSWuxingLevelup: { packet = new CSWuxingLevelup(); } break;

        case MessageID.SCWuxingLevelup: { packet = new SCWuxingLevelup(); } break;

        case MessageID.CSWuxingReset: { packet = new CSWuxingReset(); } break;

        case MessageID.SCWuxingReset: { packet = new SCWuxingReset(); } break;

        case MessageID.WuxingInfo: { packet = new WuxingInfo(); } break;

        case MessageID.SuipianInfo: { packet = new SuipianInfo(); } break;

        case MessageID.FengshuiInfo: { packet = new FengshuiInfo(); } break;

        case MessageID.CSBGZ: { packet = new CSBGZ(); } break;

        case MessageID.SCBGZ: { packet = new SCBGZ(); } break;

        case MessageID.MonthCardInfo: { packet = new MonthCardInfo(); } break;

        case MessageID.CSMonthCardGetDollar: { packet = new CSMonthCardGetDollar(); } break;

        case MessageID.SCMonthCardGetDollar: { packet = new SCMonthCardGetDollar(); } break;

        case MessageID.MonthReward: { packet = new MonthReward(); } break;

        case MessageID.CSMonthCardInfo: { packet = new CSMonthCardInfo(); } break;

        case MessageID.SCMonthCardInfo: { packet = new SCMonthCardInfo(); } break;

        case MessageID.CSFriendMailDelete: { packet = new CSFriendMailDelete(); } break;

        case MessageID.SCFriendMailDelete: { packet = new SCFriendMailDelete(); } break;

        case MessageID.CSStudySkill: { packet = new CSStudySkill(); } break;

        case MessageID.SCStudySkill: { packet = new SCStudySkill(); } break;

        case MessageID.CSStudySkillUpdate: { packet = new CSStudySkillUpdate(); } break;

        case MessageID.SCStudySkillUpdate: { packet = new SCStudySkillUpdate(); } break;

        case MessageID.CSQxzbPVPDataAsk: { packet = new CSQxzbPVPDataAsk(); } break;

        case MessageID.SCQxzbPVPDataAsk: { packet = new SCQxzbPVPDataAsk(); } break;

        case MessageID.CSQxzbBattle: { packet = new CSQxzbBattle(); } break;

        case MessageID.SCQxzbBattle: { packet = new SCQxzbBattle(); } break;

        case MessageID.CSQxzbPVPClearCD: { packet = new CSQxzbPVPClearCD(); } break;

        case MessageID.SCQxzbPVPClearCD: { packet = new SCQxzbPVPClearCD(); } break;

        case MessageID.CSQxzbGetReward: { packet = new CSQxzbGetReward(); } break;

        case MessageID.SCQxzbGetReward: { packet = new SCQxzbGetReward(); } break;

        case MessageID.CSPaiTaBattleData: { packet = new CSPaiTaBattleData(); } break;

        case MessageID.SCPaiTaBattleData: { packet = new SCPaiTaBattleData(); } break;

        case MessageID.CSClearPaiTaBattleData: { packet = new CSClearPaiTaBattleData(); } break;

        case MessageID.SCClearPaiTaBattleData: { packet = new SCClearPaiTaBattleData(); } break;

        case MessageID.CSAskWorldBossInfo: { packet = new CSAskWorldBossInfo(); } break;

        case MessageID.SCAskWorldBossInfo: { packet = new SCAskWorldBossInfo(); } break;

        case MessageID.WorldBoss: { packet = new WorldBoss(); } break;

        case MessageID.WorldBossKillInfo: { packet = new WorldBossKillInfo(); } break;

        case MessageID.WorldBossAttInfo: { packet = new WorldBossAttInfo(); } break;

        case MessageID.WorldBossDamageRankInfo: { packet = new WorldBossDamageRankInfo(); } break;

        case MessageID.CSAskWorldBossBattle: { packet = new CSAskWorldBossBattle(); } break;

        case MessageID.SCAskWorldBossBattle: { packet = new SCAskWorldBossBattle(); } break;

        case MessageID.CSWorldBossAddZhufu: { packet = new CSWorldBossAddZhufu(); } break;

        case MessageID.SCWorldBossAddZhufu: { packet = new SCWorldBossAddZhufu(); } break;

        case MessageID.CSWorldBossResurgence: { packet = new CSWorldBossResurgence(); } break;

        case MessageID.SCWorldBossResurgence: { packet = new SCWorldBossResurgence(); } break;

        case MessageID.CSAskActivity: { packet = new CSAskActivity(); } break;

        case MessageID.SCAskActivity: { packet = new SCAskActivity(); } break;

        case MessageID.ActivityInfo: { packet = new ActivityInfo(); } break;

        case MessageID.ChangeCardInfo: { packet = new ChangeCardInfo(); } break;

        case MessageID.cardGuidAndTempleID: { packet = new cardGuidAndTempleID(); } break;

        case MessageID.CSAskChangeCardList: { packet = new CSAskChangeCardList(); } break;

        case MessageID.SCAskChangeCardList: { packet = new SCAskChangeCardList(); } break;

        case MessageID.CSChangeCardConfirm: { packet = new CSChangeCardConfirm(); } break;

        case MessageID.SCChangeCardConfirm: { packet = new SCChangeCardConfirm(); } break;

        case MessageID.CSWorldBossWeekRank: { packet = new CSWorldBossWeekRank(); } break;

        case MessageID.SCWorldBossWeekRank: { packet = new SCWorldBossWeekRank(); } break;

        case MessageID.CSWorldBossWeekReward: { packet = new CSWorldBossWeekReward(); } break;

        case MessageID.SCWorldBossWeekReward: { packet = new SCWorldBossWeekReward(); } break;

        case MessageID.CSTaskOver: { packet = new CSTaskOver(); } break;

        case MessageID.SCTaskOver: { packet = new SCTaskOver(); } break;

        case MessageID.PBYunyingHuodong: { packet = new PBYunyingHuodong(); } break;

        case MessageID.CSYunyingHuodong: { packet = new CSYunyingHuodong(); } break;

        case MessageID.SCYunyingHuodong: { packet = new SCYunyingHuodong(); } break;

        case MessageID.CSGooglePayVerifyCharge: { packet = new CSGooglePayVerifyCharge(); } break;

        case MessageID.SCGooglePayVerifyChargeRet: { packet = new SCGooglePayVerifyChargeRet(); } break;
        }
        if (null != packet)
        {
            packet.packetID = packetID;
        }
        //netActionTime = DateTime.Now.ToFileTimeUtc();
        return(packet);
    }
        public bool handle(MessageID opcode, byte[] data)
        {
            //			Debug.Log("Receive message:"+ opcode);
            //			MemoryStream msData = new MemoryStream(data);

            bool handled = true;

            switch (opcode)
            {
            case MessageID.SCErrorMsg:
                SCErrorMsg errorMsg = new SCErrorMsg();    //Serializer.Deserialize<SCErrorMsg>(msData);
                errorMsg.ParseFrom(data);
                //cb: a example PBMessage.SCErrorMsg.ErrorType.SELL_CARD
                Debug.LogError("Error Message:" + (ErrorType)errorMsg.Type);
                //				NGUIDebug.Log("Error Message:"+(ErrorType)errorMsg.Type);
                //if((ErrorType)errorMsg.Type != ErrorType.CARD_COMBINE ||
                //	(ErrorType)errorMsg.Type != ErrorType.CARD_EVOLVE ||
                //	 (ErrorType)errorMsg.Type != ErrorType.CARD_STRENGTHEN)
                if ((ErrorType)errorMsg.Type != ErrorType.CARD_COMBINE)          //卡牌升级特殊处理//
                {
                    UIListener.Instance().OnReceiveMsg(false);
                    //解除发送锁, 发送成功,接受到错误信息
                    NetworkSender.Instance().sendFinish(true);
                }
                else
                {
                }
                //				if(UIListener.Instance().isBlock)
                //				{
                //					BoxManager.removeMessage();
                //					UIListener.Instance().isBlock = false;
                //				}
#if UNITY_ANDROID
                if (((ErrorType)errorMsg.Type) == ErrorType.BAG_FULL)
                {
                    if (GameManager.Instance.sceneName.Equals(Utils.UI_NAME_Battle))
                    {
                        // 战斗场景不发送 //
                        return(handled);
                    }
                }
                if (((ErrorType)errorMsg.Type) == ErrorType.LOGIN_VERSION_WRONG)
                {
                    if (AndroidConfig.versionWrong(errorMsg.Version))
                    {
                        return(handled);
                    }
                }
#endif
                BoxManager.showErrorMessage(errorMsg.Type);
                if ((ErrorType)errorMsg.Type == ErrorType.POWER_SEND_ALREADY)
                {
                    UIEventListener.Get(BoxManager.buttonYes).onClick += On_PowerSendAlready_ErrorMsgButtonClick;
                }
                Obj_MyselfPlayer.GetMe().battel_sign = 1;
                return(handled);

            case MessageID.SCLoginRet:
                //登录返回消息
                SCLoginRet loginRet = new SCLoginRet();    //Serializer.Deserialize<SCLoginRet>(msData);
                loginRet.ParseFrom(data);

                //王明磊 - 保存本次登录的AccountID 表示本次登录的统计信息所属
                if (loginRet.AccountId != null && loginRet.AccountId.ToString() != "")
                {
                    PlayerPrefs.SetString("LastAccountId", loginRet.AccountId.ToString());
                }
                if (loginRet.HasUid)
                {
                    PlayerPrefs.SetString("PLAYER_UID", loginRet.Uid);    //记录用户uid
                    Debug.LogWarning("PLAYER_UID	|	"+ loginRet.Uid);
                    Obj_MyselfPlayer.GetMe().uid = loginRet.Uid;
                }
                Obj_MyselfPlayer.GetMe().giftison = loginRet.Giftison;
                //如果是畅游账号登录或注册--
                if (loginRet.HasType)
                {
                    Obj_MyselfPlayer.GetMe().SetCyouLoginData(loginRet);
                }
                else
                {
                    //检查登陆状态
                    //1.新玩家 2.老玩家
                    Debug.Log("登录成功");
                    //设置用户已登陆标志
                    GameManager.userLoginDone();
                    Obj_MyselfPlayer.GetMe().SetLoginData(loginRet);
                    //打印返回信息
                    Debug.Log("state:" + loginRet.State);
                    Debug.Log("AccountId:" + loginRet.AccountId);
                    loginRet = null;
                }
                //王明磊 - 清理过期统计数据
                for (int btnNo = 1; btnNo <= 58; btnNo++)
                {
                    string key = "Btn" + btnNo.ToString();
                    if (PlayerPrefs.HasKey(key))
                    {
                        PlayerPrefs.DeleteKey(key);
                    }
                }
                //PlayerPrefs.DeleteKey("LastAccountId");
                PlayerPrefs.SetInt("Btn1", PlayerPrefs.GetInt("Btn-1"));
                PlayerPrefs.SetInt("Btn2", PlayerPrefs.GetInt("Btn-2"));
                break;

#if UNITY_ANDROID
            // UC 登录验证后
            case MessageID.SCLoginThirdPlatformRet:
                SCLogin(data);
                break;

            case MessageID.SCSDKLoginThirdPlatformRet:
                SCLogin(data);
                break;
#endif
            case MessageID.SCAskUserData:
                SCAskUserData msgData = new SCAskUserData();    //Serializer.Deserialize<SCAskUserData>(msData);
                msgData.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().setUserInfo(msgData);
                msgData = null;
                break;

            case MessageID.SCPVPBattleData:
                Debug.LogWarning("SCPVPBattleData");
                SCPVPBattleData pvpData = new SCPVPBattleData();
                pvpData.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().SetPVPBattleData(pvpData);
                Obj_MyselfPlayer.GetMe().battleType  = Games.Battle.BattleType.PVP;
                Obj_MyselfPlayer.GetMe().battel_sign = 2;      //进入加载场景
                break;

            case MessageID.SCBattleData:
                Debug.LogWarning("SCBattleData");
                SCBattleData battleData = new SCBattleData();    //Serializer.Deserialize<SCBattleData>(msData);
                battleData.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().SetBattleData(battleData);
                Obj_MyselfPlayer.GetMe().battleType  = Games.Battle.BattleType.PVE;
                Obj_MyselfPlayer.GetMe().battel_sign = 2;      //进入加载场景
                Debug.Log("battle data");
                break;

            case MessageID.SCAskWorldBossBattle:
                Debug.Log("SCAskWorldBossBattle");
                SCAskWorldBossBattle scawbb = new SCAskWorldBossBattle();
                scawbb.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().SetBattleData(scawbb);
                Obj_MyselfPlayer.GetMe().battleType  = Games.Battle.BattleType.WORLD_BOSS;
                Obj_MyselfPlayer.GetMe().battel_sign = 2;      //进入加载场景
                Debug.Log("world boss battle data");
                break;

            case MessageID.SCPaiTaBattleData:
                Debug.LogWarning("SCPaiTaBattleData");
                SCPaiTaBattleData pataBattleData = new SCPaiTaBattleData();
                pataBattleData.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().SetBattleData(pataBattleData);
                Obj_MyselfPlayer.GetMe().battleType  = Games.Battle.BattleType.CHONG_LOU;
                Obj_MyselfPlayer.GetMe().battel_sign = 2;      //进入加载场景
                //Obj_MyselfPlayer.GetMe().pataNum = pataBattleData.Num;
                Debug.Log("chonglou battle data");
                break;

            case MessageID.SCClearBattleData:
                SCClearBattleData clearData = new SCClearBattleData();
                clearData.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().SetClearBattleData(clearData);
                break;

            case MessageID.SCClearPaiTaBattleData:
                SCClearPaiTaBattleData clearPataData = new SCClearPaiTaBattleData();
                clearPataData.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().SetClearPataBattleData(clearPataData);
                break;

            case MessageID.SCCardCombiningRet:
                SCCardCombiningRet combineData = new SCCardCombiningRet();
                combineData.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().SetCardCombingData(combineData);
                break;

            case MessageID.SCCardEvolveRet:
                SCCardEvolveRet evolveData = new SCCardEvolveRet();
                evolveData.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().SetCardEvolutionData(evolveData);
                break;

            case MessageID.SCCardStrengthenRet:
                SCCardStrengthenRet sthData = new SCCardStrengthenRet();
                sthData.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().SetCardStrengthenData(sthData);
                break;

            case MessageID.SCFriendsList:
                SCFriendsList friendList = new SCFriendsList();    //Serializer.Deserialize<SCFriendsList>(msData);
                friendList.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().setFriendsData(friendList, friendList.Friends_num, friendList.Friends_max);
                friendList = null;
                break;

            case MessageID.SCSearchFriend:
                SCSearchFriend sf = new SCSearchFriend();    //Serializer.Deserialize<SCSearchFriend>(msData);
                sf.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().setSearchResult(sf);
                break;

            case MessageID.SCGiveFriendPower:
                SCGiveFriendPower gsf = new SCGiveFriendPower();    //Serializer.Deserialize<SCGiveFriendPower>(msData);
                gsf.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().giveFriendPower(gsf);

                /*
                 *      if(gsf.State == 1)
                 *              BoxManager.showMessageByID((int)MessageIdEnum.Msg190);
                 *      else if( gsf.State == 2)
                 *              BoxManager.showMessageByID((int)MessageIdEnum.Msg17);
                 */
                break;

            case MessageID.SCGetFriendPower:
                SCGetFriendPower gfp = new SCGetFriendPower();    //Serializer.Deserialize<SCGetFriendPower>(msData);
                gfp.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().getFriendPower(gfp);
                break;

            case MessageID.SCADDFriend:
                SCADDFriend addf = new SCADDFriend();    //Serializer.Deserialize<SCADDFriend>(msData);
                addf.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().addFriend(addf);
                break;

            case MessageID.SCDeleteFriend:
                SCDeleteFriend df = new SCDeleteFriend();    //Serializer.Deserialize<SCDeleteFriend>(msData);
                df.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().deleteFriend(df);
                break;

            case MessageID.SCGetRandomAssistanceList:
                SCGetRandomAssistanceList gral = new SCGetRandomAssistanceList();    //Serializer.Deserialize<SCGetRandomAssistanceList>(msData);
                gral.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().setAssistanceList(gral);
                break;

            case MessageID.SCSellCard:
                SCSellCard sellc = new SCSellCard();    //Serializer.Deserialize<SCSellCard>(msData);
                sellc.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().setSellCard(sellc);
                break;

            case MessageID.SCTaskList:
                SCTaskList tasklist = new SCTaskList();    //Serializer.Deserialize<SCTaskList>(msData);
                tasklist.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().setTaskData(tasklist);
                break;

            case MessageID.SCFinishTask:
                SCFinishTask finishTask = new SCFinishTask();    //Serializer.Deserialize<SCFinishTask>(msData);
                finishTask.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().setFinishTask(finishTask);
                break;

            case MessageID.SCChangeMember:
                SCChangeMember changeMember = new SCChangeMember();    //Serializer.Deserialize<SCChangeMember>(msData);
                changeMember.ParseFrom(data);
                if (changeMember.HasBagData)
                {
                    Obj_MyselfPlayer.GetMe().SetUserBagData(changeMember.BagData);
                }
                break;

            case MessageID.SCMailList:
                SCMailList mailList = new SCMailList();
                mailList.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().setMailList(mailList);
                break;

            case MessageID.SCMailSystem:
                SCMailSystem mailSystem = new SCMailSystem();
                mailSystem.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().receiveGoods(mailSystem);
                break;

            case MessageID.SCMailFriend:
                SCMailFriend mailFriend = new SCMailFriend();
                mailFriend.ParseFrom(data);
                break;

            case MessageID.SCMailDelete:
                SCMailDelete mailDelete = new SCMailDelete();
                mailDelete.ParseFrom(data);
                break;

            case MessageID.SCMailRead:
                SCMailRead mailRead = new SCMailRead();
                mailRead.ParseFrom(data);
                break;

            case MessageID.SCMailSend:
                SCMailSend mailSend = new SCMailSend();
                mailSend.ParseFrom(data);
                //Obj_MyselfPlayer.GetMe().mailState=mailSend.State;
                break;

            case MessageID.SCGMcmds:
                //GM工具返回消息
                SCGMcmds gmCmd = new SCGMcmds();
                gmCmd.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().GMCommand(gmCmd);
                gmCmd = null;
                break;

            case MessageID.SCGambleRet:
                SCGambleRet lotteryRet = new SCGambleRet();
                lotteryRet.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().setLotteryData(lotteryRet);
                break;

            case MessageID.SCGuide:

                SCGuide guideRet = new SCGuide();
                guideRet.ParseFrom(data);
                //				Debug.Log("Receive Finish Step num:"+guideRet.Finish_step);
                //				Debug.Log("Receive Finish Step:"+(GuideManager.GUIDE_STEP)guideRet.Finish_step);
                //				GuideManager.Instance.FinishedStep((GuideManager.GUIDE_STEP)guideRet.Finish_step);
                GuideManager.Instance.FinishedStep(GuideManager.GUIDE_STEP.END);
                if (guideRet.HasBaseData)
                {
                    Obj_MyselfPlayer.GetMe().SetUserBaseData(guideRet.BaseData);
                }
                if (guideRet.HasBagData)
                {
                    Obj_MyselfPlayer.GetMe().SetUserBagData(guideRet.BagData);
                }
                break;

            case MessageID.SCShopRet:

                SCShopRet shopRet = new SCShopRet();
                shopRet.ParseFrom(data);
                Debug.Log("Receive SCShopRet: Result is : " + shopRet.Result);
                if (shopRet.HasBaseData)
                {
                    Obj_MyselfPlayer.GetMe().SetUserBaseData(shopRet.BaseData);
                }
                break;

            case MessageID.SCPVPShopRet:
                SCPVPShopRet pvpShopRet = new SCPVPShopRet();
                pvpShopRet.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().SetPvPShopBuyRetData(pvpShopRet);

                break;

            case MessageID.SCAskScoreShopFresh:
                SCAskScoreShopFresh pvpShopScore = new SCAskScoreShopFresh();
                pvpShopScore.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().SetPvPShopScore(pvpShopScore);
                break;

            //王明磊 : 统计模块代码 -> Statistics
            //case MessageID.SCStatistics:
            //	SCStatistics stat = new SCStatistics();
            //	stat.ParseFrom(data);
            //	if(stat.Issuccess == 1)
            //		Debug.Log("upload Data Sucess!!!!");
            //	else if (stat.Issuccess == 2)
            //		Debug.Log("upload Data Error!!!");
            //	else
            //		Debug.Log(stat.Issuccess + " Unknow ERROR!!!!!!");
            //	break;
            case MessageID.SCChangeName:

                SCChangeName changeName = new SCChangeName();
                changeName.ParseFrom(data);
                Debug.Log("Receive SCChangeName: Result is : " + changeName.Type);
                if (changeName.HasType)
                {
                    Obj_MyselfPlayer.GetMe().changeNameType = changeName.Type;
                }
                if (changeName.HasBaseData)
                {
                    Obj_MyselfPlayer.GetMe().SetUserBaseData(changeName.BaseData);
                }
                break;

            case MessageID.SCBindAccount:
                SCBindAccount account = new SCBindAccount();
                account.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().SetCyouBindData(account);
                break;

            case MessageID.SCAskPVPList:
                SCAskPVPList pvpMsg = new SCAskPVPList();
                pvpMsg.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().SetPVPPlayerInfoData(pvpMsg);
                break;

            case MessageID.SCProductList:
                SCProductList product = new SCProductList();
                product.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().setPurchaseInfoData(product);
                break;

            case MessageID.SCRandomCardFree:
                SCRandomCardFree cardFree = new SCRandomCardFree();
                cardFree.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().setFreeLotteryData(cardFree);
                break;

            case MessageID.SCscode:
                SCscode retcode = new SCscode();
                retcode.ParseFrom(data);
                bool bGet = false;
                if (retcode.HasBagData)
                {
                    Obj_MyselfPlayer.GetMe().SetUserBagData(retcode.BagData);
                    bGet = true;
                }

                if (retcode.HasBaseData)
                {
                    Obj_MyselfPlayer.GetMe().SetUserBaseData(retcode.BaseData);
                    bGet = true;
                }

                GiftWindow.bSuccessGet = bGet;

                break;

            case MessageID.SC30039:     // 爱贝验证结果
                SC30039 iappResult = new SC30039();
                iappResult.ParseFrom(data);
                PurchaseHelper.PayVarifyResult = iappResult.Result;
                Obj_MyselfPlayer.GetMe().dollar = iappResult.PlayerDollar;
                break;

            case MessageID.SC30041:         // APPSTROE验证结果
                SC30041 appStroeResult = new SC30041();
                appStroeResult.ParseFrom(data);
                PurchaseHelper.PayVarifyResult        = appStroeResult.Result;
                PurchaseHelper.PayVarifyResultOrderID = appStroeResult.OrderId;
                Obj_MyselfPlayer.GetMe().dollar = appStroeResult.PlayerDollar;
                break;

            case MessageID.SCPPVerifyCharge:     // pp付费验证
                SCPPVerifyCharge ppResult = new SCPPVerifyCharge();
                ppResult.ParseFrom(data);
                PurchaseHelper.PayVarifyResult = ppResult.Result;
                Obj_MyselfPlayer.GetMe().dollar = ppResult.PlayerDollar;
                break;

            case MessageID.SC30038:         // 爱贝商品列表
                SC30038 productIAppPay = new SC30038();
                productIAppPay.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().setPurchaseInfoData(productIAppPay);
                break;

            case MessageID.SC30040:         // appstore商品列表
                SC30040 productAppStore = new SC30040();
                productAppStore.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().setPurchaseInfoData(productAppStore);
                break;

            case MessageID.SCBuyMoney:
                SCBuyMoney buyMoney = new SCBuyMoney();
                buyMoney.ParseFrom(data);
                if (buyMoney.HasBaseData)
                {
                    Obj_MyselfPlayer.GetMe().SetUserBaseData(buyMoney.BaseData);
                }
                break;

            case MessageID.SCBuyPower:
                SCBuyPower buyPower = new SCBuyPower();
                buyPower.ParseFrom(data);
                if (buyPower.HasBaseData)
                {
                    Obj_MyselfPlayer.GetMe().SetUserBaseData(buyPower.BaseData);
                }
                break;

            case MessageID.SCPPProductList:     // pp 商品列表
                SCPPProductList productPP = new SCPPProductList();
                productPP.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().setPurchaseInfoData(productPP);
                break;

            case MessageID.SCGGL:      //刮刮乐
                SCGGL msg = new SCGGL();
                msg.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().SetGGL(msg);
                break;

            case MessageID.SCWuxingActivation:
                SCWuxingActivation wuxingAct = new SCWuxingActivation();
                wuxingAct.ParseFrom(data);
                if (wuxingAct.HasFengshui)
                {
                    Obj_MyselfPlayer.GetMe().SetFengshiInfo(wuxingAct.Fengshui);
                }
                break;

            case MessageID.SCWuxingLevelup:
                SCWuxingLevelup wuxingLev = new SCWuxingLevelup();
                wuxingLev.ParseFrom(data);
                if (wuxingLev.HasFengshui)
                {
                    Obj_MyselfPlayer.GetMe().SetFengshiInfo(wuxingLev.Fengshui);
                }
                break;

            case MessageID.SCWuxingReset:
                SCWuxingReset wuxingReset = new SCWuxingReset();
                wuxingReset.ParseFrom(data);
                if (wuxingReset.HasFengshui)
                {
                    Obj_MyselfPlayer.GetMe().SetFengshiInfo(wuxingReset.Fengshui);
                }
                break;

            case MessageID.SCBGZ:      //八卦阵
                SCBGZ BGZmsg = new SCBGZ();
                BGZmsg.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().SetBZT(BGZmsg);
                break;

            case MessageID.SCMonthCardInfo:
                SCMonthCardInfo cardInfo = new SCMonthCardInfo();
                cardInfo.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().setMonthCardInfo(cardInfo);
                break;

            case MessageID.SCMonthCardGetDollar:
                SCMonthCardGetDollar monthCardReceive = new SCMonthCardGetDollar();
                monthCardReceive.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().SetUserBaseData(monthCardReceive.BaseData);
                Obj_MyselfPlayer.GetMe().SetUserBagData(monthCardReceive.BagData);
                break;

            case MessageID.SCFriendMailDelete:
                SCFriendMailDelete friendMailDelete = new SCFriendMailDelete();
                friendMailDelete.ParseFrom(data);
                break;

            case MessageID.SCStudySkill:
                SCStudySkill stydySkill = new SCStudySkill();
                stydySkill.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().SetUserBaseData(stydySkill.BaseData);
                Obj_MyselfPlayer.GetMe().SetUserBagData(stydySkill.BagData);
                break;

            case MessageID.SCStudySkillUpdate:
                SCStudySkillUpdate skillUpdate = new SCStudySkillUpdate();
                skillUpdate.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().SetUserBaseData(skillUpdate.BaseData);
                Obj_MyselfPlayer.GetMe().SetUserBagData(skillUpdate.BagData);
                break;

            case MessageID.SCQxzbPVPDataAsk:
                SCQxzbPVPDataAsk qxzbMsg = new SCQxzbPVPDataAsk();
                qxzbMsg.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().SetQxzbPvPDataInfo(qxzbMsg);
                break;

            case MessageID.SCQxzbBattle:
                SCQxzbBattle qxzbBattle = new SCQxzbBattle();
                qxzbBattle.ParseFrom(data);

                SCPVPBattleData qxzbBattleData = new SCPVPBattleData();
                qxzbBattleData.CopyData = qxzbBattle.CopyData;
                qxzbBattleData.BagData  = qxzbBattle.BagData;
                qxzbBattleData.BaseData = qxzbBattle.BaseData;
                qxzbBattleData.Battle   = qxzbBattle.Battle;

                Obj_MyselfPlayer.GetMe().nQxzbMoney = qxzbBattle.Money;
                Obj_MyselfPlayer.GetMe().SetPVPBattleData(qxzbBattleData);
                Obj_MyselfPlayer.GetMe().battleType  = Games.Battle.BattleType.QxzbPvP;
                Obj_MyselfPlayer.GetMe().battel_sign = 2;      //进入加载场景
                break;

            case MessageID.SCAskWorldBossInfo:
                SCAskWorldBossInfo askWorldBossInfo = new SCAskWorldBossInfo();
                askWorldBossInfo.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().SetWorldBossInfo(askWorldBossInfo);
                break;

            case MessageID.SCWorldBossAddZhufu:
                SCWorldBossAddZhufu worldBossAddZhufu = new SCWorldBossAddZhufu();
                worldBossAddZhufu.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().SetWorldBossBuffInfo(worldBossAddZhufu);
                break;

            case MessageID.SCWorldBossResurgence:
                SCWorldBossResurgence worldBossResurgence = new SCWorldBossResurgence();
                worldBossResurgence.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().SetWorldBossResurgenceInfo(worldBossResurgence);
                break;

            case MessageID.SCQxzbPVPClearCD:
                SCQxzbPVPClearCD pvpClearCD = new SCQxzbPVPClearCD();
                pvpClearCD.ParseFrom(data);
                break;

            case MessageID.SCWorldBossWeekRank:
                SCWorldBossWeekRank worldBossWeedRank = new SCWorldBossWeekRank();
                worldBossWeedRank.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().SetWorldBossRank(worldBossWeedRank);
                break;

            case MessageID.SCAskActivity:
                SCAskActivity askActivity = new SCAskActivity();
                askActivity.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().SetActivityData(askActivity);
                break;

            case MessageID.SCAskChangeCardList:
                SCAskChangeCardList changeCardList = new SCAskChangeCardList();
                changeCardList.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().SetChangeCardListData(changeCardList);
                break;

            case MessageID.SCChangeCardConfirm:
                SCChangeCardConfirm changeCardConfirm = new SCChangeCardConfirm();
                changeCardConfirm.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().SetChangeCardConfirmData(changeCardConfirm);
                break;

            case MessageID.SCWorldBossWeekReward:
                SCWorldBossWeekReward worldBossWeedReward = new SCWorldBossWeekReward();
                worldBossWeedReward.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().rewardLev = worldBossWeedReward.RewardLev;
                Obj_MyselfPlayer.GetMe().SetUserBaseData(worldBossWeedReward.BaseData);
                Obj_MyselfPlayer.GetMe().hasWorldBossReward = worldBossWeedReward.HasReward;
                break;

            case MessageID.SCQxzbGetReward:
                SCQxzbGetReward scqxzbgetreward     = new SCQxzbGetReward();
                Obj_MyselfPlayer.GetMe().get_result = scqxzbgetreward.Result;
                break;

#if     UNITY_ANDROID
            case MessageID.SCCYouProductList:
            {
                SCCYouProductList productCYou = new SCCYouProductList();
                productCYou.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().setPurchaseInfoData(productCYou);
            }
            break;

            case MessageID.SCCommonProductListRet:
                SCCommonProductListRet productCom = new SCCommonProductListRet();
                Debug.Log("----data===" + data.Length);
                productCom.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().setThirdPurchaseInfoData(productCom);
                break;

            case MessageID.SCCYouVerifyCharge:
            {
                AndroidConfig.SCVerifyCharge(data);
            }
            break;

            case MessageID.SCThirdPlatformVerifyCharge:
            {
                AndroidConfig.SCVerifyCharge(data);
            }
            break;

            case MessageID.SCCYouPayVerifyChargeRet:
                AndroidConfig.SCVerifyCharge(data);
                break;

            case MessageID.SCGooglePayVerifyChargeRet:
                AndroidConfig.SCVerifyCharge(data);
                break;
#endif
            case MessageID.SCTaskOver:
                Debug.Log("NetworkReceiver SCTaskOver");
                SCTaskOver scTaskOver = new SCTaskOver();
                scTaskOver.ParseFrom(data);
                Obj_MyselfPlayer.GetMe().requestTaskSuccess = scTaskOver.TaskOver > 0?true:false;
                break;

            case MessageID.SCYunyingHuodong:
                Debug.Log("NetworkReceiver SCYunyingHuodong");
                SCYunyingHuodong scYunyingHuodong = new SCYunyingHuodong();
                scYunyingHuodong.ParseFrom(data);

                Obj_MyselfPlayer.GetMe().SetYunyinghuodong(scYunyingHuodong);

                break;

            default:
                handled = false;
                break;
            }
            NetworkSender.Instance().sendFinish(true);
            UIListener.Instance().OnReceiveMsg(handled);
            //			UIListener.Instance().resetListener();
            return(handled);
        }