Esempio n. 1
0
    // Update is called once per frame
    public void Update()
    {
        if (null != m_client)
        {
            if (bProxy)
            {
                if (!m_client.IsProxy)
                {
                    if (null != OnNetState)
                    {
                        OnNetState(m_client.ProxyState);
                    }
                    bProxy = !bProxy;
                }

                return;
            }

            if (bLockDelayMsg)
            {
                return;
            }


            NetComm.Packet msgPk = m_client.ReadData();

            if (null != msgPk)
            {
                if (null == msgPk.data)
                {
                    Debug.LogWarning("服务器的数据为空,断开连接");
                    OnGameNetMessage(0, null, msgPk.bClosed ? 1 : 0);
                }
                else
                {
                    int offset = 0;
                    NetMsg.MsgHeadDef header = XConvert.ToObject <MahjongLobby_SX_Changzhi.Network.Message.NetMsg.MsgHeadDef>(msgPk.data, ref offset);
                    // TODO 查看接收十六进制数据(底层发送十六进制消息)

                    if (MahjongLobby_SX_Changzhi.LobbyContants.isOpenDebugMessage_Onreceive)
                    {
                        //DEBUG.Error(header.MsgType.ToString());
                        MahjongCommonMethod.Instance.Printbuff(msgPk.data);
                    }

                    OnGameNetMessage(header.MsgType, msgPk.data, msgPk.data.Length);
                }
            }
        }
    }
Esempio n. 2
0
        // Limited support!
        // You can only reference methods or fields defined in the class (not in ancestors classes)
        // Fields and methods stubs are needed for compilation purposes only.
        // Reflexil will automaticaly map current type, fields or methods to original references.
// Happy_BuYu.Lobby.BY_LbMainCommand
        private void HandleReceiveGiftRes(byte[] pMsg)
        {
            Debug.Log("HandleReceiveGiftRes");
            GameUtil gutil = new GameUtil();

            if (gutil.EnterGame)
            {
                BY_LbMainMediator.Instance.m_pLbChooseScenePanel.ClickStartBtn();
            }
            ReceiveGiftResDef receiveGiftResDef = XConvert.ToObject <ReceiveGiftResDef>(pMsg);

            if (receiveGiftResDef.iResult == 0)
            {
                int num         = 0;
                int objectSize  = XConvert.GetObjectSize <ReceiveGiftResDef>();
                int objectSize2 = XConvert.GetObjectSize <PresentInfo>();
                int num2        = objectSize;
                num = num2;
                BY_LbPlayerNode bY_LbPlayerNode = GDUtil.myPlay as BY_LbPlayerNode;
                bY_LbPlayerNode.m_listPresentInfo.Clear();
                Debug.Log("msg.iGiftNum" + receiveGiftResDef.iGiftNum);
                int num3 = PlayerPrefs.GetInt("RECEIVE_GIFT_RECORD_ID" + Happy_BuYu.GlobalVO.BY_GlobalData.m_iUserId);
                for (int i = 0; i < receiveGiftResDef.iGiftNum; i++)
                {
                    num = num2;
                    PresentInfo presentInfo = XConvert.ToObject <PresentInfo>(pMsg, ref num);
                    bY_LbPlayerNode.m_listPresentInfo.Add(presentInfo);
                    num2 += objectSize2;
                    int iRecordID = presentInfo.iRecordID;
                    if (iRecordID > num3)
                    {
                        num3 = iRecordID;
                    }
                }
                PlayerPrefs.SetInt("RECEIVE_GIFT_RECORD_ID" + Happy_BuYu.GlobalVO.BY_GlobalData.m_iUserId, num3);
                PlayerPrefs.Save();
                if (!Happy_BuYu.GlobalVO.BY_GlobalData.g_bReturnFromGame)
                {
                    BY_LBGlobalParam.m_iUserInfoStep++;
                    if (BY_LBGlobalParam.m_iUserInfoStep == BY_LBGlobalParam.USER_INFO_STEPS)
                    {
                        BY_LbMainMediator.Instance.CallAuthenRes();
                    }
                }
                this.ShowPresent();
            }
        }
Esempio n. 3
0
        public void ConvertTest()
        {
            const string str = "JXU3MkQ3JXU0RjFGJXU2NjJGJXU0RTE2JXU3NTRDJXU0RTBBJXU2NzAwJXU1RTA1JXU3Njg0JXU0RUJB";

            AreEqual(XConvert <string> .Convert(XConvert <byte[]> .Convert(str)), str);

            AreEqual(XConvert <int> .Convert(XConvert <BigInteger> .Convert(int.MinValue)), int.MinValue);

            AreEqual(XConvert <BigInteger> .Convert(XConvert <byte[]> .Convert((BigInteger)ulong.MaxValue)), (BigInteger)ulong.MaxValue);


            AreEqual(XConvert <string> .FromObject(XConvert.ToObject(str, typeof(byte[]))), str);

            AreEqual(XConvert <int> .FromObject(XConvert.Cast(int.MinValue, typeof(BigInteger))), int.MinValue);

            AreEqual(XConvert <BigInteger> .FromObject(XConvert <byte[]> .FromObject((BigInteger)ulong.MaxValue)), (BigInteger)ulong.MaxValue);
        }
Esempio n. 4
0
        // Limited support!
        // You can only reference methods or fields defined in the class (not in ancestors classes)
        // Fields and methods stubs are needed for compilation purposes only.
        // Reflexil will automaticaly map current type, fields or methods to original references.
// Happy_BuYu.Lobby.BY_LbMainCommand
        private void HandleReceiveGiftRes(byte[] pMsg, ref int offset)
        {
            CheckHaveNext   checkHaveNext   = XConvert.ToObject <CheckHaveNext>(pMsg, ref offset);
            BY_LbPlayerNode bY_LbPlayerNode = GDUtil.myPlay as BY_LbPlayerNode;

            bY_LbPlayerNode.m_listPresentInfo.Clear();
            Debug.Log("msg.iGiftNum" + checkHaveNext.size);
            int num = PlayerPrefs.GetInt("RECEIVE_GIFT_RECORD_ID" + Happy_BuYu.GlobalVO.BY_GlobalData.m_iUserId);

            for (int i = 0; i < checkHaveNext.size; i++)
            {
                PresentInfo presentInfo = XConvert.ToObject <PresentInfo>(pMsg, ref offset);
                bY_LbPlayerNode.m_listPresentInfo.Add(presentInfo);
                int iRecordID = presentInfo.iRecordID;
                if (iRecordID > num)
                {
                    num = iRecordID;
                }
            }
            PlayerPrefs.SetInt("RECEIVE_GIFT_RECORD_ID" + Happy_BuYu.GlobalVO.BY_GlobalData.m_iUserId, num);
            PlayerPrefs.Save();
            this.ShowPresent();

            var list = Happy_BuYu.GlobalVO.BY_AquariumExchangeProfiles.m_listAquariumExchangeInfos;

            foreach (var item in list)
            {
                BBBDebug.DebugAttri(item);
            }

            var list2 = BY_FishPetProfiles.m_listFishPetAttri;

            foreach (var item in list2)
            {
                BBBDebug.DebugAttri(item);
            }
        }
Esempio n. 5
0
 public void WriteValue <T>(object obj, T value)
 {
     SetValue(obj, XConvert.ToObject(value, BeforeType));
 }
Esempio n. 6
0
 public static T ConvertToObject <T>(byte[] bytes, ref int offset)
 {
     return(XConvert.ToObject <T>(bytes, ref offset));
 }