Exemple #1
0
        static void HandleReceiveMessage(MSG_HEAD msgHead, MemoryStream kMsgBodyStream, int iMsgBodySize)
        {
            switch (msgHead.m_usMsgType)
            {
            case (ushort)MessageType.MT_E2D_START:
                SyncManager.SyncFrameRate = System.BitConverter.ToInt16(kMsgBodyStream.ToArray(), 0);
                SendSceneID();
                break;

            case (ushort)MessageType.MT_E2D_SYNC_REQUEST:
                SyncManager.FindD2ESyncObjects(FBHelper.DeserializeSyncIDList(kMsgBodyStream.ToArray()));
                MessageHelper.SendShortMessage(m_kConnector, MessageType.MT_D2E_SYNC_RESPOND, (ushort)SyncManager.D2ESyncObjectsCount);
                break;

            case (ushort)MessageType.MT_E2D_START_SYNC:
                SyncManager.IsD2ESyncStart = true;
                break;

            case (ushort)MessageType.MT_E2D_STOP_SYNC:
                SyncManager.IsD2ESyncStart = false;
                break;

            case (ushort)MessageType.MT_E2D_CONTROL_REQUEST:
                SyncManager.FindE2DControlObjects(FBHelper.DeserializeSyncIDList(kMsgBodyStream.ToArray()));
                MessageHelper.SendShortMessage(m_kConnector, MessageType.MT_D2E_CONTROL_RESPOND, (ushort)SyncManager.E2DControlObjectsCount);
                break;

            case (ushort)MessageType.MT_E2D_CONTROL_UPDATE:
                SyncManager.E2DControlUpdate(kMsgBodyStream.ToArray());
                break;

            case (ushort)MessageType.MT_E2D_STOP_CONTROL:
                break;

            case (ushort)MessageType.MT_E2D_UPDATE_SYNC_RATE:
                SyncManager.SyncFrameRate = System.BitConverter.ToInt16(kMsgBodyStream.ToArray(), 0);
                break;

            default:
                Debug.LogError("Wrong Message Type : " + msgHead.m_usMsgType);
                break;
            }
        }
Exemple #2
0
        static void HandleReceiveMessage(MSG_HEAD msgHead, MemoryStream kMsgBodyStream, int iMsgBodySize)
        {
            switch (msgHead.m_usMsgType)
            {
            case (ushort)MessageType.MT_D2E_SCENE_ID:
            case (ushort)MessageType.MT_D2E_SCENE_CHANGED:
                int sceneid = System.BitConverter.ToInt16(kMsgBodyStream.ToArray(), 0);
                Debug.Log("Scene ID : " + sceneid);
                SyncManager.SyncSceneID = sceneid;
                break;

            case (ushort)MessageType.MT_D2E_SYNC_RESPOND:
                int syncCount = System.BitConverter.ToInt16(kMsgBodyStream.ToArray(), 0);
                Debug.Log("Sync Object count : " + syncCount);
                if (syncCount > 0)
                {
                    MessageHelper.SendEmptyMessage(m_kConnector, MessageType.MT_E2D_START_SYNC);
                    SyncManager.IsD2ESyncStart = true;
                }
                break;

            case (ushort)MessageType.MT_D2E_SYNC_UPDATE:
                SyncManager.D2ESyncUpdate(kMsgBodyStream.ToArray());
                break;

            case (ushort)MessageType.MT_D2E_CONTROL_RESPOND:
                int controlCount = System.BitConverter.ToInt16(kMsgBodyStream.ToArray(), 0);
                Debug.Log("Contorl Object count : " + controlCount);
                SyncManager.IsE2DSyncStart = controlCount > 0;
                break;

            default:
                Debug.LogError("Wrong Message Type : " + msgHead.m_usMsgType);
                break;
            }
        }
Exemple #3
0
 public static void SendSyncUpdate()
 {
     MessageHelper.SendMessage(m_kConnector, MessageType.MT_D2E_SYNC_UPDATE, SyncManager.GetD2ESyncData());
 }
Exemple #4
0
 public static void SendControlUpdate()
 {
     MessageHelper.SendMessage(m_kConnector, MessageType.MT_E2D_CONTROL_UPDATE, SyncManager.GetE2DControlData());
 }