Esempio n. 1
0
        public IAccionesJuegoCommand BuscarCommand(string cKey)
        {
            IAccionesJuegoCommand AccionesJuegoCommand = null;

            if (lstAccionesJuegoCommand.Any(x => x.cComando == cKey))
            {
                AccionesJuegoCommand = lstAccionesJuegoCommand.Where(x => x.cComando == cKey).FirstOrDefault();
            }
            return(AccionesJuegoCommand);
        }
Esempio n. 2
0
 public void AgregarCommand(IAccionesJuegoCommand _accionesJuegoCommand)
 {
     if (_accionesJuegoCommand != null)
     {
         if (!lstAccionesJuegoCommand.Any() || lstAccionesJuegoCommand.Any(x => x.cComando != _accionesJuegoCommand.cComando))
         {
             lstAccionesJuegoCommand.Add(_accionesJuegoCommand);
         }
     }
 }
Esempio n. 3
0
        static void AdministrarMenuAcciones(IAccionesReceiver _receiver, string _cNombreJugador)
        {
            Console.BackgroundColor = ConsoleColor.White;
            Console.Clear();
            IRecuperadorMenuAcciones RecuperadorMenuAcciones = new RecuperadorMenuAcciones();

            Console.ForegroundColor = ConsoleColor.Red;
            JugadorInvoker Invoker = new JugadorInvoker();

            AgregarComandosAInvokerBasicos(Invoker, _receiver);
            string cOpcion = string.Empty;

            do
            {
                Console.Clear();
                Console.WriteLine(RecuperadorMenuAcciones.RecuperarMenuAcciones(Invoker.iTipoMenu, _cNombreJugador));
                cOpcion = Console.ReadLine();
                if (cOpcion != "S")
                {
                    IAccionesJuegoCommand EjecutarCommand = Invoker.BuscarCommand(cOpcion);
                    if (EjecutarCommand != null)
                    {
                        Console.ForegroundColor = ConsoleColor.Black;
                        Invoker.EjecutarComando(EjecutarCommand, _cNombreJugador);
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.ReadKey();
                    }
                    else
                    {
                        AgregarNuevasAcciones(cOpcion, _receiver, Invoker);
                    }
                }
            }while (cOpcion != "S");

            if (cOpcion == "S")
            {
                InicializarAplicacion();
            }
        }
Esempio n. 4
0
 public void EjecutarComando(IAccionesJuegoCommand _accionesJuego, string _cNombreJugador)
 {
     _accionesJuego.EjecutarAccion(_cNombreJugador);
 }