Exemplo n.º 1
0
 // At a regular interval, query the click and hover states, as well as the no touch state, passing respective method delegates.
 private void Update()
 {
     if (_connected)
     {
         _timer += Time.deltaTime;
         if (_timer > _queryInterval)
         {
             TouchlessDesign.QueryClickAndHoverState(HandleQueryResponse);
             TouchlessDesign.QueryNoTouchState(HandleNoTouchState);
             _timer = 0f;
         }
     }
 }
Exemplo n.º 2
0
    // Sets the screen to whatever is specified in the settings file. Initialize the TouchlessDesign and path directory to Service and subscribe to OnConnect and OnDisconnect events.
    void Awake()
    {
        int screen = 0;

        try {
            var path = Path.Combine(Application.streamingAssetsPath, "settings.json");
            if (File.Exists(path))
            {
                var json = File.ReadAllText(path);
                var obj  = JObject.Parse(json);
                if (int.TryParse(obj["ScreenNumber"].ToString(), out screen))
                {
                    Log.Info("Screen set to " + screen);
                }
            }
        }
        catch (Exception e) {
            Log.Error(e);
        }

#if !UNITY_EDITOR
        if (Display.displays.Length > 1)
        {
            PlayerPrefs.SetInt("UnitySelectMonitor", screen);

            var display = Display.displays[screen];
            int w       = display.systemWidth;
            int h       = display.systemHeight;
            Screen.SetResolution(w, h, true);
        }
        else
        {
            Application.Quit();
        }
#endif
        TouchlessDesign.Initialize(AppSettings.Get().DataDirectory.GetPath());
        TouchlessDesign.Connected    += OnConnected;
        TouchlessDesign.Disconnected += OnDisconnected;
    }
Exemplo n.º 3
0
 // Query addon information once a connection is made with the Intergrated Touchless System.
 private void OnConnected()
 {
     Log.Info("Connected. Starting to query...");
     _connected = true;
     TouchlessDesign.QueryAddOn(HandleAddOnQuery);
 }
Exemplo n.º 4
0
 // Deinitialize TouchlessDesign
 void OnApplicationQuit()
 {
     TouchlessDesign.DeInitialize();
 }