void OnFreeScence(byte[] data, int dataSize)
        {
            var typeValue     = typeof(CMD_S_StatusFree);
            int localDataSize = Marshal.SizeOf(typeValue);

            if (dataSize != localDataSize)
            {
                Debug.LogError("OnFreeScence:localDataSize=" + localDataSize + ", serverDataSize=" + dataSize);
                return;
            }

            CMD_S_StatusFree pNetInfo = (CMD_S_StatusFree)StructConverterByteArray.BytesToStruct(data, typeValue);

            GlobalUserInfo    pGlobalUserInfo = GlobalUserInfo.GetInstance();
            tagGlobalUserData pGlobalUserData = pGlobalUserInfo.GetGlobalUserData();

            pGlobalUserData.cbMapIndexRand = pNetInfo.cbMapIndex;
            pGlobalUserData.wRandseed      = pNetInfo.wRandseed;
            pGlobalUserData.wRandseedForRandomGameObject = pNetInfo.wRandseedForRandomGameObject;
            pGlobalUserData.wRandseedForInventory        = pNetInfo.wRandseedForInventory;
            //道具同步
            Array.Copy(pNetInfo.sInventoryList, pGlobalUserData.sInventoryList, pNetInfo.sInventoryList.Length);
            //Buffer.BlockCopy(pNetInfo.sInventoryList, 0, pGlobalUserData.sInventoryList, 0, pNetInfo.sInventoryList.Length);

            Loom.QueueOnMainThread(() =>
            {
                hnManager.LoadHideSeekSceneOfWangHu();
            });
        }
예제 #2
0
        //功能函数
        //插入数据
        public bool AddPacket(byte[] pData, ushort wDataType)
        {
            if ((pData.Length + Marshal.SizeOf(m_ttagDataDescribe) + m_wDataSize) > m_wMaxBytes)
            {
                return(false);
            }

            //插入数据
            tagDataDescribe pDataDescribe = new tagDataDescribe();

            pDataDescribe.wDataSize     = (ushort)pData.Length;
            pDataDescribe.wDataDescribe = wDataType;
            var buf = StructConverterByteArray.StructToBytes(pDataDescribe);

            Buffer.BlockCopy(buf, 0, m_pcbBuffer, m_wDataSize, buf.Length);
            //tagDataDescribe* pDataDescribe = (tagDataDescribe*)(m_pcbBuffer + m_wDataSize);
            //pDataDescribe->wDataSize = wDataSize;
            //pDataDescribe->wDataDescribe = wDataType;

            //插入数据
            if (pData.Length > 0)
            {
                Buffer.BlockCopy(pData, 0, m_pcbBuffer, m_wDataSize + buf.Length, pData.Length);
                //memcpy(pDataDescribe + 1, pData, wDataSize);
            }

            //设置数据
            m_wDataSize += (ushort)(buf.Length + pData.Length);

            return(true);
        }
예제 #3
0
        private bool onSubQueryInfoResult(byte[] data, int size)
        {
            if (size != Marshal.SizeOf(typeof(CMD_GP_CheckInInfo)))
            ///if (size != sizeof(CMD_GP_CheckInInfo))
            {
                ///ASSERT(false);
                return(false);
            }

            CMD_GP_CheckInInfo pNetInfo = (CMD_GP_CheckInInfo)StructConverterByteArray.BytesToStruct(data, typeof(CMD_GP_CheckInInfo));
            ///CMD_GP_CheckInInfo* pNetInfo = (CMD_GP_CheckInInfo*)data;

            GlobalUserInfo    pGlobalUserInfo = GlobalUserInfo.GetInstance();
            tagGlobalUserData pGlobalUserData = pGlobalUserInfo.GetGlobalUserData();

            pGlobalUserData.wSeriesDate   = pNetInfo.wSeriesDate;
            pGlobalUserData.bTodayChecked = (pNetInfo.bTodayChecked != 0);
            //pGlobalUserData.wSeriesDate++;//hack

            if (mIGPSignInMissionSink != null)
            {
                mIGPSignInMissionSink.onSignInQueryInfoResult(pNetInfo);
            }

            stop();


            return(true);
        }
예제 #4
0
//列表配置
        bool onSocketListConfig(byte[] data, int size)
        {
            CMD_GP_ListConfig pListConfig =
                (CMD_GP_ListConfig)StructConverterByteArray.BytesToStruct(data, typeof(CMD_GP_ListConfig));

            return(true);
        }
예제 #5
0
        public virtual void OnSocketSubPrivateInfo(CMD_GR_Private_Info pNetInfo)
        {
            Loom.QueueOnMainThread(() =>
            {
                m_kPrivateInfo = pNetInfo;

                if (m_eLinkAction == Type_LinkAction.Type_Link_Create)
                {
                    var buf = StructConverterByteArray.StructToBytes(m_kCreatePrivateNet);
                    CServerItem.get().SendSocketData(GameServerDefines.MDM_GR_PRIVATE, GameServerDefines.SUB_GR_CREATE_PRIVATE, buf, (ushort)buf.Length);
                    //zeromemory(&m_kCreatePrivateNet, sizeof(m_kCreatePrivateNet));
                    m_kCreatePrivateNet = new CMD_GR_Create_Private();
                }
                if (m_eLinkAction == Type_LinkAction.Type_Link_Join)
                {
                    CMD_GR_Join_Private kSendNet;
                    kSendNet.dwRoomNum           = (uint)m_iJoinRoomId; //utility::parseInt(m_kJoinNumTxt); // lin Temp do this
                    kSendNet.cbGameTypeIdex      = m_cbGameTypeIdex;    //WQ add
                    kSendNet.cbChoosedModelIndex = (byte)PlayerPrefs.GetInt("ChoosedModelIndex");

                    Debug.Log("OnSocketSubPrivateInfo Type_Link_Join: m_cbGameTypeIdex=" + m_cbGameTypeIdex);

                    var buf = StructConverterByteArray.StructToBytes(kSendNet);
                    CServerItem.get().SendSocketData(GameServerDefines.MDM_GR_PRIVATE, GameServerDefines.SUB_GR_JOIN_PRIVATE, buf, (ushort)buf.Length);
                }
                m_eLinkAction = Type_LinkAction.Type_Link_NULL;
            });
        }
        /** 发送数据 **/
        //有问题
        public bool send(int main, int sub, byte[] data, int size)
        {
            if (!isAlive())
            {
                return(false);
            }
            //构造数据
            byte[] cbDataBuffer = new byte[Packet.SOCKET_TCP_BUFFER];

            Packet.TCP_Head pHead = new Packet.TCP_Head();

            pHead.CommandInfo.wMainCmdID = (ushort)main;
            pHead.CommandInfo.wSubCmdID  = (ushort)sub;

            byte[] structData = StructConverterByteArray.StructToBytes(pHead);
            Buffer.BlockCopy(structData, 0, cbDataBuffer, 0, structData.Length);
            if (size > 0)
            {
                Buffer.BlockCopy(data, 0, cbDataBuffer, structData.Length, size);
                //memcpy(pHead + 1, data, dataSize);
            }
            //加密数据
            uint wSendSize = EncryptBuffer(ref cbDataBuffer, (uint)(Packet.SizeOfTCP_Head + size), (uint)cbDataBuffer.Length);

            mSocket.send(cbDataBuffer, (int)wSendSize);
            return(true);
        }
예제 #7
0
        //////////////////////////////////////////////////////////////////////////
        // ISocketEngineSink

        public override void onEventTCPSocketLink()
        {
            //变量定义


            switch (mMissionType)
            {
            case Type.MISSION_SEND_CHAT_DATA:
            {
                CMD_GP_CHAT kNetInfo = new CMD_GP_CHAT();
                kNetInfo.Init();

                GlobalUserInfo    pGlobalUserInfo = GlobalUserInfo.GetInstance();
                tagGlobalUserData pGlobalUserData = pGlobalUserInfo.GetGlobalUserData();
                kNetInfo.dwUserID = pGlobalUserData.dwUserID;

                Buffer.BlockCopy(pGlobalUserData.szNickName, 0, kNetInfo.szNickName, 0, pGlobalUserData.szNickName.Length);

                var szChatData = Encoding.UTF8.GetBytes(m_chatText);
                Buffer.BlockCopy(szChatData, 0, kNetInfo.szChatData, 0, szChatData.Length);

                Buffer.BlockCopy(pGlobalUserData.szHeadHttp, 0, kNetInfo.szHeadHttp, 0, pGlobalUserData.szHeadHttp.Length);

                var buf = StructConverterByteArray.StructToBytes(kNetInfo);
                send(MsgDefine.MDM_GP_USER_SERVICE, MsgDefine.SUB_GP_LOBBY_CHAT, buf, buf.Length);

                break;
            }

            default:
                stop();
                break;
            }
        }
예제 #8
0
        //登陆成功
        public void OnGRLogonSuccess(byte[] data, int dataSize)
        {
            var typeValue = typeof(CMD_GR_LogonSuccess);

            if (dataSize != Marshal.SizeOf(typeValue))
            {
                return;
            }

            //消息处理
            CMD_GR_LogonSuccess pLogonSuccess = (CMD_GR_LogonSuccess)StructConverterByteArray.BytesToStruct(data, typeValue);

            //玩家属性
            m_dwUserRight   = pLogonSuccess.dwUserRight;
            m_dwMasterRight = pLogonSuccess.dwMasterRight;

#if UNITY_IPHONE
            bool bIsForAppleReview = (pLogonSuccess.cbIsForAppleReview != 0);
            if (hnManager != null)
            {
                hnManager.ShowHideRedForeground(bIsForAppleReview);
            }
#endif

            RestTick();
        }
예제 #9
0
        public void Button_DismissPrivateNot()
        {
            CMD_GR_Dismiss_Private kNetInfo = new CMD_GR_Dismiss_Private();

            kNetInfo.bDismiss = 0;
            var buf = StructConverterByteArray.StructToBytes(kNetInfo);

            CServerItem.get().SendSocketData(GameServerDefines.MDM_GR_PRIVATE, GameServerDefines.SUB_GR_PRIVATE_DISMISS, buf, (ushort)buf.Length);
        }
        public void CB_InGameServerID(int iUserID)
        {
            CMD_GP_UserInGameServerID kNetInfo = new CMD_GP_UserInGameServerID();

            kNetInfo.dwUserID = (uint)iUserID;
            var buf = StructConverterByteArray.StructToBytes(kNetInfo);

            send(MsgDefine.MDM_GP_USER_SERVICE, MsgDefine.SUB_GP_QUERY_INGAME_SEVERID, buf, buf.Length);
        }
        public void HNMJButton_PengAction()
        {
            CMD_C_OperateCard OperateCard = new CMD_C_OperateCard();

            OperateCard.cbOperateCode = HNMJLogic_Defines.WIK_PENG;
            OperateCard.cbOperateCard = 0;
            var buf = StructConverterByteArray.StructToBytes(OperateCard);

            SendSocketData(HNMJ_Defines.SUB_C_OPERATE_CARD, buf, (ushort)buf.Length);
        }
예제 #12
0
        //插入类型
        public bool InsertGameKind(tagGameKind pGameKind)
        {
            //效验参数
            //ASSERT(pGameKind!=0);
            //if (pGameKind == null) return false;

            //变量定义
            CGameKindItem pGameKindItem = null;
            bool          bInsert       = false;

            if (m_GameKindItemMap.ContainsKey(pGameKind.wKindID))
            {
                pGameKindItem = m_GameKindItemMap[pGameKind.wKindID];
            }
            else
            {
                pGameKindItem = new CGameKindItem();
                bInsert       = true;
            }

            if (pGameKindItem == null)
            {
                return(false);
            }

            //设置数据
            var buf = StructConverterByteArray.StructToBytes(pGameKind);

            pGameKindItem.m_GameKind = (tagGameKind)StructConverterByteArray.BytesToStruct(buf, typeof(tagGameKind));
            //memcpy(&pGameKindItem.m_GameKind, pGameKind, sizeof(tagGameKind));

            //插入处理
            if (bInsert == true)
            {
                //设置索引
                m_GameKindItemMap[pGameKind.wKindID] = pGameKindItem;

                //插入子项
                if (m_pIServerListDataSink != null)
                {
                    m_pIServerListDataSink.OnGameItemInsert(pGameKindItem);
                }
            }
            else
            {
                //更新子项
                if (m_pIServerListDataSink != null)
                {
                    m_pIServerListDataSink.OnGameItemUpdate(pGameKindItem);
                }
            }

            return(true);
        }
예제 #13
0
        //插入函数
        //插入种类
        public bool InsertGameType(tagGameType pGameType)
        {
            //if (pGameType == null) return false;


            //变量定义
            CGameTypeItem pGameTypeItem = null;
            bool          bInsert       = false;

            if (m_GameTypeItemMap.ContainsKey(pGameType.wTypeID))
            {
                pGameTypeItem = m_GameTypeItemMap[pGameType.wTypeID];
            }
            else
            {
                pGameTypeItem = new CGameTypeItem();
                bInsert       = true;
            }

            if (pGameTypeItem == null)
            {
                return(false);
            }

            //设置数据
            var buf = StructConverterByteArray.StructToBytes(pGameType);

            pGameTypeItem.m_GameType = (tagGameType)StructConverterByteArray.BytesToStruct(buf, typeof(tagGameType));
            //memcpy(&pGameTypeItem.m_GameType, pGameType, sizeof(tagGameType));


            //插入处理
            if (bInsert == true)
            {
                //设置索引
                m_GameTypeItemMap[pGameType.wTypeID] = pGameTypeItem;

                //界面更新
                if (m_pIServerListDataSink != null)
                {
                    m_pIServerListDataSink.OnGameItemInsert(pGameTypeItem);
                }
            }
            else
            {
                //界面更新
                if (m_pIServerListDataSink != null)
                {
                    m_pIServerListDataSink.OnGameItemUpdate(pGameTypeItem);
                }
            }

            return(true);
        }
        public void ChiAction(byte nChiAction)
        {
            CMD_C_OperateCard OperateCard = new CMD_C_OperateCard();

            OperateCard.cbOperateCode = nChiAction;

            OperateCard.cbOperateCard = 0;
            var buf = StructConverterByteArray.StructToBytes(OperateCard);

            SendSocketData(HNMJ_Defines.SUB_C_OPERATE_CARD, buf, (ushort)buf.Length);
        }
예제 #15
0
//登录失败
        bool onSocketSubLogonFailure(byte[] data, int size)
        {
            DBR_GP_LogonError pNetInfo =
                (DBR_GP_LogonError)StructConverterByteArray.BytesToStruct(data, typeof(DBR_GP_LogonError));

            //显示消息
            if (mIGPLoginMissionSink != null)
            {
                mIGPLoginMissionSink.onGPLoginFailure(pNetInfo.lErrorCode, (pNetInfo.szErrorDescribe));
            }
            return(true);
        }
        public void Button_EmosShow(int emoIdex)
        {
            showPlane(TYPE_EMOS, emoIdex, m_pLocal.GetChairID());

            //mChen
            CMD_GF_C_UserExpressionIdx UserExpression = new CMD_GF_C_UserExpressionIdx();

            UserExpression.wItemIndex  = (ushort)emoIdex;
            UserExpression.wSendUserID = m_pLocal.GetChairID();
            var buf = StructConverterByteArray.StructToBytes(UserExpression);

            CServerItem.get().SendSocketData(GameServerDefines.MDM_GF_FRAME, GameServerDefines.SUB_GF_USER_EXPRESSION_INDEX, buf, (ushort)buf.Length);
        }
예제 #17
0
        private bool onSubGPLobbyChat(byte[] data, int size)
        {
            CMD_GP_CHAT pNetInfo = (CMD_GP_CHAT)StructConverterByteArray.BytesToStruct(data, typeof(CMD_GP_CHAT));

            if (mLobbyChatSystem != null)
            {
                mLobbyChatSystem.onSubGPLobbyChat(pNetInfo);
            }

            ///stop();

            return(true);
        }
        public void SendOutCard(byte Cardvalue)
        {
            if (m_nGameState != MJState.HNMJ_STATE_PLAYING)
            {
                return;
            }

            CMD_C_OutCard OutCard = new CMD_C_OutCard();

            OutCard.cbCardData = Cardvalue;//m_pLocal.getTouchCardVlaue(pCard);//temp set the card value!!Lin
            var buf = StructConverterByteArray.StructToBytes(OutCard);

            SendSocketData(HNMJ_Defines.SUB_C_OUT_CARD, buf, (ushort)buf.Length);
        }
        public void OnSubGameStart(byte[] pBuffer, ushort wDataSize)
        {
            var typeValue = typeof(CMD_S_GameStart);

            Debug.Log("建德游戏开始" + Marshal.SizeOf(typeValue));
            if (wDataSize != Marshal.SizeOf(typeValue))
            {
                return;
            }

            //变量定义
            CMD_S_GameStart pGameStart = (CMD_S_GameStart)StructConverterByteArray.BytesToStruct(pBuffer, typeValue);

            defaultState();

            m_iBankerUser  = pGameStart.wBankerUser;
            m_iCurrentUser = pGameStart.wCurrentUser;
            m_iUserAction  = pGameStart.cbUserAction;
            //WidgetFun::setText(this, "LastCardCout", (int)pGameStart.cbLeftCardCount);
            //WidgetFun::setVisible(this, "XZDDButton_WeiXinFriend", false);//mChen hack

            for (int i = 0; i < MAX_PLAYER; i++)
            {
                var player = getPlayerByChairID(i);
                player.setHandCard(pGameStart.cbCardData, i * HNMJ_Defines.MAX_COUNT, HNMJ_Defines.MAX_COUNT - 1);
                player.startGame();
            }

            Loom.QueueOnMainThread(() =>
            {
                //Lin: pGameStart.lSiceCount 服务端未设置,暂时rand一个
                hnManager.SetLeftCard(pGameStart.cbLeftCardCount);
                Random.state = new Random.State();
                var buf      = new byte[(HNMJ_Defines.MAX_COUNT) * HNMJ_Defines.GAME_PLAYER];
                Buffer.BlockCopy(pGameStart.cbCardData, 0, buf, 0, buf.Length);
                hnManager.GameStartProcedure(Random.Range(2, 13), m_iBankerUser, buf);
                //hnManager.GameStartProcedure(pGameStart.lSiceCount, m_iBankerUser);
            });

            //HNMJButtonAction_ShowCard();
            getPlayerByChairID(m_iBankerUser).setZhuang();
            if (pGameStart.cbXiaoHuTag == 1)
            {
                setGameState(MJState.HNMJ_STATE_XIAO_HU);
            }
            else
            {
                setGameState(MJState.HNMJ_STATE_PLAYING);
            }
        }
        public void OnSubOperateNotify(byte[] pBuffer, ushort wDataSize)
        {
            var typeValue = typeof(CMD_S_OperateNotify);

            if (wDataSize != Marshal.SizeOf(typeValue))
            {
                return;
            }

            CMD_S_OperateNotify pOperateNotify = (CMD_S_OperateNotify)StructConverterByteArray.BytesToStruct(pBuffer, typeValue);

            handle_OnSubOperateNotify(pOperateNotify);
            ///m_pLocal.AddCommand( new HNMJPlayer.PlayerUICommand(HNMJPlayer.PlayerAnimType.OnSubOperateNotify, new[] { (byte)pOperateNotify.wResumeUser, pOperateNotify.cbActionMask, pOperateNotify.cbActionCard }) );
        }
예제 #21
0
        //////////////////////////////////////////////////////////////////////////
        ///
        /// // 登陆
        public bool sendLoginVisitor(CMD_GP_VisitorLogon VisitorAccount)
        {
            GlobalUserInfo    pGlobalUserInfo = GameNet.GlobalUserInfo.GetInstance();
            tagGlobalUserData pGlobalUserData = pGlobalUserInfo.GetGlobalUserData();

            Buffer.BlockCopy(mVisitorAccount.szPassWord, 0, pGlobalUserData.szPassword, 0,
                             mVisitorAccount.szPassWord.Length);

            //发送数据
            var buf = StructConverterByteArray.StructToBytes(mVisitorAccount);

            send(MsgDefine.MDM_GP_LOGON, MsgDefine.SUB_GP_LOGON_VISITOR, buf, buf.Length);
            return(true);
        }
        public void SendInventoryConsumption(byte ItemID, ushort wAwardGlod = 10, byte cbCostType = 0)
        {
            Debug.LogWarning("------------SendInventoryConsumption");
            CMD_C_InventoryConsumptionInfo kNetInfo = new CMD_C_InventoryConsumptionInfo();

            kNetInfo.dwUserID   = GlobalUserInfo.getUserID();
            kNetInfo.cbItemID   = ItemID;
            kNetInfo.wAmount    = wAwardGlod;
            kNetInfo.cbCostType = cbCostType;
            //发送数据
            var buf = StructConverterByteArray.StructToBytes(kNetInfo);

            SendSocketData(HNMJ_Defines.SUB_C_CONSUMPTION_INVENTORY, buf, (ushort)buf.Length);
        }
        public void Button_LansShow(int lansIndex)
        {
            showPlane(TYPE_LANS, lansIndex, m_pLocal.GetChairID());

            //mChen
            CMD_GF_C_UserChatIdx UserChat = new CMD_GF_C_UserChatIdx();

            UserChat.wItemIndex  = (ushort)lansIndex;
            UserChat.wSendUserID = m_pLocal.GetChairID();
            var buf = StructConverterByteArray.StructToBytes(UserChat);

            CServerItem.get()
            .SendSocketData(GameServerDefines.MDM_GF_FRAME, GameServerDefines.SUB_GF_USER_CHAT_INDEX, buf,
                            (ushort)buf.Length);
        }
        public void Net_InGameServerID(byte[] data, int dataSize)
        {
            if (dataSize != Marshal.SizeOf(typeof(CMD_GP_InGameSeverID)))
            {
                return;
            }

            CMD_GP_InGameSeverID pNetInfo = (CMD_GP_InGameSeverID)StructConverterByteArray.BytesToStruct(data, typeof(CMD_GP_InGameSeverID));

            if (m_pInGameServerInfoSink != null)
            {
                m_pInGameServerInfoSink.onUserInGameServerID(pNetInfo);
            }
            stop();
        }
        //游戏结束
        public void OnSubGameEnd(byte[] pBuffer, ushort wDataSize)
        {
            var typeValue = typeof(CMD_S_GameEnd);
            //if (wDataSize != Marshal.SizeOf(typeValue))
            //    return;

            //消息处理
            CMD_S_GameEnd pGameEnd = (CMD_S_GameEnd)StructConverterByteArray.BytesToStruct(pBuffer, typeValue);

            ////mChen add, for HideSeek WangHu
            //Loom.QueueOnMainThread(() =>
            //{
            //    hnManager.ReturnFromBigFinalToHallScene();
            //});
        }
        //发送聊天数据给服务器
        public void SendChatData(byte[] chatdata)
        {
            CMD_C_CHAT chat = new CMD_C_CHAT();

            chat.UserStatus = CServerItem.get().GetMeUserItem().GetUserStatus();
            chat.ChatData   = chatdata;
            if (chat.ChatData.Length <= 100 && chat.ChatData.Length > 0)
            {
                var buf = StructConverterByteArray.StructToBytes(chat);
                SendSocketData(HNMJ_Defines.SUB_C_CHAT_PLAY, buf, (ushort)buf.Length);
            }
            else
            {
                Debug.Log("文字数据不存在或过长");
            }
        }
        //接收聊天数据
        public void OnSubChatData(byte[] pBuffer, ushort wDataSize)
        {
            var typeValue = typeof(CMD_C_CHAT);

            if (wDataSize != Marshal.SizeOf(typeValue))
            {
                Debug.Log("数据长度不符合");
                return;
            }
            CMD_C_CHAT ChatData = (CMD_C_CHAT)StructConverterByteArray.BytesToStruct(pBuffer, typeValue);
            string     data     = Encoding.GetEncoding(936).GetString(ChatData.ChatData);
            //Debug.Log("接收到的数据:" + data);
            int  chairid    = ChatData.ChairId;
            byte userstatus = ChatData.UserStatus;

            hnManager.ShowChatPanel(chairid, userstatus, data);
        }
예제 #28
0
        //发送注册信息
        public bool sendRegisterPacket(CMD_GP_RegisterAccounts RegisterAccount)
        {
            GlobalUserInfo    pGlobalUserInfo = GameNet.GlobalUserInfo.GetInstance();
            tagGlobalUserData pGlobalUserData = pGlobalUserInfo.GetGlobalUserData();

            Buffer.BlockCopy(RegisterAccount.szLogonPass, 0, pGlobalUserData.szPassword, 0,
                             RegisterAccount.szLogonPass.Length);

            // for Match Time
            Debug.Log("發送註冊信息");
            RegisterAccount.wKindID = GameScene.KIND_ID_JianDe;

            //发送数据
            var buf = StructConverterByteArray.StructToBytes(RegisterAccount);

            send(MsgDefine.MDM_GP_LOGON, MsgDefine.SUB_GP_REGISTER_ACCOUNTS, buf, buf.Length);
            return(true);
        }
예제 #29
0
        //发送登陆信息
        public bool sendLoginAccount(CMD_GP_LogonAccounts LoginAccount)
        {
            GlobalUserInfo    pGlobalUserInfo = GameNet.GlobalUserInfo.GetInstance();
            tagGlobalUserData pGlobalUserData = pGlobalUserInfo.GetGlobalUserData();

            Buffer.BlockCopy(LoginAccount.szPassword, 0, pGlobalUserData.szPassword, 0, LoginAccount.szPassword.Length);

            // for Match Time
            Debug.Log("登錄設置kindid");
            LoginAccount.wKindID = GameScene.KIND_ID_JianDe;

            //发送数据
            //var buf = StructConverterByteArray.StructToBytes<CMD_GP_LogonAccounts>(LoginAccount);
            var buf = StructConverterByteArray.StructToBytes(LoginAccount);

            send(MsgDefine.MDM_GP_LOGON, MsgDefine.SUB_GP_LOGON_ACCOUNTS, buf, buf.Length);
            return(true);
        }
        public void SendAwardData(uint dwAwardGlod = 10, byte cbCostType = 0)
        {
            Debug.LogWarning("------------SendAwardData");
            //变量定义
            GlobalUserInfo    pGlobalUserInfo = GlobalUserInfo.GetInstance();
            tagGlobalUserData pGlobalUserData = pGlobalUserInfo.GetGlobalUserData();

            CMD_C_AwardDone kNetInfo = new CMD_C_AwardDone();

            kNetInfo.Init();
            kNetInfo.dwUserID    = pGlobalUserData.dwUserID;
            kNetInfo.dwAwardGold = dwAwardGlod;
            kNetInfo.cbCostType  = cbCostType;
            Buffer.BlockCopy(pGlobalUserData.szPassword, 0, kNetInfo.szPassword, 0, pGlobalUserData.szPassword.Length);
            var buf = StructConverterByteArray.StructToBytes(kNetInfo);

            SendSocketData(HNMJ_Defines.SUB_C_AWARD_DONE, buf, (ushort)buf.Length);
        }