Skip to content

Commit

Permalink
Allow hiding of UI via escape key in view only mode
Browse files Browse the repository at this point in the history
  • Loading branch information
andybak committed Feb 7, 2025
1 parent 0530870 commit b80d69f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Assets/Scenes/Main.unity
Original file line number Diff line number Diff line change
Expand Up @@ -30934,6 +30934,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_UiRoot: {fileID: 2128862032}
m_MenuPanel: {fileID: 1332713373}
m_CloseButton: {fileID: 1590074096}
m_MenuButton: {fileID: 9088044348092674845}
--- !u!1 &1804317400
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -37188,11 +37190,6 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4662939369836531456, guid: eec2c6d84d06c8243a91c52d96d79404,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
Expand All @@ -37204,6 +37201,12 @@ RectTransform:
type: 3}
m_PrefabInstance: {fileID: 9088044348092674843}
m_PrefabAsset: {fileID: 0}
--- !u!1 &9088044348092674845 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 5012355343807203840, guid: eec2c6d84d06c8243a91c52d96d79404,
type: 3}
m_PrefabInstance: {fileID: 9088044348092674843}
m_PrefabAsset: {fileID: 0}
--- !u!4 &9123593761565215834
Transform:
m_ObjectHideFlags: 0
Expand Down
2 changes: 2 additions & 0 deletions Assets/Scripts/GUI/ViewModeUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ public class ViewModeUI : MonoBehaviour
{
public GameObject m_UiRoot;
public GameObject m_MenuPanel;
public GameObject m_CloseButton;
public GameObject m_MenuButton;

void Awake()
{
Expand Down
19 changes: 19 additions & 0 deletions Assets/Scripts/Multiplayer/NonVrMultiplayerUi.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,32 @@
using System;
using System.Collections;
using OpenBrush.Multiplayer;
using TiltBrush;
using TMPro;
using UnityEngine;
using UnityEngine.InputSystem;

public class NonVrMultiplayerUi : MonoBehaviour
{
public TMP_InputField m_RoomNameInput;
public TMP_InputField m_NicknameInput;

private ViewModeUI m_ViewModeUi;

void Start()
{
m_ViewModeUi = GetComponentInParent<ViewModeUI>();
}

void Update()
{
if (Keyboard.current.escapeKey.wasPressedThisFrame)
{
m_ViewModeUi.m_CloseButton.SetActive(!m_ViewModeUi.m_CloseButton.activeSelf);
m_ViewModeUi.m_MenuButton.SetActive(!m_ViewModeUi.m_MenuButton.activeSelf);
}
}

public void HandleJoinRoomButton()
{
StartCoroutine(HandleJoinRoomButtonCoroutine());
Expand Down Expand Up @@ -48,6 +66,7 @@ private void OnJoinRoomCompleted(bool success)
cameraPos.y += 12;
App.VrSdk.GetVrCamera().transform.position = cameraPos;
gameObject.SetActive(false);

}
else
{
Expand Down

0 comments on commit b80d69f

Please sign in to comment.