示例#1
0
        bool updateCortexStates()
        {
            if (!_enableChecking)
            {
                return(_enableChecking);
            }

            _timerCortex_state += Time.deltaTime;
            if (_timerCortex_state < TIME_UPDATE_CORTEX_STATE)
            {
                return(_enableChecking);
            }

            _timerCortex_state -= TIME_UPDATE_CORTEX_STATE;
            var curState = DataStreamManager.Instance.GetConnectToCortexState();

            if (_lastState == curState)
            {
                return(_enableChecking);
            }

            _lastState = curState;
            switch (curState)
            {
            case ConnectToCortexStates.Service_connecting:
            case ConnectToCortexStates.EmotivApp_NotFound:
            case ConnectToCortexStates.Login_waiting:
            case ConnectToCortexStates.Login_notYet:
            case ConnectToCortexStates.Authorizing:
            case ConnectToCortexStates.Authorize_failed:
            case ConnectToCortexStates.LicenseExpried:
            case ConnectToCortexStates.License_HardLimited: {
                _enableChecking = false;
                _connectionIndicatorGroup.Deactivate();
                _connectingToCortex.Activate();

                break;
            }

            case ConnectToCortexStates.Authorized:
                break;
            }

            return(_enableChecking);
        }
        void Update()
        {
            if (_isChecked || !this.isActive)
            {
                return;
            }

            _timerCortex_state += Time.deltaTime;
            if (_timerCortex_state < TIME_UPDATE_CORTEX_STATE)
            {
                return;
            }

            _timerCortex_state -= TIME_UPDATE_CORTEX_STATE;

            var curState = DataStreamManager.Instance.GetConnectToCortexState();

            switch (curState)
            {
            case ConnectToCortexStates.Service_connecting:
            case ConnectToCortexStates.EmotivApp_NotFound:
            case ConnectToCortexStates.Login_waiting:
            case ConnectToCortexStates.Login_notYet:
            case ConnectToCortexStates.Authorizing:
            case ConnectToCortexStates.Authorize_failed:
            case ConnectToCortexStates.Authorized:
            case ConnectToCortexStates.LicenseExpried: {
                _isChecked = true;
                _connectingToCortex.Activate();
                this.Deactivate();
                break;
            }

            case ConnectToCortexStates.License_HardLimited: {
                break;
            }
            }
        }