Exemplo n.º 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.");
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 4
0
 public void Escape()
 {
     if (_focusedTyper != null)
     {
         _focusedTyper.Reset();
         _focusedTyper = null;
     }
 }
Exemplo n.º 5
0
        protected Typer MakeUniqueTyper()
        {
            var word = GetUniqueWord();

            var typer = new Typer(word);

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

            return(typer);
        }
Exemplo n.º 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);
        }
Exemplo n.º 7
0
        public void Backspace()
        {
            if (_focusedTyper == null)
            {
                return;
            }

            _focusedTyper.Backspace();

            if (!_focusedTyper.IsStartedTyping)
            {
                _focusedTyper = null;
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 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;
            }
        }
Exemplo n.º 10
0
 protected abstract void OnTyped(Typer typer);