Пример #1
0
        protected override void OnTyped(Typer typer)
        {
            if (typer == StopTyper)
            {
                // Vote to stop a battle.
                Game.StopBattle();
                return;
            }

            var skill = _skillTypers.SingleOrDefault(x => x.Value == typer);

            if (skill.Value != null)
            {
                SelectedSkillId = skill.Key;

                AttackIfReady();
                return;
            }

            var player = _playerTypers.SingleOrDefault(x => x.Value == typer);

            if (player.Value != null)
            {
                SelectedPlayerId = player.Key;

                AttackIfReady();
                return;
            }

            throw new InvalidOperationException("Invalid typer.");
        }
Пример #2
0
        protected override void OnTyped(Typer typer)
        {
            if (typer == CancelTyper)
            {
                Game.CancelPlayerSelection();
                return;
            }

            if (typer == OkTyper)
            {
                Game.FinalizePlayerSelection();
                return;
            }

            // Else it's one of player's typers.
            var player = _playerTypers.Single(t => t.Value == typer);

            if (_selected.Contains(player.Key))
            {
                _selected.Remove(player.Key);
            }
            else
            {
                _selected.Add(player.Key);
            }
        }
Пример #3
0
        private void ResetUniqueTyper(Typer typer)
        {
            var word = GetUniqueWord();

            typer.Reset(word);
            _typers.Remove(_typers.Single(x => x.Value == typer).Key);
            _typers.Add(word[0], typer);
        }
Пример #4
0
 public void Escape()
 {
     if (_focusedTyper != null)
     {
         _focusedTyper.Reset();
         _focusedTyper = null;
     }
 }
Пример #5
0
        protected Typer MakeUniqueTyper()
        {
            var word = GetUniqueWord();

            var typer = new Typer(word);

            _typers.Add(word[0], typer);

            return(typer);
        }
Пример #6
0
        protected override void OnTyped(Typer typer)
        {
            if (typer == AttackTyper)
            {
                Game.InitiateBattle();
                return;
            }

            var zoneId = _zoneTypers.Single(t => t.Value == typer).Key;

            Game.StartMovingToZone(zoneId);
        }
Пример #7
0
        public void Backspace()
        {
            if (_focusedTyper == null)
            {
                return;
            }

            _focusedTyper.Backspace();

            if (!_focusedTyper.IsStartedTyping)
            {
                _focusedTyper = null;
            }
        }
Пример #8
0
        public PassZoneTypers(Game game, PassZoneMessage passZoneStatus)
        {
            _game = game;
            var passZoneId = passZoneStatus.PassZoneId;
            var direction  = passZoneStatus.Direction;

            var passZone = Data.Data.GetPassZone(passZoneId);
            var distance = passZone.GetDistance(direction);
            var progress = passZoneStatus.Progress;

            var text = Data.Data.GetText(distance, 90);

            Typer = new Typer(text, progress);
        }
Пример #9
0
        public void Type(char character)
        {
            if (_focusedTyper == null)
            {
                if (!_typers.ContainsKey(character))
                {
                    return;
                }

                _focusedTyper = _typers[character];
            }

            _focusedTyper.Type(character);

            if (_focusedTyper.IsFinishedTyping)
            {
                ResetUniqueTyper(_focusedTyper);

                OnTyped(_focusedTyper);
                _focusedTyper = null;
            }
        }
Пример #10
0
 protected abstract void OnTyped(Typer typer);