Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable Certain Menu Features in Spectator Mode #87

Merged
merged 4 commits into from
Nov 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
435 changes: 435 additions & 0 deletions Komodo/Assets/Packages/KomodoCore/KomodoCoreAssets/Scenes/Main.unity

Large diffs are not rendered by default.

66 changes: 33 additions & 33 deletions Komodo/Assets/Packages/KomodoCore/Runtime/Prefabs/MenuUI.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &4091276155227089280
RectTransform:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1796,7 +1796,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &8766869811656989108
RectTransform:
m_ObjectHideFlags: 0
Expand All @@ -1816,7 +1816,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 105, y: -95}
m_AnchoredPosition: {x: 105, y: -60}
m_SizeDelta: {x: 210, y: 120}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1886875307629036608
Expand Down Expand Up @@ -2461,10 +2461,10 @@ RectTransform:
m_Father: {fileID: 7700205268373815943}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 110, y: -140}
m_SizeDelta: {x: 210, y: 200}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1377807928677562121
MonoBehaviour:
Expand Down Expand Up @@ -5592,10 +5592,10 @@ RectTransform:
m_Father: {fileID: 7700205268373815943}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 5, y: -5}
m_SizeDelta: {x: 210, y: 30}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 1}
--- !u!222 &1203963429663881877
CanvasRenderer:
Expand Down Expand Up @@ -8297,10 +8297,10 @@ RectTransform:
m_Father: {fileID: 2040148651102960158}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 105, y: -180}
m_SizeDelta: {x: 75, y: 40}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7700205267672626262
CanvasRenderer:
Expand Down Expand Up @@ -8480,7 +8480,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &7700205267741768715
RectTransform:
m_ObjectHideFlags: 0
Expand All @@ -8497,10 +8497,10 @@ RectTransform:
m_Father: {fileID: 2438115558609078599}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 185, y: -35}
m_SizeDelta: {x: 45, y: 55}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7700205267741768719
CanvasRenderer:
Expand Down Expand Up @@ -8720,10 +8720,10 @@ RectTransform:
m_Father: {fileID: 7700205267741768715}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 22.5, y: -5}
m_SizeDelta: {x: 30, y: 30}
m_Pivot: {x: 0.5, y: 1}
--- !u!222 &7700205267790156600
CanvasRenderer:
Expand Down Expand Up @@ -9167,10 +9167,10 @@ RectTransform:
m_Father: {fileID: 7700205267839848467}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: -450}
m_SizeDelta: {x: 220, y: 245}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!222 &7700205268373815940
CanvasRenderer:
Expand Down Expand Up @@ -9239,7 +9239,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 1}
m_Color: {r: 0.07058824, g: 0.07058824, b: 0.07058824, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
Expand Down Expand Up @@ -9672,10 +9672,10 @@ RectTransform:
m_Father: {fileID: 7700205267741768715}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 22.5, y: -55}
m_SizeDelta: {x: 55, y: 15}
m_Pivot: {x: 0.5, y: 0}
--- !u!222 &7700205268660593576
CanvasRenderer:
Expand Down
19 changes: 2 additions & 17 deletions Komodo/Assets/Packages/KomodoCore/Runtime/Prefabs/PlayerSet.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,7 @@ MonoBehaviour:
onUpFlick:
m_PersistentCalls:
m_Calls: []
currentTransform: {fileID: 0}
hoveredObjectTransform: {fileID: 0}
throwForce: 1.2
--- !u!114 &2310410839999614777
MonoBehaviour:
Expand Down Expand Up @@ -1421,7 +1421,7 @@ MonoBehaviour:
onUpFlick:
m_PersistentCalls:
m_Calls: []
currentTransform: {fileID: 0}
hoveredObjectTransform: {fileID: 0}
throwForce: 1.2
--- !u!114 &2310716809689014119
MonoBehaviour:
Expand Down Expand Up @@ -7031,21 +7031,6 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6164443520166499296, guid: 3773d0422e0122743ad9688a0d03d9dd,
type: 3}
propertyPath: m_Color.b
value: 0.16078432
objectReference: {fileID: 0}
- target: {fileID: 6164443520166499296, guid: 3773d0422e0122743ad9688a0d03d9dd,
type: 3}
propertyPath: m_Color.g
value: 0.16078432
objectReference: {fileID: 0}
- target: {fileID: 6164443520166499296, guid: 3773d0422e0122743ad9688a0d03d9dd,
type: 3}
propertyPath: m_Color.r
value: 0.16078432
objectReference: {fileID: 0}
- target: {fileID: 6555541029743400969, guid: 3773d0422e0122743ad9688a0d03d9dd,
type: 3}
propertyPath: m_AnchorMax.y
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Komodo.Utilities;

public class DrawTeleportIndicator : MonoBehaviour
{


}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@ public void OnUpdate(float deltaTime)
HyperspeedPanPlayerFromInput();
}

// if (Input.GetMouseButtonDown(1)) {
// ShowTeleportIndicator();
// }

// if (Input.GetMouseButtonUp(1)) {
// hideTeleportIndicator();
// }

SyncXRWithSpectator();
}

Expand Down Expand Up @@ -441,5 +449,18 @@ public static float ClampAngle(float angle, float min, float max)
return Mathf.Clamp(angle, min, max);
}

/// <Summary>
/// Enable teleportation with right click.
/// </Summary>
// public void ShowTeleportIndicator()
// {
// gameObject.transform.Find("TeleportIndicator").gameObject.SetActive(true);
// }

// public void hideTeleportIndicator()
// {
// gameObject.transform.Find("TeleportIndicator").gameObject.SetActive(true);
// }

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ public void SetToDesktop()
//turn on and off appropriate eventsystem to handle appropriate input
desktopStandaloneInput.gameObject.SetActive(true);
xrStandaloneInput.gameObject.SetActive(false);

}

[ContextMenu("Set to XR")]
Expand All @@ -107,7 +106,6 @@ public void SetToXR()
GetComponent<ToggleMenuDisplayMode>().SetVRViewPort();
desktopStandaloneInput.gameObject.SetActive(false);
xrStandaloneInput.gameObject.SetActive(true);

}


Expand Down Expand Up @@ -205,8 +203,6 @@ public void RemoveInputSourceWithoutClick(TriggerEventInputSource inputSource)
foreach (var canvas in canvasesToReceiveEvents)
canvas.worldCamera = inputSource_LeftHand.eventCamera;



//set linerenderer to use for line to UI interactions
xrStandaloneInput.RegisterInputSource(inputSource_LeftHand);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,6 @@ public void Awake()
Debug.LogWarning("No model data template was found for NetworkManager. Imported models may use editor template.");
}

if (socketIODisplay == null) {
throw new System.Exception("You must assign a socketIODisplay in NetworkUpdateHandler.");
}

_CreateSocketSimulator();

_GetParams();
Expand All @@ -262,6 +258,10 @@ public void Awake()

public void Start()
{
if (socketIODisplay == null) {
throw new System.Exception("You must assign a socketIODisplay in NetworkUpdateHandler.");
}

GlobalMessageManager.Instance.Subscribe("sync", (data) => _DeserializeAndProcessSyncData(data));

GlobalMessageManager.Instance.Subscribe("interaction", (data) => _DeserializeAndProcessInteractionData(data));
Expand Down Expand Up @@ -472,7 +472,7 @@ public void ProcessMessage(string typeAndMessage)
}
}

public void OnApplicationQuit()
public void OnDestroy()
{
//deregister our update loops
if (GameStateManager.IsAlive)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -582,5 +582,33 @@ public bool IsReady ()

return false;
}

/// <summary>
/// This function will disable Create and Height Calibration Panels for Desktop view.
/// </summary>
public void EnableHightCalibrationButtons()
{
//KomodoMenu -> Panels -> SettingsMenu
GameObject SettingsMenu = menu.transform.Find("Panels").transform.Find("SettingsMenu").gameObject;

//KomodoMenu -> Panels -> SettingsMenu -> HeightCalibration
GameObject heightCalibration = SettingsMenu.transform.Find("HeightCalibration").gameObject;

//KomodoMenu -> Panels -> SettingsMenu -> NotCalibrating -> CalibrateHeightButton
GameObject calibrationButtons = SettingsMenu.transform.Find("NotCalibrating").transform.Find("CalibrateHeightButton").gameObject;

//KomodoMenu -> Panels -> SettingsMenu -> NotCalibrating -> ManuallyAdjustHeight
GameObject manuallyAdjustHeight = SettingsMenu.transform.Find("NotCalibrating").transform.Find("ManuallyAdjustHeight").gameObject;

//createMenu.gameObject.SetActive(false);
heightCalibration.gameObject.SetActive(true);
calibrationButtons.gameObject.SetActive(true);
manuallyAdjustHeight.gameObject.SetActive(true);
}

public void EnableCreateMenu() {
GameObject createMenu = menu.transform.Find("Tabs").transform.Find("Create").gameObject;
createMenu.gameObject.SetActive(true);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ public void SetVRViewPort() {

UIManager.Instance.ConvertMenuToAlwaysExpanded();

UIManager.Instance.EnableCreateMenu();

UIManager.Instance.EnableHightCalibrationButtons();

return;
}
}
Expand All @@ -68,7 +72,7 @@ public void SetDesktopViewport()
UIManager.Instance.menuCanvas.renderMode = RenderMode.ScreenSpaceOverlay;

UIManager.Instance.ConvertMenuToExpandable(false);

return;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,14 @@ void Update () {
bool isVRActive = XRSettings.isDeviceActive; //tells us whether the device is attached (not necessarily if it is being worn or used.)

if (isVRActive && !previousIsVRActive) {
Debug.Log("VR Headset detected.");
OnXRChange.Invoke(WebXRState.VR, 2, new Rect(), new Rect());
}

if (!isVRActive && previousIsVRActive) {
Debug.Log("VR Headset no longer detected.");
OnXRChange.Invoke(WebXRState.NORMAL, 1, new Rect(), new Rect());
}

previousIsVRActive = isVRActive;
}
#endif
}
}
Loading