public Sequence Update(FlashGlanceRoundDataVO newRoundData)
        {
            if (_roundData.QuestIndex == newRoundData.QuestIndex)
            {
                return(null);
            }
            if (!_updateSequence.IsComplete())
            {
                _updateSequence.Complete();
            }
            _roundData = newRoundData;
            var sliderItem = _hiddenSliderItem;

            sliderItem.X = RotationRadius;
            sliderItem.Y = 0;
            sliderItem.SetRotation(sliderRotationAngle);
            _sliderItems.Add(sliderItem);
            sliderItem.SetLabel(_roundData.QuestQueue[_roundData.QuestIndex + 2].Cypher.ToString());
            var sequence = _sliderItems[1].SetSearched();

            foreach (var item in _sliderItems)
            {
                sequence.Join(item.RotateBy(-sliderRotationAngle));
            }
            _hiddenSliderItem = _sliderItems.Pop();
            sequence.Join(sliderItem.Appear());
            sequence.Join(_hiddenSliderItem.Disappear());
            sequence.Join(_hiddenSliderItem.SetUpcoming());
            _updateSequence = sequence;
            return(sequence);
        }
Example #2
0
        // Called on the very first round, for now here the initial elements can be initialized
        public void CreateInitialRound(IExerciseRoundDataVO dataVo)
        {
            _roundData   = dataVo as FlashGlanceRoundDataVO;
            _fieldHeight = _roundData.NumberOfRows;
            _fieldWidth  = _roundData.NumberOfColumns;
            _gap         = Rect.rect.width / _fieldWidth;
            var tempGap = Rect.rect.height / _fieldHeight;

            _gap      = _gap > tempGap ? tempGap : _gap;
            _itemSize = _gap * 0.8f;
            System.Diagnostics.Debug.WriteLine("CreateInitialRound");
            foreach (FlashGlanceRoundItemVO item in _roundData.Items)
            {
                var newItem = InitItem(item);
                if (newItem.IsHidden)
                {
                    newItem.Appear();
                }
            }

            slider.Init(_roundData);

            RoundCreated.Dispatch();
            //TestAnswer();
        }
        public override void CreateRound(Action <IExerciseRoundDataVO> callback, IExerciseRoundConfigurationVO exerciseRoundConfiguration = null)
        {
            ValidateMinItemsOnRound();

            int timeout = ExerciseConfiguration.GetTimeoutByLevel(CurrentDifficulty);

            List <IRoundItem> solutions = new List <IRoundItem> {
                _solutionChain[_currentSolutionIndex]
            };

            if (_lastRoundLevelChange != LevelState.EQUAL)
            {
                _colorIndex = CurrentDifficulty % _colors.Length;
                for (int i = _solutionChain.IndexOf(_allItems[0]); i < _solutionChain.Count; i++)
                {
                    _solutionChain[i].Color = _colors[_colorIndex];
                }
            }

            _currentRound = new FlashGlanceRoundDataVO(CloneItems(_allItems),
                                                       solutions,
                                                       _lastRoundLevelChange,
                                                       _warmUpState,
                                                       timeout,
                                                       _solutionChain,
                                                       _currentSolutionIndex,
                                                       _castedConfig.MapHeight,
                                                       _castedConfig.MapWidth);

            base.CreateRound(callback, exerciseRoundConfiguration);
        }
 public void Init(FlashGlanceRoundDataVO newRoundData)
 {
     _roundData      = newRoundData;
     _updateSequence = DOTween.Sequence();
     for (int i = 0; i <= sliderQueueLength; ++i)
     {
         var sliderItem = InitItem();
         sliderItem.X = RotationRadius;
         sliderItem.SetLabel(_roundData.QuestQueue[i].Cypher.ToString());
         _sliderItems.Add(sliderItem);
         sliderItem.SetRotation(sliderRotationAngle * (i - 2));
     }
     _hiddenSliderItem = InitItem();
     _hiddenSliderItem.Hide();
     _hiddenSliderItem.X = RotationRadius;
     _hiddenSliderItem.Y = 0;
     _hiddenSliderItem.SetRotation(sliderRotationAngle);
     _sliderItems[0].SetSearched();
 }
Example #5
0
        // This is called every round after the initial one, update the elements here
        public void CreateRound(IExerciseRoundDataVO dataVo)
        {
            FlashGlanceRoundDataVO lastRoundData = _roundData;

            _roundData = dataVo as FlashGlanceRoundDataVO;

            System.Diagnostics.Debug.WriteLine("CreateRound");
            foreach (FlashGlanceRoundItemVO item in _roundData.Items)
            {
                var newItem = InitItem(item);
                if (newItem.IsHidden)
                {
                    newItem.Appear();
                }
            }

            slider.Update(_roundData);

            RoundCreated.Dispatch();
            //TestAnswer();
        }