public OVRInspectorPanelBuilder(GameObject panel)
    {
        leftPanel  = rightPanel = null;
        buttonList = new List <Button>();
        this.panel = panel;

        Transform scrollingContentTransform = panel.transform.Find("PanelContent");

        if (scrollingContentTransform != null)
        {
            buttonPanel = scrollingContent = scrollingContentTransform.gameObject;
            initialScrollingContentSize = scrollingContent.GetComponent <RectTransform>().rect.height;
        }
        else
        {
            scrollingContent = null;
            buttonPanel      = panel;
        }
    }
Пример #2
0
    void Awake()
    {
        Debug.Log(string.Format("OVRInspector Awake", 0));

        playerLayer = GetLayerOrReportError("Player");

        if (instance != null)
        {
            Debug.LogError("Existing OVRInspector");
            GameObject.Destroy(gameObject);
            return;
        }
        instance = this;


        UpdateUIMaterials();

        //Find prefabs
        buttonPrefab      = (Button)Resources.Load("Prefabs/Button", typeof(Button));
        folderPrefab      = (Button)Resources.Load("Prefabs/Folder", typeof(Button));
        eventSystemPrefab = (EventSystem)Resources.Load("Prefabs/EventSystem", typeof(EventSystem));



        // Setup canvas and canvas panel builders
        canvas = transform.Find("Canvas").gameObject;

        leftPanel   = new OVRInspectorPanelBuilder(canvas.transform.Find("LeftPanel").gameObject);
        rightPanel  = new OVRInspectorPanelBuilder(canvas.transform.Find("RightPanel").gameObject);
        centerPanel = new OVRInspectorPanelBuilder(canvas.transform.Find("CenterPanel").gameObject);

        docsPanel     = rightPanel.panel.transform.Find("DocsPanel").gameObject;
        controlsPanel = centerPanel;
        docsPanelText = docsPanel.GetComponentInChildren <Text>();
        docsScroller  = docsPanel.GetComponentInChildren <OVRGazeScroller>();

        // Setup links between panels for continous mouse movement
        leftPanel.rightPanel   = centerPanel;
        rightPanel.leftPanel   = centerPanel;
        centerPanel.leftPanel  = leftPanel;
        centerPanel.rightPanel = rightPanel;

        discomfortWarning = GetComponent <OVRDiscomfortWarning>();
        //discomfortWarning = null;

        // Setup mouse pointer
        pointer             = canvas.GetComponent <OVRMousePointer>();
        currentPointerPanel = leftPanel;
        LockCursor();


        // Pre-level stuff
        OnAwakeOrLevelLoad();

        // Add UI panels that are part of the prefab
        LoadPanels(centerPanel.panel.transform, false);

        // Search for UI panels and add them to the context list
        SetupAttachedContexts();


        CentreMouse();
        Hide();
    }
Пример #3
0
 /// <summary>
 /// Set the panel the mouse pointer is currently in
 /// </summary>
 void SetPointerPanel(OVRInspectorPanelBuilder panel)
 {
     currentPointerPanel = panel;
     pointer.pointerObject.transform.SetParent(panel.panel.transform);
     pointer.pointerObject.transform.localRotation = Quaternion.identity;
 }