Esempio n. 1
0
    //******************** END   IOVRInspectorContext ********************


    // Build menu for scene selection
    public void BuildSceneUI(OVRInspector Inspector)
    {
        if (currentNode.parent != null)
        {
            Inspector.AddFolder("..", delegate { NodeSelected(currentNode.parent); });
        }
        foreach (var node in currentNode.children)
        {
            HierarchyNode nodeCopy = node;
            if (node.children.Count > 0)
            {
                if (node.children.Count == 1 && node.children[0].children.Count == 0 && string.Equals(node.children[0].name, node.name, System.StringComparison.InvariantCultureIgnoreCase))
                {
                    // Special case where a folder only contains one scene with the same name as the folder. Just show the scene
                    Inspector.AddButton(node.children[0].name, delegate { NodeSelected(nodeCopy.children[0]); });
                }
                else
                {
                    Inspector.AddFolder(node.name, delegate { NodeSelected(nodeCopy); });
                }
            }
            else
            {
                Inspector.AddButton(node.name, delegate { NodeSelected(nodeCopy); });
            }
        }
    }
Esempio n. 2
0
    void Start()
    {
        // Load scenes list from file
        ReadSceneList();

        // Start at the root level of the scene menu system
        currentNode = rootNode;


        // Configure top level menu items in the inspector.
        Inspector = OVRInspector.instance;
        Inspector.RegisterContext(this, (int)InspectorContext.Help, true);
        Inspector.RegisterContext(this, (int)InspectorContext.SceneList, true);
        // Keep the inspector around as we load scenes
        DontDestroyOnLoad(Inspector.gameObject);


        // pop the inspector up now and show the intro text
        Inspector.Show();
        Inspector.SetDocTextFromFile(introFile);

        // It's easy to accidentally scroll the docs as you put the headset on so
        // disable the docs scrolling briefly
        StartCoroutine(DisableDocsScrollingForStartup());

        InitReporting();


#if !UNITY_ANDROID || UNITY_EDITOR
        // Lock the cursor
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible   = false;
#endif
    }
    // Use this for initialization
    void Awake()
    {
        OVRManager.loadedXRDevice = OVRManager.XRDevice.Oculus;
        print(OVRManager.loadedXRDevice.ToString());
        if (OVRManager.loadedXRDevice == OVRManager.XRDevice.Oculus)
        {
            var inspectorLoaders = GameObject.FindObjectsOfType(typeof(OVRInspectorLoader));
            if (inspectorLoaders.Length > 1)
            {
                Debug.LogError("More than 1 InspectorLoader in scene");
            }
            if (!OVRInspector.instance)
            {
                OVRInspector inspectorPrefab = (OVRInspector)Resources.Load("Prefabs/OVRInspector", typeof(OVRInspector));
                Instantiate(inspectorPrefab).name = "OVRInspector";
            }

            // Register event handlers
            OVRInspector.instance.onInspectorShow = onInspectorShow;
            OVRInspector.instance.onInspectorHide = onInspectorHide;
            // Add our context to the main UI
            OVRInspector.instance.LoadSceneSpecificContextsFromPanel(donorPanel);

            OVRInspector.instance.allowClose = allowClose;
        }
    }
Esempio n. 4
0
 /// <summary>
 /// Build UI for this context
 /// </summary>
 /// <param name="inspector">Reference to inspector which can be used to add buttons/folders for this context</param>
 public void BuildUI(OVRInspector inspector)
 {
     if (context != null)
     {
         context.BuildUI(inspector, subContext);
     }
 }
Esempio n. 5
0
 // Show help screen
 public void BuildHelpUI(OVRInspector Inspector)
 {
     Inspector.SetDocTextFromFile(helpFile);
     Inspector.AddButton("Show Intro Docs", delegate { ShowIntroDocs(); });
     if (Inspector.ScenePanelPresent())
     {
         Inspector.AddButton("Show Scene Docs", delegate { GotoSceneControls(); });
     }
 }
Esempio n. 6
0
 /// <summary>
 /// Set this as the active context
 /// </summary>
 public void SetContextActive(OVRInspector inspector, bool active)
 {
     if (panel != null)
     {
         panel.gameObject.SetActive(active);
     }
     if (context != null)
     {
         context.SetContextActive(inspector, subContext, active);
     }
 }
Esempio n. 7
0
    // Called by the inspector when it wants us to build one of the UIs we registered with RegisterContext
    public void BuildUI(OVRInspector Inspector, int subContextID)
    {
        switch ((InspectorContext)subContextID)
        {
        case InspectorContext.Help:
            BuildHelpUI(Inspector);
            break;

        case InspectorContext.SceneList:
            BuildSceneUI(Inspector);
            break;
        }
    }
    // Use this for initialization
    void Awake()
    {
        var inspectorLoaders = GameObject.FindObjectsOfType(typeof(OVRInspectorLoader));

        if (inspectorLoaders.Length > 1)
        {
            Debug.LogError("More than 1 InspectorLoader in scene");
        }
        if (!OVRInspector.instance)
        {
            OVRInspector inspectorPrefab = (OVRInspector)Resources.Load("Prefabs/OVRInspector", typeof(OVRInspector));
            Instantiate(inspectorPrefab).name = "OVRInspector";
            inspectorPrefab.showButton        = OVRInput.Button.None;
        }

        // Register event handlers
        OVRInspector.instance.onInspectorShow = onInspectorShow;
        OVRInspector.instance.onInspectorHide = onInspectorHide;
        // Add our context to the main UI
        OVRInspector.instance.LoadSceneSpecificContextsFromPanel(donorPanel);

        OVRInspector.instance.allowClose = allowClose;
    }
Esempio n. 9
0
 // ********************  IOVRInspectorContext ********************
 public void SetContextActive(OVRInspector Inspector, int subContextID, bool active)
 {
 }