Inheritance: global::ProtoBuf.IExtensible
Exemplo n.º 1
0
    public void RequireCreateRole(string strAccount, string strRoleName, int byCareer, int bySex, int nGameID)
    {
        if (strRoleName.Length >= 20 || strRoleName.Length < 1)
        {
            return;
        }

        NFMsg.ReqCreateRole xData = new NFMsg.ReqCreateRole();
        xData.career    = byCareer;
        xData.sex       = bySex;
        xData.noob_name = UnicodeEncoding.Default.GetBytes(strRoleName);
        xData.account   = UnicodeEncoding.Default.GetBytes(strAccount);
        xData.race      = 0;
        xData.game_id   = nGameID;

        MemoryStream stream = new MemoryStream();

        Serializer.Serialize <NFMsg.ReqCreateRole>(stream, xData);

        SendMsg(new NFCoreEx.NFIDENTID(), NFMsg.EGameMsgID.EGMI_REQ_CREATE_ROLE, stream);

        if (NFStart.Instance.bDebugMode)
        {
            NFMsg.AckRoleLiteInfoList xAckBodyData = new NFMsg.AckRoleLiteInfoList();
            NFMsg.RoleLiteInfo        info         = new NFMsg.RoleLiteInfo();

            info.career            = byCareer;
            info.sex               = bySex;
            info.noob_name         = xData.noob_name;
            info.race              = xData.race;
            info.noob_name         = xData.noob_name;
            info.id                = new NFMsg.Ident();
            info.game_id           = 1;
            info.role_level        = 1;
            info.view_record       = xData.account = UnicodeEncoding.Default.GetBytes("");
            info.delete_time       = 1;
            info.reg_time          = 1;
            info.last_offline_time = 1;
            info.last_offline_ip   = 1;
            xAckBodyData.char_data.Add(info);

            MemoryStream xAckBodyStream = new MemoryStream();
            Serializer.Serialize <NFMsg.AckRoleLiteInfoList>(xAckBodyStream, xAckBodyData);

            NFMsg.MsgBase xAckData = new NFMsg.MsgBase();
            xAckData.player_id = info.id;
            xAckData.msg_data  = xAckBodyStream.ToArray();

            MemoryStream xAckAllStream = new MemoryStream();
            Serializer.Serialize <NFMsg.MsgBase>(xAckAllStream, xAckData);

            MsgHead head = new MsgHead();
            head.unMsgID   = (UInt16)NFMsg.EGameMsgID.EGMI_ACK_ROLE_LIST;
            head.unDataLen = (UInt32)xAckAllStream.Length + (UInt32)ConstDefine.NF_PACKET_HEAD_SIZE;

            xNet.mxBinMsgEvent.OnMessageEvent(head, xAckAllStream.ToArray());
        }
    }
Exemplo n.º 2
0
        private void EGMI_ACK_ROLE_LIST(UInt16 id, MemoryStream stream)
        {
            NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream);

            NFMsg.AckRoleLiteInfoList xData = NFMsg.AckRoleLiteInfoList.Parser.ParseFrom(xMsg.msg_data);

            Debug.Log("QueryRoleList  SUCCESS : " + xData.char_data.Count);

            mRoleList.Clear();

            for (int i = 0; i < xData.char_data.Count; ++i)
            {
                NFMsg.RoleLiteInfo info = xData.char_data[i];

                Debug.Log("QueryRoleList  SUCCESS : " + info.noob_name.ToStringUtf8());

                mRoleList.Add(info);
            }


            mEventModule.DoEvent((int)NFLoginModule.Event.RoleList);

            //////////////////

            /*
             *          if (mRoleList.Count > 0)
             * {
             *  //NFCSectionManager.Instance.SetGameState(NFCSection.UI_SECTION_STATE.UISS_ROLEHALL);
             *
             *                  NFMsg.RoleLiteInfo xLiteInfo = (NFMsg.RoleLiteInfo)mRoleList[0];
             *  NFGUID xEnterID = new NFGUID();
             *  xEnterID.nData64 = xLiteInfo.id.index;
             *  xEnterID.nHead64 = xLiteInfo.id.svrid;
             *
             *                  mNetModule.RequireEnterGameServer(xEnterID, mAccount, xLiteInfo.noob_name.ToStringUtf8(), mServerID);
             *
             *  //mxNetController.mPlayerState = NFNetController.PLAYER_STATE.E_PLAYER_WAITING_TO_GAME;
             *
             *  Debug.Log("Selected role :" + xLiteInfo.noob_name.ToStringUtf8());
             * }
             * else
             * {
             *  //NFCSectionManager.Instance.SetGameState(NFCSection.UI_SECTION_STATE.UISS_CREATEHALL);
             *                  RequireCreateRole( mAccount, 0, 0, mServerID);
             *  Debug.Log("No Role!, require to create a new role! ");
             * }
             */
        }
Exemplo n.º 3
0
        private void OnRoleList(UInt16 id, MemoryStream stream)
        {
            NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream);

            NFMsg.AckRoleLiteInfoList xData = NFMsg.AckRoleLiteInfoList.Parser.ParseFrom(xMsg.msg_data);

            Debug.Log("QueryRoleList  SUCCESS");
            mRoleList.Clear();
            for (int i = 0; i < xData.char_data.Count; ++i)
            {
                NFMsg.RoleLiteInfo info = xData.char_data[i];
                mRoleList.Add(info);
            }

            mEventModule.DoEvent((int)Event.RoleList);
        }
Exemplo n.º 4
0
        // 接收消息
        private void OnRoleList(UInt16 id, MemoryStream stream)
        {
            NFMsg.MsgBase xMsg = new NFMsg.MsgBase();
            xMsg = Serializer.Deserialize <NFMsg.MsgBase>(stream);

            NFMsg.AckRoleLiteInfoList xData = new NFMsg.AckRoleLiteInfoList();
            xData = Serializer.Deserialize <NFMsg.AckRoleLiteInfoList>(new MemoryStream(xMsg.msg_data));

            Debug.Log("QueryRoleList  SUCCESS");
            mRoleList.Clear();
            for (int i = 0; i < xData.char_data.Count; ++i)
            {
                NFMsg.RoleLiteInfo info = xData.char_data[i];
                mRoleList.Add(info);
            }

            DoEvent((int)Event.RoleList);
        }
Exemplo n.º 5
0
        private void EGMI_ACK_ROLE_LIST(NFMsg.MsgBase xMsg)
        {
            NFMsg.AckRoleLiteInfoList xData = new NFMsg.AckRoleLiteInfoList();
            xData = mxSerializer.Deserialize(new MemoryStream(xMsg.msg_data), null, typeof(NFMsg.AckRoleLiteInfoList)) as NFMsg.AckRoleLiteInfoList;


            mxNetController.aCharList.Clear();

            for (int i = 0; i < xData.char_data.Count; ++i)
            {
                NFMsg.RoleLiteInfo info = xData.char_data[i];

                Debug.Log("QueryRoleList  SUCCESS : " + System.Text.Encoding.Default.GetString(info.noob_name));

                mxNetController.aCharList.Add(info);
            }

            //////////////////
            if (mxNetController.aCharList.Count > 0)
            {
                //NFCSectionManager.Instance.SetGameState(NFCSection.UI_SECTION_STATE.UISS_ROLEHALL);

                NFMsg.RoleLiteInfo xLiteInfo = (NFMsg.RoleLiteInfo)NFNetController.Instance.aCharList[0];
                NFrame.NFGUID      xEnterID  = new NFrame.NFGUID();
                xEnterID.nData64 = xLiteInfo.id.index;
                xEnterID.nHead64 = xLiteInfo.id.svrid;
                mxNetController.mxNetSender.RequireEnterGameServer(xEnterID, mxNetController.strAccount, System.Text.Encoding.Default.GetString(xLiteInfo.noob_name), mxNetController.nServerID);

                mxNetController.mPlayerState = NFNetController.PLAYER_STATE.E_PLAYER_WAITING_TO_GAME;

                Debug.Log("Selected role :" + System.Text.Encoding.Default.GetString(xLiteInfo.noob_name));
            }
            else
            {
                NFCSectionManager.Instance.SetGameState(NFCSection.UI_SECTION_STATE.UISS_CREATEHALL);

                Debug.Log("No Role!, require to create a new role! ");
            }
        }
Exemplo n.º 6
0
        private void EGMI_ACK_ROLE_LIST(MsgHead head, MemoryStream stream)
        {
            NFMsg.MsgBase xMsg = new NFMsg.MsgBase();
            xMsg = Serializer.Deserialize <NFMsg.MsgBase>(stream);

            NFMsg.AckRoleLiteInfoList xData = new NFMsg.AckRoleLiteInfoList();
            xData = Serializer.Deserialize <NFMsg.AckRoleLiteInfoList>(new MemoryStream(xMsg.msg_data));

            aCharList.Clear();
            for (int i = 0; i < xData.char_data.Count; ++i)
            {
                NFMsg.RoleLiteInfo info = xData.char_data[i];
                aCharList.Add(info);
            }

            if (NFNet.PLAYER_STATE.E_HAS_PLAYER_ROLELIST != mNet.mPlayerState)
            {
                //NFCRenderInterface.Instance.LoadScene("SelectScene");
            }

            mNet.mPlayerState = NFNet.PLAYER_STATE.E_HAS_PLAYER_ROLELIST;
        }
Exemplo n.º 7
0
        private void EGMI_ACK_ROLE_LIST(MsgHead head, MemoryStream stream)
        {
            NFMsg.MsgBase xMsg = new NFMsg.MsgBase();
            xMsg = Serializer.Deserialize<NFMsg.MsgBase>(stream);

            NFMsg.AckRoleLiteInfoList xData = new NFMsg.AckRoleLiteInfoList();
            xData = Serializer.Deserialize<NFMsg.AckRoleLiteInfoList>(new MemoryStream(xMsg.msg_data));

            Debug.Log("QueryRoleList  SUCCESS");
            aCharList.Clear();
            for (int i = 0; i < xData.char_data.Count; ++i)
            {
                NFMsg.RoleLiteInfo info = xData.char_data[i];
                aCharList.Add(info);
            }

            if (NFNet.PLAYER_STATE.E_HAS_PLAYER_ROLELIST != mNet.mPlayerState)
            {
                //NFCRenderInterface.Instance.LoadScene("SelectScene");
            }

            mNet.mPlayerState = NFNet.PLAYER_STATE.E_HAS_PLAYER_ROLELIST;
        }
Exemplo n.º 8
0
    public void RequireCreateRole(string strAccount, string strRoleName, int byCareer, int bySex, int nGameID)
    {
        if (strRoleName.Length >= 20 || strRoleName.Length < 1)
        {
            return;
        }

        NFMsg.ReqCreateRole xData = new NFMsg.ReqCreateRole();
        xData.career = byCareer;
        xData.sex = bySex;
        xData.noob_name = UnicodeEncoding.Default.GetBytes(strRoleName);
        xData.account = UnicodeEncoding.Default.GetBytes(strAccount);
        xData.race = 0;
        xData.game_id = nGameID;

        MemoryStream stream = new MemoryStream();
        Serializer.Serialize<NFMsg.ReqCreateRole>(stream, xData);

        SendMsg(new NFCoreEx.NFIDENTID(), NFMsg.EGameMsgID.EGMI_REQ_CREATE_ROLE, stream);

        if (NFStart.Instance.bDebugMode)
        {
            NFMsg.AckRoleLiteInfoList xAckBodyData = new NFMsg.AckRoleLiteInfoList();
            NFMsg.RoleLiteInfo info = new NFMsg.RoleLiteInfo();

            info.career = byCareer;
            info.sex = bySex;
            info.noob_name = xData.noob_name;
            info.race = xData.race;
            info.noob_name = xData.noob_name;
            info.id = new NFMsg.Ident();
            info.game_id = 1;
            info.role_level = 1;
            info.view_record = xData.account = UnicodeEncoding.Default.GetBytes("");
            info.delete_time = 1;
            info.reg_time = 1;
            info.last_offline_time = 1;
            info.last_offline_ip = 1;
            xAckBodyData.char_data.Add(info);

            MemoryStream xAckBodyStream = new MemoryStream();
            Serializer.Serialize<NFMsg.AckRoleLiteInfoList>(xAckBodyStream, xAckBodyData);

            NFMsg.MsgBase xAckData = new NFMsg.MsgBase();
            xAckData.player_id = info.id;
            xAckData.msg_data = xAckBodyStream.ToArray();

            MemoryStream xAckAllStream = new MemoryStream();
            Serializer.Serialize<NFMsg.MsgBase>(xAckAllStream, xAckData);

            MsgHead head = new MsgHead();
            head.unMsgID = (UInt16)NFMsg.EGameMsgID.EGMI_ACK_ROLE_LIST;
            head.unDataLen = (UInt32)xAckAllStream.Length + (UInt32)ConstDefine.NF_PACKET_HEAD_SIZE;

            xNet.mxBinMsgEvent.OnMessageEvent(head, xAckAllStream.ToArray());
        }
    }