/// <summary> /// Transform all blocks to forward form /// </summary> /// <param name="pos"></param> /// <param name="rot"></param> public void ForwardTransform(Vector3?pos = null, Quaternion?rot = null, PanoramaBlock panoramaBlock = null) { if (commandQueue.Count < maxCommandBuffer) { commandQueue.Enqueue(new ForwardBackwardCommand(pos, rot, panoramaBlock, true, Time.time)); } }
public ForwardBackwardCommand(Vector3?pos, Quaternion?rot, PanoramaBlock panoramaBlock, bool isForwardCommand, float time) { position = pos; rotation = rot; this.panoramaBlock = panoramaBlock; this.isForwardCommand = isForwardCommand; commandTime = time; }
void OnValidate() { if (roomViewCenter == null) { roomViewCenter = transform; } if (panoramaContent == null) { panoramaContent = GetComponentInChildren <PanoramaBlock>(); } }
void OnValidate() { if (viewContentDelegation == null) { viewContentDelegation = GetComponentInChildren <PanoramaBlock>(); } if (viewContentDelegation) { sceneViewCenter = viewContentDelegation.transform; sceneViewContentType = ViewContentType.PanoramaView; } if (sceneViewCenter == null) { sceneViewCenter = transform; } if (string.IsNullOrEmpty(specialSceneName)) { specialSceneName = name; } }
CameraCharacter.ViewParameters GenerateViewParameterByStatus(Vector3?pos = null, Quaternion?rot = null, PanoramaBlock panoramaBlock = null) { CameraCharacter.ViewParameters ret = new CameraCharacter.ViewParameters(); switch (status) { case BlockCombinationStatus.Combine: ret.viewMode = CameraViewMode.HorizontalFreeView; ret.initialRotation = CameraCharacter.Singleton.fixedViewRotation; ret.cameraZOffset = 24f; break; case BlockCombinationStatus.CombineInsidePreview: ret.viewMode = CameraViewMode.HorizontalHalfFreeView; ret.initialRotation = CameraCharacter.Singleton.lookDownViewRotation; ret.cameraZOffset = 25f; ret.cameraScaleMode = CameraScaleMode.MoveCamera; break; case BlockCombinationStatus.Divide: ret.viewMode = CameraViewMode.FixedView; ret.cameraZOffset = 22f; ret.initialPosition = CameraCharacter.Singleton.fixedViewPosition; ret.initialRotation = CameraCharacter.Singleton.fixedViewRotation; break; case BlockCombinationStatus.FocusOnOneBlock: ret.viewMode = CameraViewMode.HorizontalHalfFreeView; ret.initialPosition = CameraCharacter.Singleton.lookDownViewPosition; ret.initialRotation = CameraCharacter.Singleton.lookDownViewRotation; ret.cameraZOffset = 18f; ret.cameraXOffset = 5f; ret.cameraScaleMode = CameraScaleMode.MoveCamera; break; case BlockCombinationStatus.Indoor: ret.viewMode = CameraViewMode.FreeView; ret.viewContentType = ViewContentType.PanoramaView; if (panoramaBlock != null) { ret.FadeInFlag = panoramaBlock.PanoramaContentReady; } ret.cameraZOffset = 0f; ret.initialPosition = pos; ret.initialRotation = rot; ret.cameraScaleMode = CameraScaleMode.ScaleFov; break; case BlockCombinationStatus.SpecialScene: break; default: break; } return(ret); }
void ProcessForBackCommand() { if (commandQueue.Count == 0 || IsTransforming) { return; } var oldStatus = status; var command = commandQueue.Dequeue(); currentHoldingPanorama = command.panoramaBlock; if (command.isForwardCommand) { switch (status) { case BlockCombinationStatus.None: status = BlockCombinationStatus.Combine; break; case BlockCombinationStatus.Combine: if (CameraCharacter.Singleton.GameModeC == GameMode.GuideMode) { backButton.SetActive(true); } GlobalEventManager.SendEvent(GlobalEventManager.RoofRemoved); status = BlockCombinationStatus.CombineInsidePreview; break; case BlockCombinationStatus.CombineInsidePreview: status = BlockCombinationStatus.Divide; GlobalEventManager.SendEvent(GlobalEventManager.BlockDivide); break; case BlockCombinationStatus.Divide: status = BlockCombinationStatus.FocusOnOneBlock; break; case BlockCombinationStatus.FocusOnOneBlock: status = BlockCombinationStatus.Indoor; break; case BlockCombinationStatus.Indoor: return; case BlockCombinationStatus.SpecialScene: return; default: break; } MoveSubBlocksByStatus(oldStatus, status); CameraCharacter.Singleton.PushView(GenerateViewParameterByStatus(command.position, command.rotation, command.panoramaBlock)); if (command.panoramaBlock) { command.panoramaBlock.DownloadAssetBundle(); } } else { switch (status) { case BlockCombinationStatus.Combine: if (CameraCharacter.Singleton.GameModeC == GameMode.FreeMode) { GlobalEventManager.SendEvent("ShowModeSelecting"); } break; case BlockCombinationStatus.CombineInsidePreview: GlobalEventManager.SendEvent(GlobalEventManager.BlockCombine); if (CameraCharacter.Singleton.GameModeC == GameMode.GuideMode) { backButton.SetActive(false); } status = BlockCombinationStatus.Combine; break; case BlockCombinationStatus.Divide: status = BlockCombinationStatus.CombineInsidePreview; break; case BlockCombinationStatus.FocusOnOneBlock: GlobalEventManager.SendEvent(GlobalEventManager.BlockDivide); status = BlockCombinationStatus.Divide; break; case BlockCombinationStatus.Indoor: status = BlockCombinationStatus.FocusOnOneBlock; break; case BlockCombinationStatus.SpecialScene: return; default: break; } MoveSubBlocksByStatus(oldStatus, status); CameraCharacter.Singleton.PopView(); if (command.panoramaBlock) { command.panoramaBlock.DownloadAssetBundle(); } } }
public BlockBase CreateAndInitialiseBlock(View hostView, Node parentNode, BlockBase parentBlock, BlockDefinition definition, FieldList contentData, bool isRoot) { if (definition != null) { BlockBase block = null; if (definition is ContainerBlockDefinition) { ContainerBlockDefinition cdef = (ContainerBlockDefinition)definition; switch (cdef.HintedType) { case UIHintedType.ApplicationBar: block = new ApplicationBarBlock(hostView, parentNode, parentBlock, definition, contentData, isRoot); break; case UIHintedType.NativeMessageBox: block = new NativeMessageBoxBlock(hostView, parentNode, parentBlock, definition, contentData, isRoot); break; case UIHintedType.TabBar: block = new TabBarBlock(hostView, parentNode, parentBlock, definition, contentData, isRoot); break; case UIHintedType.ActionSheet: block = new ActionSheetBlock(hostView, parentNode, parentBlock, definition, contentData, isRoot); break; case UIHintedType.Pivot: block = new PivotBlock(hostView, parentNode, parentBlock, definition, contentData, isRoot); break; case UIHintedType.Panorama: block = new PanoramaBlock(hostView, parentNode, parentBlock, definition, contentData, isRoot); break; case UIHintedType.None: default: { if (cdef is BoxLayoutBlockDefinition) { block = new BoxLayoutBlock(hostView, parentNode, parentBlock, definition, contentData, isRoot); } else if (cdef is GridBlockDefinition) { block = new GridBlock(hostView, parentNode, parentBlock, definition, contentData, isRoot); } else if (cdef is ListBlockDefinition) { block = new ListBlock(hostView, parentNode, parentBlock, definition, contentData, isRoot); } else if (cdef is FrameDefinition) { block = new FrameBlock(hostView, parentNode, parentBlock, definition, contentData, isRoot); } break; } } } else if (definition is CommonAtomicBlockDefinition) { CommonAtomicBlockDefinition cabdef = (CommonAtomicBlockDefinition)definition; switch (cabdef.HintedType) { case UIHintedType.ApplicationBarOptions: block = new ApplicationBarOptionsBlock(hostView, parentNode, parentBlock, definition, contentData, isRoot); break; case UIHintedType.ApplicationBarButton: block = new ApplicationBarButtonBlock(hostView, parentNode, parentBlock, definition, contentData, isRoot); break; case UIHintedType.ApplicationBarMenuItem: block = new ApplicationBarMenuItemBlock(hostView, parentNode, parentBlock, definition, contentData, isRoot); break; case UIHintedType.NativeMessageBoxBody: block = new NativeMessageBoxBodyBlock(hostView, parentNode, parentBlock, definition, contentData, isRoot); break; case UIHintedType.NativeMessageBoxButton: block = new NativeMessageBoxButtonBlock(hostView, parentNode, parentBlock, definition, contentData, isRoot); break; case UIHintedType.TabBarButton: block = new TabBarButtonBlock(hostView, parentNode, parentBlock, definition, contentData, isRoot); break; case UIHintedType.SystemTray: block = new SystemTrayBlock(hostView, parentNode, parentBlock, definition, contentData, isRoot); break; case UIHintedType.Placeholder: block = new PlaceholderBlock(hostView, parentNode, parentBlock, definition, contentData, isRoot); break; case UIHintedType.None: default: { if (cabdef is AtomicBlockDefinition) { block = new AtomicBlock(hostView, parentNode, parentBlock, definition, contentData, isRoot); } else if (cabdef is SingleSlotBlockDefinition) { block = new SingleSlotBlock(hostView, parentNode, parentBlock, definition, contentData, isRoot); } break; } } } else if (definition is ScrollingTextBlockDefinition) { block = new ScrollingTextBlock(hostView, parentNode, parentBlock, definition, contentData, isRoot); } else if (definition is MapPluginBlockDefinition) { block = new MapPluginBlock(hostView, parentNode, parentBlock, definition, contentData, isRoot); } if (block != null) { if (block.IsHidden) { block.Visibility = Visibility.Collapsed; } return(block); } } return(null); }