/// <summary> /// Inverte a ordem sequencial de jogada /// </summary> private void Inverter() { Turno turno = this.eng.Roda; Lista <Player> jogadores = turno.Jogadores; switch (turno.GetSentido()) { case SentidoJogada.Horario: turno.SetSentido(SentidoJogada.AntiHorario); Log.AddEventoInverterJogo(); break; case SentidoJogada.AntiHorario: turno.SetSentido(SentidoJogada.Horario); Log.AddEventoInverterJogo(); break; } }
public Enginee(UIElement colapse, Canvas env, UIElement monteUI) { this.screenSizeY = System.Windows.SystemParameters.PrimaryScreenHeight; this.screenSizeX = System.Windows.SystemParameters.PrimaryScreenWidth; //Não mude a ordem de iniciação desses elementos. A troca pode acarretar graves consequências físicas ao culpado. this.enviroment = env; this.monteUI = monteUI; this.element_colapse = colapse; this.PosicionarMonteUI(); this.PosicionarUltimaCartaJogada(); this.players = new Lista <Player>(); this.allprofiles = new Lista <Profile>(); this.LoadImage(); this.SetRandomPlayersProfile(); this.baralho = new Baralho(); this.baralho.Embaralhar(); this.realOne = this.players[2]; this.monte = new Monte(baralho.GetCards()); this.DistributeCards(); this.roda = new Turno(this.players); this.AddCardsOnInterface(); this.AddIconsOnInterface(); this.descarte = new Coletor(GetValidCard()); this.AddColetorCardOnInterface(); this.DisableMoveIconsPlayers(); this.AlignIconsPlayers(); this.evento = new Evento(this); }
/// <summary> /// Bloqueia o próximo jogador na lista /// </summary> private void Bloquear() { Turno turno = this.eng.Roda; Lista <Player> jogadores = turno.Jogadores; switch (turno.GetSentido()) { case SentidoJogada.Horario: if (jogadores.GetIndexOf(turno.GetCurrentPlayer()) + 2 >= jogadores.Count) { turno.SetCurrentPlayer(jogadores[0]); Log.AddEventoBloquearJogador(turno.GetCurrentPlayer()); } else { turno.SetCurrentPlayer(jogadores[jogadores.GetIndexOf(turno.GetCurrentPlayer()) + 2]); Log.AddEventoBloquearJogador(turno.GetCurrentPlayer()); } break; case SentidoJogada.AntiHorario: if (jogadores.GetIndexOf(turno.GetCurrentPlayer()) - 2 < 0) { turno.SetCurrentPlayer(jogadores[jogadores.Count - 1]); Log.AddEventoBloquearJogador(turno.GetCurrentPlayer()); } else { turno.SetCurrentPlayer(jogadores[jogadores.GetIndexOf(turno.GetCurrentPlayer()) - 1]); Log.AddEventoBloquearJogador(turno.GetCurrentPlayer()); } break; } }