Exemplo n.º 1
0
    private void _SetParticlesSeeds()
    {
        if (MiddleVR.VRClusterMgr.IsCluster())
        {
            // Creating the list of randomSeed / is playOnAwake to sync the seeds
            // of each particle systems to the master
            vrValue particlesDataList = vrValue.CreateList();

            foreach (ParticleSystem particle in GameObject.FindObjectsOfType(typeof(ParticleSystem)) as ParticleSystem[])
            {
                if (MiddleVR.VRClusterMgr.IsServer())
                {
                    vrValue particleData = vrValue.CreateList();

                    particleData.AddListItem((int)particle.randomSeed);
                    particleData.AddListItem(particle.playOnAwake);

                    particlesDataList.AddListItem(particleData);
                }
                // We reset the particle systems to sync them in every nodes of the cluster
                particle.Clear();
                particle.Stop();
                particle.time = .0f;
            }

            m_startParticlesCommand = new vrCommand("startParticleCommand", StartParticlesCommandHandler);

            if (MiddleVR.VRClusterMgr.IsServer())
            {
                m_startParticlesCommand.Do(particlesDataList);
            }
        }
    }
Exemplo n.º 2
0
    protected void Start()
    {
        MVRTools.Log(4, "[>] VR Manager Start.");

        m_Kernel.DeleteLateObjects();

#if !UNITY_3_4 && !UNITY_3_5 && !UNITY_4_0 && !UNITY_4_0_1 && !UNITY_4_1
        m_AllowRenderTargetAA = true;
#endif

        // Reset Manager's position so text display is correct.
        transform.position   = new UnityEngine.Vector3(0, 0, 0);
        transform.rotation   = new Quaternion();
        transform.localScale = new UnityEngine.Vector3(1, 1, 1);

        m_Wand = GameObject.Find("VRWand");

        m_VRMenu = GameObject.Find("VRMenu");

        ShowWandGeometry(ShowWand);

        _EnableProximityWarning(m_ShowScreenProximityWarnings);

        _EnableFPSDisplay(m_ShowFPS);

        _EnableNavigationFly(m_Fly);

        _EnableNavigationCollision(m_NavigationCollisions);

        _EnableManipulationReturnObjects(m_ManipulationReturnObjects);

        _EnableVRMenu(m_UseVRMenu);

        if (ForceQuality)
        {
            QualitySettings.SetQualityLevel(ForceQualityIndex);
        }

        // Manage VSync after the quality settings
        MVRTools.ManageVSync();

        // Set AA from vrx configuration file
        QualitySettings.antiAliasing = m_AntiAliasingLevel;

        // Check if MiddleVR Reset is needed
        if (!Application.isEditor && (ForceQuality || QualitySettings.antiAliasing > 1))
        {
            bool useOpenGLQuadbuffer = m_DisplayMgr.GetActiveViewport(0).GetStereo() && (m_DisplayMgr.GetActiveViewport(0).GetStereoMode() == 0); //VRStereoMode_QuadBuffer = 0
            if (useOpenGLQuadbuffer || m_ClusterMgr.GetForceOpenGLConversion())
            {
                m_NeedDelayedRenderingReset = true;
                m_RenderingResetDelay       = 1;
            }
        }

        m_QuitCommand = new vrCommand("VRManager.QuitApplicationCommand", _QuitApplicationCommandHandler);

        MVRTools.Log(4, "[<] End of VR Manager Start.");
    }
Exemplo n.º 3
0
        protected virtual void Start()
        {
#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
            _enabledCommand        = new vrCommand("", EnabledCommandHandler);
            _opacityChangedCommand = new vrCommand("", OpacityChangedCommandHandler);
#endif
            UpdateProperties();
        }
 protected void OnDisable()
 {
     if (m_Command != null)
     {
         m_Command.Dispose();
         m_Command = null;
     }
 }
Exemplo n.º 5
0
 protected void OnDisable()
 {
     if( m_Command != null )
     {
         m_Command.Dispose();
         m_Command = null;
     }
 }
Exemplo n.º 6
0
 void OnDestroy()
 {
     if (m_startParticlesCommand != null)
     {
         m_startParticlesCommand.Dispose();
         m_startParticlesCommand = null;
     }
 }
Exemplo n.º 7
0
    public void CreateInteractionToggleButton(vrInteraction iInteraction, string iButtonName, vrWidgetMenu iParentMenu, vrCommand.Delegate iButtonHandler)
    {
        string itName = iInteraction.GetName();

        vrCommand newCommand = new vrCommand("VRMenu." + itName + "ToggleCommand", iButtonHandler);
        m_Commands.Add(itName, newCommand);

        vrWidgetToggleButton button = new vrWidgetToggleButton("VRMenu." + itName + "ToggleButton", iParentMenu, iButtonName, newCommand, iInteraction.IsActive());
        m_Buttons.Add(itName, button);
    }
Exemplo n.º 8
0
    // Create cluster command on script start
    // For more information, refer to the MiddleVR User Guide and the VRShareTransform script
    protected void Start()
    {
        uint shareID = g_shareID++;
        string shareName = "VRShareTransform_" + shareID.ToString();

        // Create the command with cluster flag
        m_Command = new vrCommand(shareName, _CommandHandler);

        m_ClusterMgr = MiddleVR.VRClusterMgr;
    }
Exemplo n.º 9
0
    // Create cluster command on script start
    // For more information, refer to the MiddleVR User Guide and the VRShareTransform script
    protected void Start()
    {
        uint   shareID   = g_shareID++;
        string shareName = "VRShareTransform_" + shareID.ToString();

        // Create the command with cluster flag
        m_Command = new vrCommand(shareName, _CommandHandler);

        m_ClusterMgr = MiddleVR.VRClusterMgr;
    }
Exemplo n.º 10
0
    private void AddButton(VRMenu iVRMenu)
    {
        // Add a button at the start of the menu
        m_MyItemCommand = new vrCommand("VRMenu.MyCustomButtonCommand", MyItemCommandHandler);

        vrWidgetButton button = new vrWidgetButton("VRMenu.MyCustomButton", iVRMenu.menu, "My Menu Item", m_MyItemCommand);
        iVRMenu.menu.SetChildIndex(button, 0);

        // Add a separator below it
        vrWidgetSeparator separator = new vrWidgetSeparator("VRMenu.MyCustomSeparator", iVRMenu.menu);
        iVRMenu.menu.SetChildIndex(separator, 1);
    }
Exemplo n.º 11
0
    private void Start()
    {
        // Create commands

        m_ButtonCommand      = new vrCommand("GUIMenuSample.ButtonCommand", ButtonHandler);
        m_CheckboxCommand    = new vrCommand("GUIMenuSample.CheckboxCommand", CheckboxHandler);
        m_RadioCommand       = new vrCommand("GUIMenuSample.RadioCommand", RadioHandler);
        m_ColorPickerCommand = new vrCommand("GUIMenuSample.ColorPickerCommand", ColorPickerHandler);
        m_SliderCommand      = new vrCommand("GUIMenuSample.SliderCommand", SliderHandler);
        m_ListCommand        = new vrCommand("GUIMenuSample.ListCommand", ListHandler);

        // Create GUI

        m_GUIRendererWeb = null;

        VRWebView webViewScript = GetComponent <VRWebView>();

        if (webViewScript == null)
        {
            MVRTools.Log(0, "[X] VRGUIMenuSample does not have a WebView.");
            enabled = false;
            return;
        }

        m_GUIRendererWeb = new vrGUIRendererWeb("", webViewScript.webView);

        m_Menu = new vrWidgetMenu("GUIMenuSample.MainMenu", m_GUIRendererWeb);

        m_Button1 = new vrWidgetButton("GUIMenuSample.Button1", m_Menu, "Button", m_ButtonCommand);

        new vrWidgetSeparator("GUIMenuSample.Separator1", m_Menu);

        m_Checkbox = new vrWidgetToggleButton("GUIMenuSample.Checkbox", m_Menu, "Toggle Button", m_CheckboxCommand, true);

        m_Submenu = new vrWidgetMenu("GUIMenuSample.SubMenu", m_Menu, "Sub Menu");
        m_Submenu.SetVisible(true);

        m_Radio1 = new vrWidgetRadioButton("GUIMenuSample.Radio1", m_Submenu, "Huey", m_RadioCommand, "Huey");
        m_Radio2 = new vrWidgetRadioButton("GUIMenuSample.Radio2", m_Submenu, "Dewey", m_RadioCommand, "Dewey");
        m_Radio3 = new vrWidgetRadioButton("GUIMenuSample.Radio3", m_Submenu, "Louie", m_RadioCommand, "Louie");

        m_Picker = new vrWidgetColorPicker("GUIMenuSample.ColorPicker", m_Menu, "Color Picker", m_ColorPickerCommand, new vrVec4(0, 0, 0, 0));

        m_Slider = new vrWidgetSlider("GUIMenuSample.Slider", m_Menu, "Slider", m_SliderCommand, 50.0f, 0.0f, 100.0f, 1.0f);

        vrValue listContents = vrValue.CreateList();

        listContents.AddListItem("Item 1");
        listContents.AddListItem("Item 2");

        m_List = new vrWidgetList("GUIMenuSample.List", m_Menu, "List", m_ListCommand, listContents, 0);
    }
Exemplo n.º 12
0
    private void Start()
    {
        // Create commands

        m_ButtonCommand = new vrCommand("GUIMenuSample.ButtonCommand", ButtonHandler);
        m_CheckboxCommand = new vrCommand("GUIMenuSample.CheckboxCommand", CheckboxHandler);
        m_RadioCommand = new vrCommand("GUIMenuSample.RadioCommand", RadioHandler);
        m_ColorPickerCommand = new vrCommand("GUIMenuSample.ColorPickerCommand", ColorPickerHandler);
        m_SliderCommand = new vrCommand("GUIMenuSample.SliderCommand", SliderHandler);
        m_ListCommand = new vrCommand("GUIMenuSample.ListCommand", ListHandler);

        // Create GUI

        m_GUIRendererWeb = null;

        VRWebView webViewScript = GetComponent<VRWebView>();

        if (webViewScript == null)
        {
            MVRTools.Log(0, "[X] VRGUIMenuSample does not have a WebView.");
            enabled = false;
            return;
        }

        m_GUIRendererWeb = new vrGUIRendererWeb("", webViewScript.webView);

        m_Menu = new vrWidgetMenu("GUIMenuSample.MainMenu", m_GUIRendererWeb);

        m_Button1 = new vrWidgetButton("GUIMenuSample.Button1", m_Menu, "Button", m_ButtonCommand);

        new vrWidgetSeparator("GUIMenuSample.Separator1", m_Menu);

        m_Checkbox = new vrWidgetToggleButton("GUIMenuSample.Checkbox", m_Menu, "Toggle Button", m_CheckboxCommand, true);

        m_Submenu = new vrWidgetMenu("GUIMenuSample.SubMenu", m_Menu, "Sub Menu");
        m_Submenu.SetVisible(true);

        m_Radio1 = new vrWidgetRadioButton("GUIMenuSample.Radio1", m_Submenu, "Huey", m_RadioCommand, "Huey");
        m_Radio2 = new vrWidgetRadioButton("GUIMenuSample.Radio2", m_Submenu, "Dewey", m_RadioCommand, "Dewey");
        m_Radio3 = new vrWidgetRadioButton("GUIMenuSample.Radio3", m_Submenu, "Louie", m_RadioCommand, "Louie");

        m_Picker = new vrWidgetColorPicker("GUIMenuSample.ColorPicker", m_Menu, "Color Picker", m_ColorPickerCommand, new vrVec4(0, 0, 0, 0));

        m_Slider = new vrWidgetSlider("GUIMenuSample.Slider", m_Menu, "Slider", m_SliderCommand, 50.0f, 0.0f, 100.0f, 1.0f);
        
        vrValue listContents = vrValue.CreateList();
        listContents.AddListItem( "Item 1" );
        listContents.AddListItem( "Item 2" );

        m_List = new vrWidgetList("GUIMenuSample.List", m_Menu, "List", m_ListCommand, listContents, 0);
    }
Exemplo n.º 13
0
    private void AddButton(VRMenu vrmenu)
    {
        // Add a button at the start of the menu
        m_MyItemCommand = new vrCommand("VRMenu.MyCustomButtonCommand", MyItemCommandHandler);

        vrWidgetButton button = new vrWidgetButton("VRMenu.MyCustomButton", vrmenu.menu, "My Menu Item", m_MyItemCommand);

        vrmenu.menu.SetChildIndex(button, 0);

        // Add a separator below it
        vrWidgetSeparator separator = new vrWidgetSeparator("VRMenu.MyCustomSeparator", vrmenu.menu);

        vrmenu.menu.SetChildIndex(separator, 1);
    }
Exemplo n.º 14
0
    // Use this for initialization
    void Start()
    {
        m_cmdLoadFirstData = new vrCommand("RainPlotCmdLoadFirstData", cmdLoadFirstData);
        m_cmdAutoPopulate  = new vrCommand("RainPlotCmdAutoPopulate", cmdAutoPopulate);
        m_cmdUpdatePlot    = new vrCommand("RainPlotCmdUpdate", cmdUpdatePlot);

        listData     = new List <Dictionary <string, object> >();
        listRealTime = new List <Dictionary <string, object> >();
        if (MiddleVR.VRClusterMgr.IsServer() || (!MiddleVR.VRClusterMgr.IsCluster()))
        {
            vrValue iVal;
            iVal = new vrValue(WebApiCall.CallWeb(URL));
            m_cmdLoadFirstData.Do(iVal);
        }
        autoPopulate();
        InvokeRepeating("updatePlot", UpdateRate, UpdateRate);
    }
Exemplo n.º 15
0
    public override void OnStartClient()
    {
        if (vrClusterManager.GetInstance().IsClient() || !m_EnableVoiceChat)
        {
            return;
        }

        if (!isServer)
        {
            m_NetworkManager = FindObjectOfType <NetworkManager>();
            m_RTCServerURL   = "https://" + m_NetworkManager.networkAddress + ":" + (m_NetworkManager.networkPort + 1).ToString();
        }

        m_RTCConnectionReadyCommand = new vrCommand("RTCConnectionReady", RTCConnectionReadyCommandHandler, null, (uint)VRCommandFlags.VRCommandFlag_DontSynchronizeCluster);

        StartCoroutine(CreateWebView());
    }
Exemplo n.º 16
0
        public void Start()
        {
            _nodeToMove = GameObject.Find("Player (Player)");

#if MVR
            _moveCommand = new vrCommand("", MoveHandler);
            _jumpCommand = new vrCommand("", JumpHandler);
#endif

            if (StartHere)
            {
                Jump();
            }

            // Workaround to null exceptions when there is no subscriber to the event
            OnFinish += delegate { return; };
            OnStart  += delegate(float duration) { return; };
            OnFinish += delegate { return; };
        }
Exemplo n.º 17
0
 private void Awake()
 {
     ResetRotationCommand = new vrCommand("Reset Rotation Command", ResetRotation);
 }
Exemplo n.º 18
0
    // Update is called once per frame
    protected void Update()
    {
        // Initialize interactions
        if (!m_InteractionsInitialized)
        {
            _SetNavigation(Navigation);
            _SetManipulation(Manipulation);
            _SetVirtualHandMapping(VirtualHandMapping);

            m_InteractionsInitialized = true;
        }

        MVRNodesMapper nodesMapper = MVRNodesMapper.Instance;

        nodesMapper.UpdateNodesUnityToMiddleVR();

        if (m_isInit)
        {
            MVRTools.Log(4, "[>] Unity Update - Start");

            if (m_Kernel.GetFrame() >= m_FirstFrameAfterReset + 1 && !m_isGeometrySet && !Application.isEditor)
            {
                if (!DontChangeWindowGeometry)
                {
                    m_DisplayMgr.SetUnityWindowGeometry();
                }
                m_isGeometrySet = true;
            }

            // Set the random seed in kernel for dispatching only during start-up.
            if (m_Kernel.GetFrame() == 0)
            {
                // Disable obsolescence warning for Random.seed as we only use it to initalize
                // the MiddleVR random seed.
                // Using Random.seed was deprecated because it is a single integer and does not
                // contain the full state of the random number generator and thus could not be
                // used for restoring or synchronizing the state.
#pragma warning disable 618
                // The cast is safe because the seed is always positive.
                m_Kernel._SetRandomSeed((uint)UnityEngine.Random.seed);
#pragma warning restore 618

                // With clustering, a client will be set by a call to kernel.Update().
                if (m_ClusterMgr.IsCluster())
                {
                    if (m_shareRandomStateCommand == null)
                    {
                        m_shareRandomStateCommand = new vrCommand("MVR_ShareRandomState", (vrValue val) =>
                        {
                            UnityEngine.Random.state = JsonUtility.FromJson <UnityEngine.Random.State>(val.GetString());
                            return(new vrValue());
                        });
                    }

                    if (m_ClusterMgr.IsServer())
                    {
                        m_shareRandomStateCommand.Do(new vrValue(JsonUtility.ToJson(UnityEngine.Random.state)));
                    }
                }
            }

            m_Kernel.Update();

            UpdateInput();

            if (ShowFPS)
            {
                m_FPSText.text = m_Kernel.GetFPS().ToString("f2");
            }

            nodesMapper.UpdateNodesMiddleVRToUnity(false);

            MVRTools.UpdateCameraProperties(m_Kernel, m_DisplayMgr, nodesMapper);

            vrKeyboard keyb = m_DeviceMgr.GetKeyboard();

            if (keyb != null)
            {
                if (keyb.IsKeyPressed(MiddleVR.VRK_LSHIFT) || keyb.IsKeyPressed(MiddleVR.VRK_RSHIFT))
                {
                    if (keyb.IsKeyToggled(MiddleVR.VRK_D))
                    {
                        ShowFPS = !ShowFPS;
                    }

                    if (keyb.IsKeyToggled(MiddleVR.VRK_W) || keyb.IsKeyToggled(MiddleVR.VRK_Z))
                    {
                        ShowWand = !ShowWand;
                        ShowWandGeometry(ShowWand);
                    }

                    // Toggle Fly mode on interactions
                    if (keyb.IsKeyToggled(MiddleVR.VRK_F))
                    {
                        Fly = !Fly;
                    }

                    // Navigation mode switch
                    if (keyb.IsKeyToggled(MiddleVR.VRK_N))
                    {
                        vrInteraction navigation = _GetNextInteraction("ContinuousNavigation");
                        if (navigation != null)
                        {
                            MiddleVR.VRInteractionMgr.Activate(navigation);
                        }
                    }
                }
            }

            DeltaTime = m_Kernel.GetDeltaTime();

            MVRTools.Log(4, "[<] Unity Update - End");
        }
        else
        {
            //Debug.LogWarning("[ ] If you have an error mentioning 'DLLNotFoundException: MiddleVR_CSharp', please restart Unity. If this does not fix the problem, please make sure MiddleVR is in the PATH environment variable.");
        }
    }
 protected void Start()
 {
     m_ButtonCommand = new vrCommand("ButtonCommand", ButtonHandler);
     m_RadioCommand  = new vrCommand("RadioCommand", RadioHandler);
     m_SliderCommand = new vrCommand("SliderCommand", SliderHandler);
 }
Exemplo n.º 20
0
 void OnDestroy()
 {
     if (m_startParticlesCommand != null)
     {
         m_startParticlesCommand.Dispose();
         m_startParticlesCommand = null;
     }
 }
Exemplo n.º 21
0
    void Start()
    {
        gameManager = GameObject.Find("GameManager").GetComponent <Modelisation.GameManager>();
        menuManager = GameObject.Find("Utilisateur").GetComponent <MenuManager>();

        // Retrieve the VRManager
        VRManagerScript[] foundVRManager = FindObjectsOfType(typeof(VRManagerScript)) as VRManagerScript[];
        if (foundVRManager.Length != 0)
        {
            m_VRManager = foundVRManager[0];
        }
        else
        {
            MVRTools.Log("[X] VRMenu: impossible to retrieve the VRManager.");
            return;
        }

        // Start listening to MiddleVR events
        m_Listener = new vrEventListener(EventListener);
        MiddleVR.VRKernel.AddEventListener(m_Listener);

        // Create commands

        // General
        m_ResetButtonCommand = new vrCommand("VRMenu.ResetButtonCommand", ResetButtonHandler);
        m_ExitButtonCommand  = new vrCommand("VRMenu.ExitButtonCommand", ExitButtonHandler);

        // Mode
        modeAssisteCommand = new vrCommand("VRMenu.modeAssisteCommand", ModeAssisteHandler);
        modeLibreCommand   = new vrCommand("VRMenu.modeLibreCommand", ModeLibreHandler);

        // Scenario
        scenarioAppelCommand     = new vrCommand("VRMenu.ScenarioAppelCommand", ScenarioAppelHandler);
        scenarioInfirmierCommand = new vrCommand("VRMenu.ScenarioInfirmierCommand", ScenarioInfirmierHandler);
        scenarioInconnuCommand   = new vrCommand("VRMenu.ScenarioInconnuCommand", ScenarioInconnuHandler);

        // Create GUI
        m_GUIRendererWeb = null;

        VRWebView webViewScript = GetComponent <VRWebView>();

        if (webViewScript == null)
        {
            MVRTools.Log(1, "[X] VRMenu does not have a WebView.");
            return;
        }

        m_GUIRendererWeb = new vrGUIRendererWeb("", webViewScript.webView);

        m_Menu = new vrWidgetMenu("VRMenu.VRManagerMenu", m_GUIRendererWeb);

        // Mode
        menuChoixMode = new vrWidgetMenu("VRMenu.ChoixMode", m_Menu, "Modes");

        modeAssiste = new vrWidgetButton("VRMenu.ModeAssisteButton", menuChoixMode, "Passer en mode assisté", modeAssisteCommand);
        modeLibre   = new vrWidgetButton("VRMenu.ModeLibreButton", menuChoixMode, "Passer en mode libre", modeLibreCommand);

        // Scénario
        menuChoixScenar = new vrWidgetMenu("VRMenu.ChoixScenario", m_Menu, "Scenarios");

        scenarAppel     = new vrWidgetButton("VRMenu.ScenarAppelButton", menuChoixScenar, "Appel téléphonique", scenarioAppelCommand);
        scenarInfirmier = new vrWidgetButton("VRMenu.ScenarInfirmierButton", menuChoixScenar, "Infirmier à l'entrée", scenarioInfirmierCommand);
        scenarInconnu   = new vrWidgetButton("VRMenu.ScenarInconnuButton", menuChoixScenar, "Inconnu à l'entrée", scenarioInconnuCommand);

        // Reset and Exit
        m_ResetButton = new vrWidgetButton("VRMenu.ResetCurrentButton", m_Menu, "Reload simulation", m_ResetButtonCommand);

        m_ExitButton = new vrWidgetButton("VRMenu.ExitButton", m_Menu, "Exit simulation", m_ExitButtonCommand);
    }
Exemplo n.º 22
0
    private void _SetParticlesSeeds()
    {
        if (MiddleVR.VRClusterMgr.IsCluster())
        {
            // Creating the list of randomSeed / is playOnAwake to sync the seeds
            // of each particle systems to the master
            vrValue particlesDataList = vrValue.CreateList();

            foreach (ParticleSystem particle in GameObject.FindObjectsOfType(typeof(ParticleSystem)) as ParticleSystem[])
            {
                if (MiddleVR.VRClusterMgr.IsServer())
                {
                    vrValue particleData = vrValue.CreateList();

                    particleData.AddListItem((int)particle.randomSeed);
                    particleData.AddListItem(particle.playOnAwake);

                    particlesDataList.AddListItem(particleData);
                }
                // We reset the particle systems to sync them in every nodes of the cluster
                particle.Clear();
                particle.Stop();
                particle.time = .0f;
            }

            m_startParticlesCommand = new vrCommand("startParticleCommand", StartParticlesCommandHandler);

            if (MiddleVR.VRClusterMgr.IsServer())
            {
                m_startParticlesCommand.Do(particlesDataList);
            }
        }

    }
Exemplo n.º 23
0
    protected void Start()
    {
        // Retrieve the VRManager
        VRManagerScript[] foundVRManager = FindObjectsOfType(typeof(VRManagerScript)) as VRManagerScript[];
        if (foundVRManager.Length != 0)
        {
            m_VRManager = foundVRManager[0];
        }
        else
        {
            MVRTools.Log("[X] VRMenu: impossible to retrieve the VRManager.");
            return;
        }

        // Start listening to MiddleVR events
        m_Listener = new vrEventListener(EventListener);
        MiddleVR.VRInteractionMgr.AddEventListener(m_Listener);

        // Create commands

        // General
        m_ResetCurrentButtonCommand   = new vrCommand("VRMenu.ResetCurrentButtonCommand", ResetCurrentButtonHandler);
        m_ResetZeroButtonCommand      = new vrCommand("VRMenu.ResetZeroButtonCommand", ResetZeroButtonHandler);
        m_ExitButtonCommand           = new vrCommand("VRMenu.ExitButtonCommand", ExitButtonHandler);
        m_FramerateCheckboxCommand    = new vrCommand("VRMenu.FramerateCheckboxCommand", FramerateCheckboxHandler);
        m_ProxiWarningCheckboxCommand = new vrCommand("VRMenu.ProxiWarningCheckboxCommand", ProxiWarningCheckboxHandler);

        // Navigation
        m_FlyCheckboxCommand          = new vrCommand("VRMenu.FlyCheckboxCommand", FlyCheckboxHandler);
        m_CollisionsCheckboxCommand   = new vrCommand("VRMenu.CollisionsCheckboxCommand", CollisionsCheckboxHandler);

        // Manipulation
        m_ReturnObjectsCheckboxCommand = new vrCommand("VRMenu.ReturnObjectsCheckboxCommand", ReturnObjectsCheckboxHandler);

        // Create GUI
        m_GUIRendererWeb = null;

        VRWebView webViewScript = GetComponent<VRWebView>();

        if (webViewScript == null)
        {
            MVRTools.Log(1, "[X] VRMenu does not have a WebView.");
            return;
        }

        m_GUIRendererWeb = new vrGUIRendererWeb("", webViewScript.webView);

        m_Menu = new vrWidgetMenu("VRMenu.VRManagerMenu", m_GUIRendererWeb);

        // Navigation
        m_NavigationOptions = new vrWidgetMenu("VRMenu.NavigationOptions", m_Menu, "Navigation");

        CreateInteractionToggleButton(MiddleVR.VRInteractionMgr.GetInteraction("InteractionNavigationWandJoystick"), "Joystick", m_NavigationOptions, NavigationJoystickHandler);
        CreateInteractionToggleButton(MiddleVR.VRInteractionMgr.GetInteraction("InteractionNavigationElastic"), "Elastic", m_NavigationOptions, NavigationElasticHandler);
        CreateInteractionToggleButton(MiddleVR.VRInteractionMgr.GetInteraction("InteractionNavigationGrabWorld"), "Grab The World", m_NavigationOptions, NavigationGrabWorldHandler);

        m_NavigationSeparator = new vrWidgetSeparator("VRMenu.NavigationSeparator", m_NavigationOptions);
        m_FlyCheckbox         = new vrWidgetToggleButton("VRMenu.FlyCheckbox", m_NavigationOptions, "Fly", m_FlyCheckboxCommand, m_VRManager.Fly);
        m_CollisionsCheckbox  = new vrWidgetToggleButton("VRMenu.CollisionsCheckbox", m_NavigationOptions, "Navigation Collisions", m_CollisionsCheckboxCommand, m_VRManager.NavigationCollisions);

        // Manipulation
        m_ManipulationOptions = new vrWidgetMenu("VRMenu.ManipulationOptions", m_Menu, "Manipulation");

        CreateInteractionToggleButton(MiddleVR.VRInteractionMgr.GetInteraction("InteractionManipulationRay"), "Ray", m_ManipulationOptions, ManipulationRayHandler);
        CreateInteractionToggleButton(MiddleVR.VRInteractionMgr.GetInteraction("InteractionManipulationHomer"), "Homer", m_ManipulationOptions, ManipulationHomerHandler);

        m_ManipulationSeparator = new vrWidgetSeparator("VRMenu.ManipulationSeparator", m_ManipulationOptions);
        m_ReturnObjectsCheckbox = new vrWidgetToggleButton("VRMenu.ReturnObjectsCheckbox", m_ManipulationOptions, "Return Objects", m_ReturnObjectsCheckboxCommand, m_VRManager.ManipulationReturnObjects);

        // Virtual Hand
        m_VirtualHandOptions = new vrWidgetMenu("VRMenu.VirtualHandOptions", m_Menu, "Virtual Hand");

        CreateInteractionToggleButton(MiddleVR.VRInteractionMgr.GetInteraction("InteractionVirtualHandGogo"), "Gogo", m_VirtualHandOptions, VirtualHandGogoButtonHandler);

        // General
        m_GeneralSeparator = new vrWidgetSeparator("VRMenu.GeneralSeparator", m_Menu);
        m_GeneralOptions   = new vrWidgetMenu("VRMenu.GeneralOptions", m_Menu, "General Options");

        m_FramerateCheckbox    = new vrWidgetToggleButton("VRMenu.FramerateCheckbox", m_GeneralOptions, "Show Frame Rate", m_FramerateCheckboxCommand, m_VRManager.ShowFPS);
        m_ProxiWarningCheckbox = new vrWidgetToggleButton("VRMenu.ProxiWarningCheckbox", m_GeneralOptions, "Show Proximity Warning", m_ProxiWarningCheckboxCommand, m_VRManager.ShowScreenProximityWarnings);

        // Reset and Exit
        m_ResetButtonMenu    = new vrWidgetMenu("VRMenu.ResetButtonMenu", m_Menu, "Reset Simulation");
        m_ResetCurrentButton = new vrWidgetButton("VRMenu.ResetCurrentButton", m_ResetButtonMenu, "Reload current level", m_ResetCurrentButtonCommand);
        m_ResetZeroButton    = new vrWidgetButton("VRMenu.ResetZeroButton", m_ResetButtonMenu, "Reload level zero", m_ResetZeroButtonCommand);

        m_ExitButtonMenu = new vrWidgetMenu("VRMenu.ExitButtonMenu", m_Menu, "Exit Simulation");
        m_ExitButton     = new vrWidgetButton("VRMenu.ExitButton", m_ExitButtonMenu, "Yes, Exit Simulation", m_ExitButtonCommand);
    }
Exemplo n.º 24
0
    protected void Start()
    {
        // Retrieve the VRManager
        VRManagerScript[] foundVRManager = FindObjectsOfType(typeof(VRManagerScript)) as VRManagerScript[];
        if (foundVRManager.Length != 0)
        {
            m_VRManager = foundVRManager[0];
        }
        else
        {
            MVRTools.Log("[X] VRMenu: impossible to retrieve the VRManager.");
            return;
        }

        // Start listening to MiddleVR events
        m_Listener = new vrEventListener(EventListener);
        MiddleVR.VRInteractionMgr.AddEventListener(m_Listener);

        // Create commands

        // General
        m_ResetCurrentButtonCommand   = new vrCommand("VRMenu.ResetCurrentButtonCommand", ResetCurrentButtonHandler);
        m_ResetZeroButtonCommand      = new vrCommand("VRMenu.ResetZeroButtonCommand", ResetZeroButtonHandler);
        m_ExitButtonCommand           = new vrCommand("VRMenu.ExitButtonCommand", ExitButtonHandler);
        m_FramerateCheckboxCommand    = new vrCommand("VRMenu.FramerateCheckboxCommand", FramerateCheckboxHandler);
        m_ProxiWarningCheckboxCommand = new vrCommand("VRMenu.ProxiWarningCheckboxCommand", ProxiWarningCheckboxHandler);

        // Navigation
        m_FlyCheckboxCommand        = new vrCommand("VRMenu.FlyCheckboxCommand", FlyCheckboxHandler);
        m_CollisionsCheckboxCommand = new vrCommand("VRMenu.CollisionsCheckboxCommand", CollisionsCheckboxHandler);

        // Manipulation
        m_ReturnObjectsCheckboxCommand = new vrCommand("VRMenu.ReturnObjectsCheckboxCommand", ReturnObjectsCheckboxHandler);

        // Create GUI
        m_GUIRendererWeb = null;

        VRWebView webViewScript = GetComponent <VRWebView>();

        if (webViewScript == null)
        {
            MVRTools.Log(1, "[X] VRMenu does not have a WebView.");
            return;
        }

        m_GUIRendererWeb = new vrGUIRendererWeb("", webViewScript.webView);

        m_Menu = new vrWidgetMenu("VRMenu.VRManagerMenu", m_GUIRendererWeb);

        // Navigation
        m_NavigationOptions = new vrWidgetMenu("VRMenu.NavigationOptions", m_Menu, "Navigation");

        CreateInteractionToggleButton(MiddleVR.VRInteractionMgr.GetInteraction("InteractionNavigationWandJoystick"), "Joystick", m_NavigationOptions, NavigationJoystickHandler);
        CreateInteractionToggleButton(MiddleVR.VRInteractionMgr.GetInteraction("InteractionNavigationElastic"), "Elastic", m_NavigationOptions, NavigationElasticHandler);
        CreateInteractionToggleButton(MiddleVR.VRInteractionMgr.GetInteraction("InteractionNavigationGrabWorld"), "Grab The World", m_NavigationOptions, NavigationGrabWorldHandler);

        m_NavigationSeparator = new vrWidgetSeparator("VRMenu.NavigationSeparator", m_NavigationOptions);
        m_FlyCheckbox         = new vrWidgetToggleButton("VRMenu.FlyCheckbox", m_NavigationOptions, "Fly", m_FlyCheckboxCommand, m_VRManager.Fly);
        m_CollisionsCheckbox  = new vrWidgetToggleButton("VRMenu.CollisionsCheckbox", m_NavigationOptions, "Navigation Collisions", m_CollisionsCheckboxCommand, m_VRManager.NavigationCollisions);

        // Manipulation
        m_ManipulationOptions = new vrWidgetMenu("VRMenu.ManipulationOptions", m_Menu, "Manipulation");

        CreateInteractionToggleButton(MiddleVR.VRInteractionMgr.GetInteraction("InteractionManipulationRay"), "Ray", m_ManipulationOptions, ManipulationRayHandler);
        CreateInteractionToggleButton(MiddleVR.VRInteractionMgr.GetInteraction("InteractionManipulationHomer"), "Homer", m_ManipulationOptions, ManipulationHomerHandler);

        m_ManipulationSeparator = new vrWidgetSeparator("VRMenu.ManipulationSeparator", m_ManipulationOptions);
        m_ReturnObjectsCheckbox = new vrWidgetToggleButton("VRMenu.ReturnObjectsCheckbox", m_ManipulationOptions, "Return Objects", m_ReturnObjectsCheckboxCommand, m_VRManager.ManipulationReturnObjects);

        // Virtual Hand
        m_VirtualHandOptions = new vrWidgetMenu("VRMenu.VirtualHandOptions", m_Menu, "Virtual Hand");

        CreateInteractionToggleButton(MiddleVR.VRInteractionMgr.GetInteraction("InteractionVirtualHandGogo"), "Gogo", m_VirtualHandOptions, VirtualHandGogoButtonHandler);

        // General
        m_GeneralSeparator = new vrWidgetSeparator("VRMenu.GeneralSeparator", m_Menu);
        m_GeneralOptions   = new vrWidgetMenu("VRMenu.GeneralOptions", m_Menu, "General Options");

        m_FramerateCheckbox    = new vrWidgetToggleButton("VRMenu.FramerateCheckbox", m_GeneralOptions, "Show Frame Rate", m_FramerateCheckboxCommand, m_VRManager.ShowFPS);
        m_ProxiWarningCheckbox = new vrWidgetToggleButton("VRMenu.ProxiWarningCheckbox", m_GeneralOptions, "Show Proximity Warning", m_ProxiWarningCheckboxCommand, m_VRManager.ShowScreenProximityWarnings);

        // Reset and Exit
        m_ResetButtonMenu    = new vrWidgetMenu("VRMenu.ResetButtonMenu", m_Menu, "Reset Simulation");
        m_ResetCurrentButton = new vrWidgetButton("VRMenu.ResetCurrentButton", m_ResetButtonMenu, "Reload current level", m_ResetCurrentButtonCommand);
        m_ResetZeroButton    = new vrWidgetButton("VRMenu.ResetZeroButton", m_ResetButtonMenu, "Reload level zero", m_ResetZeroButtonCommand);

        m_ExitButtonMenu = new vrWidgetMenu("VRMenu.ExitButtonMenu", m_Menu, "Exit Simulation");
        m_ExitButton     = new vrWidgetButton("VRMenu.ExitButton", m_ExitButtonMenu, "Yes, Exit Simulation", m_ExitButtonCommand);
    }
Exemplo n.º 25
0
 private void Start()
 {
     m_ButtonCommand = new vrCommand("ButtonCommand", ButtonHandler);
     m_RadioCommand = new vrCommand("RadioCommand", RadioHandler);
     m_SliderCommand = new vrCommand("SliderCommand", SliderHandler);
 }
 protected void Start()
 {
     m_Command = new vrCommand(m_Name, _CommandHandler);
 }
Exemplo n.º 27
0
 protected void Start()
 {
     _enabledCommand = new vrCommand("", EnabledCommandHandler);
     _opacityChangedCommand = new vrCommand("", OpacityChangedCommandHandler);
 }
Exemplo n.º 28
0
 private void Awake()
 {
     ResetRotationCommand = new vrCommand("Reset Rotation Command", ResetRotation);
 }
Exemplo n.º 29
0
 public SphereSource()
 {
     SetRadiusCommand = new vrCommand("Set Radius Command - ", SetRadius);
 }
Exemplo n.º 30
0
 private void Start()
 {
     m_Command = new vrCommand(m_Name, _CommandHandler);
 }
Exemplo n.º 31
0
    public void CreateInteractionToggleButton(vrInteraction iInteraction, string iButtonName, vrWidgetMenu iParentMenu, vrCommand.Delegate iButtonHandler)
    {
        string itName = iInteraction.GetName();

        vrCommand newCommand = new vrCommand("VRMenu." + itName + "ToggleCommand", iButtonHandler);
        m_Commands.Add(itName, newCommand);

        vrWidgetToggleButton button = new vrWidgetToggleButton("VRMenu." + itName + "ToggleButton", iParentMenu, iButtonName, newCommand, iInteraction.IsActive());
        m_Buttons.Add(itName, button);
    }
Exemplo n.º 32
0
 protected void Start()
 {
     _activeChildCommand = new vrCommand("", ActiveChildCommandHandler);
 }
Exemplo n.º 33
0
 private void Start()
 {
     m_MyCommand = new vrCommand("MyCommand", CommandHandler);
 }
Exemplo n.º 34
0
 private void Start()
 {
     m_Command = new vrCommand(m_Name, _CommandHandler);
 }
Exemplo n.º 35
0
 protected void Start()
 {
     m_MyCommand = new vrCommand("MyCommand", CommandHandler);
 }
Exemplo n.º 36
0
    protected void Start ()
    {
        MVRTools.Log(4, "[>] VR Manager Start.");

        m_Kernel.DeleteLateObjects();

        // Reset Manager's position so text display is correct.
        transform.position = new UnityEngine.Vector3(0, 0, 0);
        transform.rotation = new Quaternion();
        transform.localScale = new UnityEngine.Vector3(1, 1, 1);

        m_Wand = GameObject.Find("VRWand");

        m_VRMenu = GameObject.Find("VRMenu");

        ShowWandGeometry(ShowWand);

        _EnableProximityWarning(m_ShowScreenProximityWarnings);

        _EnableFPSDisplay(m_ShowFPS);

        _EnableNavigationFly(m_Fly);

        _EnableNavigationCollision(m_NavigationCollisions);

        _EnableManipulationReturnObjects(m_ManipulationReturnObjects);

        _EnableVRMenu(m_UseVRMenu);

        if (ForceQuality)
        {
            QualitySettings.SetQualityLevel(ForceQualityIndex);
        }

        // Manage VSync after the quality settings
        MVRTools.ManageVSync();

        // Set AA from vrx configuration file
        QualitySettings.antiAliasing = m_AntiAliasingLevel;

        // Check if MiddleVR Reset is needed
        if (!Application.isEditor && (ForceQuality || QualitySettings.antiAliasing > 1))
        {
            var activeViewport0 = m_DisplayMgr.GetActiveViewport(0);
            var stereoMode = (VRStereoMode)activeViewport0.GetStereoMode();

            bool useOpenGLQuadbuffer =
                activeViewport0.GetStereo() &&
                stereoMode == VRStereoMode.VRStereoMode_QuadBuffer;

            if (useOpenGLQuadbuffer || m_ClusterMgr.GetForceOpenGLConversion())
            {
                m_NeedDelayedRenderingReset = true;
                m_RenderingResetDelay = 1;
            }
        }

        m_QuitCommand = new vrCommand("VRManager.QuitApplicationCommand", _QuitApplicationCommandHandler);

        MVRTools.Log(4, "[<] End of VR Manager Start.");
    }
Exemplo n.º 37
0
 protected void Start()
 {
     m_Command = new vrCommand(m_Name, _CommandHandler);
 }
Exemplo n.º 38
0
 void Start()
 {
     m_MyCommand = new vrCommand("MyCommand", CommandHandler);
     m_webView   = GetComponent <VRWebView>().webView;
 }
Exemplo n.º 39
0
 protected void Start()
 {
     _enabledCommand        = new vrCommand("", EnabledCommandHandler);
     _opacityChangedCommand = new vrCommand("", OpacityChangedCommandHandler);
 }
Exemplo n.º 40
0
 protected void Start()
 {
     _activeChildCommand = new vrCommand("", ActiveChildCommandHandler);
     _visibilityView     = Resources.FindObjectsOfTypeAll(typeof(VisibilityView))[0] as VisibilityView;
 }
Exemplo n.º 41
0
 protected void Start()
 {
     _activeChildCommand = new vrCommand("", ActiveChildCommandHandler);
 }
Exemplo n.º 42
0
 public void Start()
 {
     m_Command = new vrCommand(m_Name, _CommandHandler);
 }
 protected void Start()
 {
     m_MyCommand = new vrCommand("MyCommand", CommandHandler);
 }
Exemplo n.º 44
0
 private void Start()
 {
     m_MyCommand = new vrCommand("MyCommand", CommandHandler);
 }
Exemplo n.º 45
0
        public void Start()
        {
            _nodeToMove = GameObject.Find("Player (Player)");

            #if MVR
            _moveCommand = new vrCommand("", MoveHandler);
            _jumpCommand = new vrCommand("", JumpHandler);
            #endif

            if (StartHere)
                Jump();

            // Workaround to null exceptions when there is no subscriber to the event
            OnFinish += delegate { return; };
            OnStart += delegate (float duration) { return; };
            OnFinish += delegate { return; };
        }