Example #1
0
        /// <summary>
        /// Requests new state from current LeiaStateFactory, switches backlight,
        /// updates texture. UpdateLeiaState triggers StateChanged() actions.
        /// </summary>
        private void RequestLeiaStateUpdate()
        {
            if (!Application.isPlaying)
            {
                return;
            }
            if (_leiaState != null)
            {
                _leiaState.Release();
            }

            // set interlacing state based on LeiaStateId
            _leiaState = _stateFactory.GetState(LeiaStateId);

            // Set backlight state based on LeiaStateId
            if (_leiaDevice != null && _leiaDevice.GetBacklightMode() == 3 && !LeiaStateId.Equals(HPO))
            {
                _leiaDevice.SetBacklightMode(_leiaState.GetBacklightMode());
            }
            if (_leiaDevice != null && _leiaDevice.GetBacklightMode() != 3 && LeiaStateId.Equals(HPO))
            {
                _leiaDevice.SetBacklightMode(_leiaState.GetBacklightMode());
            }

            if (_leiaDevice.GetBacklightMode() == 3)
            {
                latest3DFrame = Time.frameCount;
            }

            // private member RequestLeiaStateUpdate() calls public member UpdateLeiaState
            // UpdateLeiaState is called by LeiaConfigSettingsUI
            UpdateLeiaState();
        }
Example #2
0
        private void OnResume()
        {
            if (_leiaDevice != null && _leiaDevice.GetBacklightMode() == 3)
            {
                // on resume, if the LeiaLights DisplaySDK state machine thinks this app was in 3D mode on last frame
                // then _getBacklightMode should be 3. Store in the latest3DFrame flag.
                // In BacklightModeChanged we will discard BacklightModeChanged(2D) callbacks which occur recently after
                // OnResume {GetBacklightMode == 3}
                latest3DFrame = Time.frameCount;
            }

            // on return to app, if desired state is HPO and forced state is not HPO,
            // we are allowed to return to HPO
            if (DesiredLeiaStateID.Equals(HPO) && !LeiaStateId.Equals(HPO))
            {
                DesiredLeiaStateID = HPO;
            }
            else
            {
                _isDirty = true;
            }
        }