public void MarkerGenerated() { MqttHelper mqttHelper = spectatorViewMqtt; string rid = spectatorViewRid; if (spectatorViewNetState != NetState.Connect) { return; } MarkerGenerated cmd = new MarkerGenerated(); cmd.senderid = uid; byte[] cmdBuf = EncodeStruct <MarkerGenerated>(cmd); SendCmdMessage(mqttHelper, rid, NetCmdIdClient.MarkerGenerated, cmdBuf); }
void Update() { while (operationQueue.Count() > 0) { OperationBean op = operationQueue.Dequeue(); switch (op.op) { case OperationBean.OpId.UserEnter: PlayerUserIdList.Add((string)op.param); AddSpectatorViewPlayer((string)op.param, false, false); break; case OperationBean.OpId.UserLeave: if (PlayerUserIdList.Contains((string)op.param)) { PlayerUserIdList.Remove((string)op.param); } RemoveSpectatorViewPlayer((string)op.param); if (PlayerUserIdList.Count == 0) { // Disconnect(); } break; case OperationBean.OpId.SelfJoinRoom: AddSpectatorViewPlayer(this.mineUid, true, this.isCreator); SyncInterface.Instance.OnSelfJoinnedRoom(this.roomId, this.isCreator, (Dictionary <string, string[]>)op.param); if (OnConnect != null) { OnConnect.Invoke(this.isCreator, this.isWaittingMarkerDetect); } break; case OperationBean.OpId.NetDisconn: if (MrShareData._instance.needLocated) { MrShareData._instance.needLocated = false; MrShareData._instance.FloorTarget.SetActive(false); WaittingForExportAnchor = false; } ClearUserList(); PlayerUserIdList.Clear(); SetStates(SpectatorViewState.Init); SyncInterface.Instance.OnSelfLeftRoom(roomId); break; case OperationBean.OpId.DownAnchor: SetStates(SpectatorViewState.AnchorDownloading); StartCoroutine(DownLoadAnchor()); break; case OperationBean.OpId.AnchorExported: if (state == SpectatorViewState.AnchorUploading) { StartCoroutine(UploadAnchor()); } else { Debug.Log("SV#OperationBean.OpId.AnchorExported#Wrong State. Current State:" + state.ToString()); } break; case OperationBean.OpId.AnchorImported: if (state == SpectatorViewState.AnchorDownloading) { //停止映射 SpatialMappingManager.Instance.StopObserver(); MYDialog.Instance.Write("导入锚点完成,设置FloorY为 : " + _lerpStageWithFloor /*,false*/); MrShareData._instance.FloorY = _lerpStageWithFloor; SetStates(SpectatorViewState.AnchorPrepared); } else { Debug.Log("SV#OperationBean.OpId.AnchorImported#Wrong State. Current State:" + state.ToString()); } break; case OperationBean.OpId.FloorLocated: if (state == SpectatorViewState.LocatingFloor) { SetStates(SpectatorViewState.AnchorUploading); string anchorName = "Anchor" + Guid.NewGuid().ToString(); ExportAnchor(anchorName); MYDialog.Instance.Write("你已成功导出锚点 "); } else { Debug.Log("SV#OperationBean.OpId.FloorLocated#Wrong State. Current State:" + state.ToString()); } break; case OperationBean.OpId.OtherCmd: OtherCmd cmd = (OtherCmd)op.param; SyncInterface.Instance.OnSyncOtherCmd(cmd.id, cmd.cmd); break; case OperationBean.OpId.AnchorImportFailed: if (state == SpectatorViewState.AnchorDownloading) { SetStates(SpectatorViewState.ImportAnchorFailed); } else { Debug.Log("SV#OperationBean.OpId.AnchorImportFailed#Wrong State. Current State:" + state.ToString()); } break; case OperationBean.OpId.MarkerGenerated: { MarkerGenerated cmdObj = (MarkerGenerated)op.param; if (OnMarkerGenerated != null) { OnMarkerGenerated(cmdObj.senderid); } } break; case OperationBean.OpId.MarkerDetected: { MarkerDetected cmdObj = (MarkerDetected)op.param; if (OnMarkerDetected != null) { OnMarkerDetected(cmdObj.senderid, cmdObj.markerid); } } break; case OperationBean.OpId.SyncWorldRoot: { Debug.Log("SpectatorViewManager#Update#SyncWorldRoot"); SyncWorldRoot cmdObj = (SyncWorldRoot)op.param; if (OnSyncWorldRoot != null) { OnSyncWorldRoot(cmdObj.senderid, cmdObj.markerid, cmdObj.posx, cmdObj.posy, cmdObj.posz, cmdObj.angley); } } break; case OperationBean.OpId.ios_AdjustFloorLocate: { MrShareData._instance.FloorY = _lerpStageWithFloor; Vector3 v = (Vector3)op.param; MrShareData._instance.FloorTarget.transform.localPosition = v; MrShareData._instance.RelativeTransform = MrShareData._instance.FloorTarget.transform; SyncInterface.Instance.OnFloorLocated(); MYDialog.Instance.Write("定位地面完成,隐藏log" /*, false*/); } break; case OperationBean.OpId.hololens_AdjustFloorLocate: Vector3 vv = (Vector3)op.param; MrShareData._instance.CreatorLocatePos = vv; break; case OperationBean.OpId.OnRoomCache: SyncInterface.Instance.OnRoomCache(roomId, (Dictionary <string, string[]>)op.param); break; } } }