Exemplo n.º 1
0
        void OnGUI()
        {
            GUILayout.Space(80f);

            if (GUILayout.Button("RTT Test Start"))
            {
                mRTT_TestPackage.Op    = RTT_TestPackage.EOp.A;
                mRTT_TestPackage.ATime = System.DateTime.Now.Ticks;
                UnityEngine.Debug.Log("udpBoxContainer.MasterIPConnectInfo.IPEndPoint: " + udpBoxContainer.MasterIPConnectInfo.IPEndPoint);
                udpBoxContainer.SendUDPMessage(mRTT_TestPackage.Serialize(), udpBoxContainer.MasterIPConnectInfo.IPEndPoint);
            }
        }
Exemplo n.º 2
0
        public override void Process(UDPBox udpBox, byte[] packageBytes, IPEndPoint ipEndPoint)
        {
            mTemplate.Deserialize(packageBytes);

            switch (mTemplate.Op)
            {
            case RTT_TestPackage.EOp.A:

                mTemplate.BTime = DateTime.Now.Ticks;
                mTemplate.Op    = RTT_TestPackage.EOp.B;
                udpBox.SendMessage(mTemplate.Serialize(), ipEndPoint);

                break;

            case RTT_TestPackage.EOp.B:
                Debug.LogError("RTT: " + ((mTemplate.BTime - mTemplate.ATime) / (float)TimeSpan.TicksPerMillisecond) + " ms" + "   ipEndPoint: " + ipEndPoint);
                break;

            default:
                break;
            }
        }