public void SyncFloorLocate(Vector3 localPos) { string pos = localPos.x.ToString("f2") + ":" + localPos.y.ToString("f2") + ":" + localPos.z.ToString("f2"); SaveSVRoomCacheToServer(RoomCacheKey.RoomCacheKeyFloorY, pos); FloorLocated floorLocated = new FloorLocated(); floorLocated.rid = spectatorViewRid; floorLocated.x = localPos.x; floorLocated.y = localPos.y; floorLocated.z = localPos.z; byte[] cmd = EncodeStruct <FloorLocated>(floorLocated); SendCmdMessage(spectatorViewMqtt, spectatorViewRid, NetCmdIdClient.FloorLocated, cmd); }
private void NetWork_onReceiveCmd(string rid, NetCmdIdClient cid, object cmd) { if (rid != null && rid.Equals(this.roomId)) { switch (cid) { case NetCmdIdClient.None: break; case NetCmdIdClient.AnchorUploaded: { if (clientType != ClientType.SpectatorViewPc && clientType != ClientType.IOS) { AnchorUploaded clientCmd = (AnchorUploaded)cmd; this.anchorName = clientCmd.anchor; OperationBean oper = new OperationBean(); oper.op = OperationBean.OpId.DownAnchor; oper.param = anchorName; operationQueue.Enqueue(oper); } } break; case NetCmdIdClient.TakeControlPower: { //TakeControlPower clientCmd = (TakeControlPower)cmd; } break; case NetCmdIdClient.SyncPos: { SyncPos clientCmd = (SyncPos)cmd; if (clientCmd.type == SyncType.VirtualMan) { if (PlayerUserList.ContainsKey(clientCmd.id)) { SpectatorViewPlayer player; PlayerUserList.TryGetValue(clientCmd.id, out player); if (player) { player.OnRecvPosition(new Vector3(clientCmd.px, clientCmd.py, clientCmd.pz), clientCmd.time); } } } } break; case NetCmdIdClient.SyncRotate: { SyncRotate clientCmd = (SyncRotate)cmd; if (clientCmd.type == SyncType.VirtualMan) { if (PlayerUserList.ContainsKey(clientCmd.id)) { SpectatorViewPlayer player; PlayerUserList.TryGetValue(clientCmd.id, out player); if (player) { player.OnRecvRotation(new Vector3(clientCmd.rx, clientCmd.ry, clientCmd.rz), clientCmd.time); } } } } break; case NetCmdIdClient.SyncAnim: { SyncAnim clientCmd = (SyncAnim)cmd; if (clientCmd.type == SyncType.SpectatorView) { } } break; case NetCmdIdClient.OtherCmd: { OtherCmd clientCmd = (OtherCmd)cmd; OperationBean op = new OperationBean(); op.op = OperationBean.OpId.OtherCmd; op.param = clientCmd; operationQueue.Enqueue(op); } break; case NetCmdIdClient.FloorLocated: { FloorLocated clientCmd = (FloorLocated)cmd; _lerpStageWithFloor = clientCmd.y; Vector3 v = new Vector3(clientCmd.x, clientCmd.y, clientCmd.z); //TODO---->>>> GeMesCar测试数据 //ipad if (clientType == ClientType.IOS) { OperationBean op = new OperationBean(); op.op = OperationBean.OpId.ios_AdjustFloorLocate; op.param = v; operationQueue.Enqueue(op); } else { OperationBean op = new OperationBean(); op.op = OperationBean.OpId.hololens_AdjustFloorLocate; op.param = v; operationQueue.Enqueue(op); } Debug.Log("收到creater定位地面的消息-->>>>> " + v.ToString()); } break; case NetCmdIdClient.MarkerGenerated: { OperationBean op = new OperationBean(); op.op = OperationBean.OpId.MarkerGenerated; op.param = cmd; operationQueue.Enqueue(op); } break; case NetCmdIdClient.MarkerDetected: { OperationBean op = new OperationBean(); op.op = OperationBean.OpId.MarkerDetected; op.param = cmd; operationQueue.Enqueue(op); } break; case NetCmdIdClient.SyncWorldRoot: { Debug.Log("SpectatorViewManager#NetWork_onReceiveCmd#SyncWorldRoot"); OperationBean op = new OperationBean(); op.op = OperationBean.OpId.SyncWorldRoot; op.param = cmd; operationQueue.Enqueue(op); } break; } } }