Beispiel #1
0
        public void SetHololensSynchronize(bool b)
        {
            if (server == null)
            {
                return;
            }

            if (b)
            {
                LiveMessageStart msg = new LiveMessageStart();
                if (handler != null)
                {
                    handler.SendMessage(msg.Serialize(), null);
                }
            }
            else
            {
                LiveMessageStop msg = new LiveMessageStop();
                if (handler != null)
                {
                    handler.SendMessage(msg.Serialize(), null);
                }
            }

            if (b)
            {
                // 屏蔽掉主摄像机
                //mainCamera.cullingMask = 0;
            }
            else
            {
                mainCamera.cullingMask = oldCameraMask;
            }
        }
Beispiel #2
0
    public static LiveMessage ParseMessage(byte[] bytes)
    {
        LiveMessage msg = null;

        if (bytes.Length == 0)
        {
            Debug.LogError("Error: Message length=0!");
            return(msg);
        }

        switch (bytes[0])
        {
        case LiveMessageConstant.BEV_MESSAGE_TYPE_START:
            msg = new LiveMessageStart();
            break;

        case LiveMessageConstant.BEV_MESSAGE_TYPE_STOP:
            msg = new LiveMessageStop();
            break;

        case LiveMessageConstant.BEV_MESSAGE_TYPE_DOWNLOAD_ANCHOR:
            msg = new LiveMessageDownload();
            break;

        case LiveMessageConstant.BEV_MESSAGE_TYPE_SET_ANCHOR:
            msg = new LiveMessageSetAnchor();
            break;

        case LiveMessageConstant.BEV_MESSAGE_TYPE_SYNCHRONIZE_ALL:
            msg = new LiveMessageSynchronizeAll();
            break;

        case LiveMessageConstant.BEV_MESSAGE_TYPE_DOWNLOAD_ANCHOR_FINISH:
            msg = new LiveMessageDownloadFinish();
            break;

        case LiveMessageConstant.BEV_MESSAGE_TYPE_SET_ANCHOR_FINISH:
            msg = new LiveMessageSetAnchorFinish();
            break;

        case LiveMessageConstant.BEV_MESSAGE_TYPE_SAVE_ANCHOR:
            msg = new LiveMessageSaveAnchor();
            break;

        case LiveMessageConstant.BEV_MESSAGE_TYPE_SAVE_ANCHOR_FINISH:
            msg = new LiveMessageSaveAnchorFinish();
            break;

        case LiveMessageConstant.BEV_MESSAGE_TYPE_REQUEST_SPATIAL_MAPPING:
            msg = new LiveMessageRequestSpatialMapping();
            break;

        case LiveMessageConstant.BEV_MESSAGE_TYPE_RESPONSE_SPATIAL_MAPPING:
            msg = new LiveMessageResponseSpatialMapping();
            break;

        default:
            Debug.LogError("No such type message!");
            return(msg);
        }

        try
        {
            msg.Deserialize(bytes);
        }
        catch (Exception e)
        {
            msg = null;
            Debug.LogError("Parse Message Error! " + e);
        }

        return(msg);
    }