////////////////////////////////////////////////////////////////////////
        // Private Methods
        ////////////////////////////////////////////////////////////////////////

        private void UpdateScreenMetrics()
        {
            // If the display reference profile is not custom, lock
            // the display reference size to the appropriate value.
            if (this._displayReferenceProfile != ZDisplay.Profile.Custom)
            {
                this._displayReferenceSize = ZDisplay.GetSize(
                    this._displayReferenceProfile);

                this._displayReferenceResolution = ZDisplay.GetNativeResolution(
                    this._displayReferenceProfile);
            }

            this._displayReferenceSize = Vector2.Max(
                ZDisplay.MinimumSize, this._displayReferenceSize);

            this._displayReferenceResolution = Vector2Int.Max(
                Vector2Int.one, this._displayReferenceResolution);

            // Update current display information.
            DisplayReferenceSize       = this._displayReferenceSize;
            DisplayReferenceResolution = this._displayReferenceResolution;
            DisplaySize       = CurrentDisplay?.Size ?? this._displayReferenceSize;
            DisplayResolution = CurrentDisplay?.NativeResolution ??
                                this._displayReferenceResolution;

            DisplayMetersPerPixel = new Vector2(
                DisplaySize.x / DisplayResolution.x,
                DisplaySize.y / DisplayResolution.y);

            DisplayScale       = ZDisplay.GetScale(DisplayReferenceSize, DisplaySize);
            DisplayScaleFactor = Mathf.Min(DisplayScale.x, DisplayScale.y);

            // Update current window information.
            if (IsInitialized)
            {
                WindowSizePixels = ZApplicationWindow.Size;
                WindowSize       = WindowSizePixels * DisplayMetersPerPixel;
            }
            else
            {
                WindowSizePixels = DisplayResolution;
                WindowSize       = DisplaySize;
            }
        }
示例#2
0
        ////////////////////////////////////////////////////////////////////////
        // MonoBehaviour Callbacks
        ////////////////////////////////////////////////////////////////////////

        private void Start()
        {
            if (ZProvider.IsInitialized)
            {
                this._stylusTarget = ZProvider.StylusTarget;

                if (ZProvider.CurrentDisplay.Size !=
                    ZDisplay.GetSize(ZDisplay.Profile.Size24InchAspect16x9))
                {
                    Debug.LogWarning("AIO model hardware not detected.\n " +
                                     "Stylus vibration and LED light feedback will not " +
                                     "be experienced.");
                }
            }
            else
            {
                Debug.LogWarning("ZProvider can not initialize.\n Stylus" +
                                 "LED light feedback will not be experienced.");

                Destroy(this);
            }
        }