public void AirVRClientConnected()
 {
     _room.SetActive(false);
     IsConnecting = false;
     AirVRClientUIManager.Instance.Hide();
     AirVRClient.Play();
 }
 private void OnApplicationPause(bool pauseStatus)
 {
     if (pauseStatus && AirVRClient.playing)
     {
         AirVRClient.Stop();
     }
     else if (pauseStatus == false && AirVRClient.connected)
     {
         AirVRClient.Play();
     }
 }
 private void Update()
 {
     if (OVRInput.GetDown(OVRInput.Button.Back) || Input.GetKeyDown(KeyCode.Escape))
     {
         if (AirVRClient.connected)
         {
             AirVRClient.Disconnect();
         }
         else
         {
             AirVRClient.Connect(_serverAddress, _serverPort, (_userID++).ToString());
         }
     }
 }
예제 #4
0
 private void Update()
 {
     if (GvrControllerInput.AppButtonDown)
     {
         if (AirVRClient.connected)
         {
             AirVRClient.Disconnect();
         }
         else
         {
             AirVRClient.Connect(_address, _port, _userID);
         }
     }
 }
    private void Awake()
    {
        if (_instance != null)
        {
            throw new UnityException("[ERROR] There must exist only one instance of AirVRClient.");
        }
        _instance = this;
        GameObject.DontDestroyOnLoad(gameObject);

        if (_eventDispatcher == null)
        {
            _eventDispatcher = new AirVRClientEventDispatcher();
            _eventDispatcher.MessageReceived += onAirVRMessageReceived;
        }
    }
    public void Connect(string addressText, string portText, string userIDText)
    {
        string message;

        if (!AirVRClientAppConfig.ValidateIPv4(addressText))
        {
            message = "Please enter the correct ip address.";

            Notification.DisplayError(message);
            Debug.Log(message);
            return;
        }

        if (!AirVRClientAppConfig.ValidatePort(portText))
        {
            message = "Please enter the correct port.";

            Notification.DisplayError(message);
            Debug.Log(message);
            return;
        }

        if (!AirVRClientAppConfig.ValidateUserID(userIDText))
        {
            message = "Please enter the correct User ID.";

            Notification.DisplayError(message);
            Debug.Log(message);
            return;
        }

        string address = addressText;
        int    port    = int.Parse(portText);
        int    userID  = int.Parse(userIDText);

        Config.Save(address, port, userID, AirVRClientUIManager.Instance.SettingPanel.AutoPlay.Toggle.isOn, Config.FirstPlay);
        AirVRClientUIManager.Instance.CanvasGroup.blocksRaycasts = false;
        AirVRClientUIManager.Instance.CanvasGroup.interactable   = false;

        AirVRClientUIManager.Instance.SettingPanel.PlayButton.enabled = false;

        IsConnecting = true;
        Notification.DisplayConnecting();

        #if UNITY_ANDROID && !UNITY_EDITOR
        AirVRClient.Connect(address, port, userID.ToString());
        #endif
    }
예제 #7
0
    protected virtual void Start()
    {
        defaultTrackedControllerModel = Resources.Load <GameObject>("trackedControllerModel");

        _renderCommand = RenderCommand.Create(profile, _camera);

        AirVRClient.LoadOnce(profile, this);
        AirVRInputManager.LoadOnce();

        AirVRClient.MessageReceived += onAirVRMesageReceived;
        AirVRInputManager.RegisterInputDevice(_headTracker);

        StartCoroutine(CallEndOfFrame());

        saveCameraClipPlanes(); // workaround for the very first disconnected event
    }
 public void AirVRClientConnected()
 {
     AirVRClient.Play();
 }