Esempio n. 1
0
 private void GetInformation()
 {
     _informationHolder.Reset();
     _currentInfo          = _informationHolder.GetNextInformation();
     _currentDisplayStatus = _currentInfo.NextDisplayStatus;
     _panel.GetComponentInChildren <Text>().text = _currentInfo.InfoText;
     _allowedSkipping = _currentInfo.Skippable;
 }
Esempio n. 2
0
        public void Update()
        {
            _spacebarPressed = Input.GetKeyDown("space");

            CheckSkipping();
            _passedTime += Time.deltaTime * 1000;

            double threshold = UnityClient.Communicator.HandleServerParams();

            if (Math.Abs(threshold) > float.Epsilon)
            {
                _threshold = threshold;
            }

            switch (_currentDisplayStatus)
            {
            case DisplayStatus.DisplayingInfo:
                var limit = _currentInfo.DisplayTime != -1 ? _currentInfo.DisplayTime : _taskSettings.InfoTime;
                if (_passedTime > limit)
                {
                    if (_currentSprite != null)
                    {
                        SpriteHandler.Sh.DestroySprite(_currentSprite);
                    }
                    _currentInfo          = _informationHolder.GetNextInformation();
                    _currentDisplayStatus = _currentInfo.NextDisplayStatus;
                    _panel.GetComponentInChildren <Text>().text = _currentInfo.InfoText;
                    _allowedSkipping = _currentInfo.Skippable;
                    _passedTime      = 0;
                }
                break;

            case DisplayStatus.DisplayResults:
                HandleUserInput();
                if (_passedTime > _spriteSettings.GetTimeSettings(_currentSpriteType).SpriteDelayTime)
                {
                    DisplayInfo();
                    _passedTime = 0;
                }
                break;

            case DisplayStatus.WaitToDisplaySprite:
                AntiSpamming.CheckForSpamming(_currentDisplayStatus, _spacebarPressed);
                HandleUserInput();
                if (_passedTime > _spriteSettings.GetTimeSettings(_upcomingSpriteType).SpriteDelayTime)
                {
                    _panel.GetComponentInChildren <Text>().text = "";
                    ShowSprite();
                    _passedTime = 0;
                }
                break;

            case DisplayStatus.DisplayingSprite:
                if (_passedTime > _spriteSettings.GetTimeSettings(_currentSpriteType).SpriteDisplayTime)
                {
                    AntiSpamming.Clear();
                    RemoveSprite();
                }
                HandleUserInput();
                break;

            case DisplayStatus.WaitingUserInput:
                if (_spacebarPressed)
                {
                    _currentDisplayStatus = DisplayStatus.DisplayingInfo;
                }
                break;

            case DisplayStatus.DisplayBoth:
                limit = _currentInfo.DisplayTime != -1 ? _currentInfo.DisplayTime : _taskSettings.InfoTime;
                if (_passedTime > limit)
                {
                    if (_currentSprite != null)
                    {
                        SpriteHandler.Sh.DestroySprite(_currentSprite);
                    }
                    _currentInfo          = _informationHolder.GetNextInformation();
                    _currentSprite        = SpriteHandler.Sh.CreateSprite(_currentInfo.Type, _panel, Position.Above);
                    _currentDisplayStatus = _currentInfo.NextDisplayStatus;
                    _panel.GetComponentInChildren <Text>().text = _currentInfo.InfoText;
                    _allowedSkipping = _currentInfo.Skippable;
                    _passedTime      = 0;
                }
                break;

            case DisplayStatus.GoToMainMenu:
                if (_passedTime > _taskSettings.InfoTime)
                {
                    UnityClient.Communicator.Disconnect();
                    GuiHandler.GoToMainMenu();
                }
                break;

            case DisplayStatus.GoToNextScene:
                limit = _currentInfo.DisplayTime != -1 ? _currentInfo.DisplayTime : _taskSettings.InfoTime;
                if (_passedTime > limit)
                {
                    if (Randomness.Rand.NextDouble() < 0.5)
                    {
                        _punishmentPanel.SetActive(true);
                    }
                    else
                    {
                        _rewardPanel.SetActive(true);
                    }
                    _panel.SetActive(false);
                }
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
 public InformationNugget GetNextInformation()
 {
     _currentIndex = (_currentIndex + 1) % _info.Count;
     CurrentNugget = _info[_currentIndex];
     return(CurrentNugget);
 }
Esempio n. 4
0
        private void Update()
        {
            _spacebarPressed = Input.GetKeyDown("space");

            CheckSkipping();
            _passedTime += Time.deltaTime * 1000;

            switch (_currentDisplayStatus)
            {
            case DisplayStatus.DisplayingInfo:
                var limit = _currentInfo.DisplayTime != -1 ? _currentInfo.DisplayTime : _infoDisplayTime;
                if (_passedTime > limit)
                {
                    _currentInfo          = _informationHolder.GetNextInformation();
                    _currentDisplayStatus = _currentInfo.NextDisplayStatus;
                    _panel.GetComponentInChildren <Text>().text = _currentInfo.InfoText;
                    _allowedSkipping = _currentInfo.Skippable;
                    _passedTime      = 0;
                }
                break;

            case DisplayStatus.DisplayResults:
                DisplayResults();
                _passedTime = 0;
                break;

            case DisplayStatus.WaitToDisplaySprite:
                limit = _currentInfo.DisplayTime != -1 ? _currentInfo.DisplayTime : _infoDisplayTime;
                if (_passedTime > limit)
                {
                    _panel.GetComponentInChildren <Text>().text = "";
                    ShowSprite();
                    _waitingForUser = true;
                    _passedTime     = 0;
                }
                break;

            case DisplayStatus.DisplayingSprite:
                if (_passedTime > _timeSettings.SpriteDisplayTime)
                {
                    RemoveSprite();
                }
                HandleUserInput();
                break;

            case DisplayStatus.WaitingUserInput:
                if (_spacebarPressed)
                {
                    HandleUserInput();
                }
                break;

            case DisplayStatus.DisplayBoth:
                break;

            case DisplayStatus.GoToMainMenu:
                if (_passedTime > _infoDisplayTime)
                {
                    GuiHandler.GoToMainMenu();
                }
                break;

            case DisplayStatus.GoToNextScene:
                if (_passedTime > _infoDisplayTime)
                {
                    _panel.SetActive(false);
                    PanelSrt.SetActive(true);
                }
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }