protected void OnSaveButton(VoxMenuButton button, bool state) { Debug.Log("Saving World"); WorldName = "VoxWorld" + button.toolTip; SaveAll(); }
protected void OnToggleQuality(VoxMenuButton button, bool state) { if (!state) return; highRes = button.isSelected; var level = highRes ? highResLevel : defaultLevel; QualitySettings.SetQualityLevel(level); //OVRManager.instance.nativeTextureScale = highRes ? 1 : textureScaleHigh; }
protected void OnToggleTextureScale(VoxMenuButton button, bool state) { if (!state) return; //var prevScale = ovrManager.nativeTextureScale; if (button.isSelected) { //OVRManager.instance.nativeTextureScale = textureScaleLow; //OVRManager.NativeTextureScaleModified(prevScale, textureScaleLow); } else { //OVRManager.instance.nativeTextureScale = textureScaleHigh; } //OVRManager.ForceNativeTextureScaleModified(); //ovrManager.gameObject.SetActive(false); //ovrManager.gameObject.SetActive(true); //ovrManager.gameObject.SetActive(false); //ovrManager.gameObject.SetActive(true); }
protected void OnPrefabButton(VoxMenuButton button, bool state) { if (state == false) return; //Debug.Log("Prefab"); //interactionMode = VoxInteractionMode.Prefab; //interactionMode = VoxInteractionMode.Create; UsePrefab = button.isSelected; if (!UsePrefab) PrefabIndex = 0; else PrefabIndex = 1; //AddMode = false; }
protected void OnPaintButton(VoxMenuButton button, bool state) { if (state == false) return; //Debug.Log("Painting"); //interactionMode = VoxInteractionMode.PaintBlocks; //AddMode = false; if (button.isSelected) { interactionMode = VoxInteractionMode.Paint; PaintButton.isSelected = true; AddButton.isSelected = false; SubtractButton.isSelected = false; } else { interactionMode = VoxInteractionMode.Create; if (AddMode) { AddButton.isSelected = true; SubtractButton.isSelected = false; } else { AddButton.isSelected = false; SubtractButton.isSelected = true; } } }
protected void OnSubtractButton(VoxMenuButton button, bool state) { if (state == false) return; //Debug.Log("Subtracting"); //interactionMode = VoxInteractionMode.SubtractBlocks; interactionMode = VoxInteractionMode.Create; AddMode = false; SubtractButton.isSelected = true; AddButton.isSelected = false; PaintButton.isSelected = false; }
public void SetParentButton(VoxMenuButton button) { parentButton = button; }
protected void OnNewButton(VoxMenuButton button, bool state) { WorldName = "VoxWorld"; NewWorld(); }
protected void OnToggleMusicButton(VoxMenuButton button, bool state) { if (!state) return; if (button.isSelected) { backgroundMusic.enabled = true; if(!backgroundMusic.isPlaying) backgroundMusic.Play(); } else { backgroundMusic.Stop(); backgroundMusic.enabled = false; } }
protected void OnDrawStraightButton(VoxMenuButton button, bool state) { if (state == false) return; drawStraight = button.isSelected; }
protected void OnColorMenu(VoxMenuButton button, bool state) { if (!state) return; }
protected void OnEyedropper(VoxMenuButton button, bool state) { if (!state) return; EnableEyeDropper = true; mainMenu.toolTipText.text = "Click a block to pick color"; }
protected void OnButtonSelect(VoxMenuButton button, bool state) { if (!state) return; SetColor(button.GetColor()); }
protected void OnToggleWater(VoxMenuButton button, bool state) { if (!state) return; ToggleWater(button.isSelected); }
protected void OnQuitButton(VoxMenuButton button, bool state) { if (!state) return; ShowConfirmQuitMenu(); }
protected void LateUpdate() { if (showMenu) { canSelectTimer -= Time.deltaTime; var select = false; if (canSelectTimer < 0) select = VoxInput.GetSelectDown() || Input.GetButtonDown(VoxInput.rightShoulder) || Input.GetButtonDown(VoxInput.ButtonA); var doubleClick = false; if (doubleClickTimer <= doubleClickDelay) { if (select) doubleClick = true; } else { if (select) { doubleClickTimer = 0f; } } doubleClickTimer += Time.deltaTime; var rayHit = false; var ray = VoxManager.ViewRay; RaycastHit hit; var submenuOpen = IsSubmenuOpen(); foreach (var button in menuButtons) { if (!submenuOpen) { if (button.RayCast(ray, out hit, 25f)) { rayHit = true; //HighlightButtons(false); if (highlightedButton == null) { button.Highlight(true); if (!submenuOpen) toolTipText.text = button.toolTip; highlightedButton = button; } else if (highlightedButton != button) { button.Highlight(true); if(!submenuOpen) toolTipText.text = button.toolTip; highlightedButton = button; } if (select) button.Select(true); if (doubleClick) button.DoubleClick(); } else { if (highlightedButton != null) { if (button == highlightedButton) highlightedButton = null; } button.Highlight(false); } } } if (!submenuOpen && !rayHit) { toolTipText.text = ""; } if (!submenuOpen && !rayHit && select) { PlayClip(EVoxMenuSound.MenuClose); TryClose(); } } else { //if (doubleClick && Crosshair.CanDoubleClickToOpenMenu) ShowMenu(true); } }
protected void OnNextSong(VoxMenuButton button, bool state) { if (!state) return; NextSong(); }
protected void OnBrushButton(VoxMenuButton button, bool state) { if (state == false) return; //Debug.Log("Prefab"); //interactionMode = VoxInteractionMode.Prefab; //interactionMode = VoxInteractionMode.Create; //UsePrefab = button.isSelected; //if (!UsePrefab) PrefabIndex = 0; //else PrefabIndex = 1; var newIndex = 0; if (int.TryParse(button.description, out newIndex)) { PrefabIndex = newIndex; } //AddMode = false; }
protected void OnTeleportButton(VoxMenuButton button, bool state) { if (state == false) return; //Debug.Log("Adding"); //interactionMode = VoxInteractionMode.AddBlocks; interactionMode = VoxInteractionMode.Teleport; AddButton.isSelected = false; SubtractButton.isSelected = false; PaintButton.isSelected = false; //PrefabButton.isSelected = false; }
protected void OnPaintUsingPlanesButton(VoxMenuButton button, bool state) { if (state == false) return; paintUsingConstructionPlanes = button.isSelected; }
protected void OnDoubleClickLayerButton(VoxMenuButton button, bool state) { if (state == false) return; doubleClickToIncreaseHeight = button.isSelected; }
protected void OnToggleAA(VoxMenuButton button, bool state) { if (!state) return; AAEnabled = !button.isSelected; if (AAEnabled) { // OVRManager.instance.eyeTextureAntiAliasing = OVRManager.RenderTextureAntiAliasing._2; } else { // OVRManager.instance.eyeTextureAntiAliasing = OVRManager.RenderTextureAntiAliasing._1; } //ovrManager.gameObject.SetActive(false); //ovrManager.gameObject.SetActive(true); }
protected void OnCreateAtFixedDistanceButton(VoxMenuButton button, bool state) { if (state == false) return; createAtFixedDistance = button.isSelected; }
protected void OnLoadButton(VoxMenuButton button, bool state) { Debug.Log("Loading World"); WorldName = "VoxWorld" + button.toolTip; LoadAll(); }