private FlashGlanceEventVo GetEventConfig(FlashGlanceEventType eventType)
        {
            if (_model.ExerciseConfiguration is FlashGlanceConfiguration castedConfig)
            {
                switch (eventType)
                {
                case FlashGlanceEventType.ItemSpawning:
                    return(castedConfig.GetNewItemtemSpawningByLevel(_model.CurrentRound.Difficulty));

                case FlashGlanceEventType.ItemMovement:
                    return(castedConfig.GetItemMovingByLevel(_model.CurrentRound.Difficulty));

                case FlashGlanceEventType.ItemSwitching:
                    return(castedConfig.GetItemSwitchingByLevel(_model.CurrentRound.Difficulty));

                default:
                    return(new FlashGlanceEventVo()
                    {
                        Amount = 0, MaxDelay = 0, MinDelay = 0
                    });
                }
            }
            else
            {
                return(new FlashGlanceEventVo()
                {
                    Amount = 0, MaxDelay = 0, MinDelay = 0
                });
            }
        }
        private void updateEvantTimer(FlashGlanceEventType eventType)
        {
            FlashGlanceEventVo eventConfig = GetEventConfig(eventType);
            ITimer             timer       = null;

            switch (eventType)
            {
            case FlashGlanceEventType.ItemSpawning:
                timer = _spawnTimer;
                break;

            case FlashGlanceEventType.ItemMovement:
                timer = _moveTimer;
                break;

            case FlashGlanceEventType.ItemSwitching:
                timer = _switchTimer;
                break;
            }
            if (timer != null)
            {
                if (eventConfig.Amount > 0 && eventConfig.MinDelay > 0 && eventConfig.MaxDelay > 0)
                {
                    // Action present
                    if (!timer.IsRunning)
                    {
                        timer.Start(GetRandomDelay(eventConfig));
                    }
                }
                else
                {
                    // No action
                    if (timer.IsRunning)
                    {
                        timer.Stop();
                    }
                }
            }
        }
Ejemplo n.º 3
0
 public FlashGlanceEventRequestVO(FlashGlanceEventType eventType)
 {
     EventType = eventType;
 }