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."); }
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); } }
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); }
public void Escape() { if (_focusedTyper != null) { _focusedTyper.Reset(); _focusedTyper = null; } }
protected Typer MakeUniqueTyper() { var word = GetUniqueWord(); var typer = new Typer(word); _typers.Add(word[0], typer); return(typer); }
protected override void OnTyped(Typer typer) { if (typer == AttackTyper) { Game.InitiateBattle(); return; } var zoneId = _zoneTypers.Single(t => t.Value == typer).Key; Game.StartMovingToZone(zoneId); }
public void Backspace() { if (_focusedTyper == null) { return; } _focusedTyper.Backspace(); if (!_focusedTyper.IsStartedTyping) { _focusedTyper = null; } }
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); }
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; } }
protected abstract void OnTyped(Typer typer);