public Player(string name, int wins, IPlayerLogic playerLogic) { Hand = new Hand(); Name = name; Wins = wins; PlayerLogic = playerLogic; }
public Player(int id, Color color, IPlayerLogic playerLogic) { this.id = id; this.fields = 0; this.color = color; this.PlayerLogic = playerLogic; }
public MainViewModel(IPlayerLogic logic) { this.logic = logic; Team = new ObservableCollection <Player>(); if (IsInDesignMode) { Player p2 = new Player() { Name = "Wild Bill 2" }; Player p3 = new Player() { Name = "Wild Bill 3", Status = StatusType.Injured }; Team.Add(p2); Team.Add(p3); } // MUST USE commandWpf! // MUST USE this.logic AddCmd = new RelayCommand(() => this.logic.AddPlayer(Team)); ModCmd = new RelayCommand(() => this.logic.ModPlayer(TeamSelected)); DelCmd = new RelayCommand(() => this.logic.DelPlayer(Team, TeamSelected)); }
public HomeController(IUserLogic userLogic, IGameLogic gameLogic, IGameBetsLogic gameBetsLogic, IPlayerLogic playerLogic, ILogger <HomeController> logger) { _userLogic = userLogic; _gameLogic = gameLogic; _gameBetsLogic = gameBetsLogic; _playerLogic = playerLogic; _logger = logger; }
public HomeController( IConfiguration configuration, IPlayerLogic playerLogic, ITemplateLogic templateLogic) { _configuration = configuration; _playerLogic = playerLogic; _templateLogic = templateLogic; }
public Connection(string ipAddress, int port, string gameName, string[] args, object testPlaceholder) { _logic = new PlayerLogic(this); _address = ipAddress; _port = port; _gameName = gameName; _keepAliveInterval = ARBITRATYKEEPALIVEINTERVAL;; uint.TryParse(args[0], out _retryJoinGameInterval); Enum.TryParse(args[1], out _team); Enum.TryParse(args[2], out _role); }
public Connection(string ipAddress, int port, string gameName, Messages.ParametersReader inputParameters) { _logic = new PlayerLogic(this); _address = ipAddress; _port = port; _gameName = gameName; if (inputParameters != null) { _keepAliveInterval = (int)inputParameters.ReadPlayerSettings.KeepAliveInterval; } else { _keepAliveInterval = ARBITRATYKEEPALIVEINTERVAL; } _retryJoinGameInterval = inputParameters.ReadPlayerSettings.RetryJoinGameInterval; Enum.TryParse(inputParameters.Team, out _team); Enum.TryParse(inputParameters.Role, out _role); }
public float mCastSpellDistance; //攻击距离 public bool InitState() { BaseGameLogic <IPlayerLogic> bgLogic = (BaseGameLogic <IPlayerLogic>)GameLogicManager.Instance.GetGameLogic(eGameLogicType.PlayerLogic, (short)ePlayerLogicType.Robot); if (null == bgLogic) { return(false); } mLogic = bgLogic.Logic; if (IsDie) { mState = ePlayerState.None; } else { mState = ePlayerState.Idle; } return(true); }
static async Task Main(string[] args) { var configuration = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json") .Build(); Log.Logger = new LoggerConfiguration() .ReadFrom.Configuration(configuration) .CreateLogger(); if (args.Any(s => s == "?" || s == "help")) { Console.WriteLine("Valid arguments:"); Console.WriteLine("\t--playerName joe"); Console.WriteLine("\t--serverAddress http://localhost:5000"); Console.WriteLine("\t--useAlternate true"); Console.WriteLine("\t--sleep random"); return; } using IHost host = CreateHostBuilder(args).Build(); config = host.Services.GetService(typeof(IConfiguration)) as IConfiguration ?? throw new Exception("Unable to load configuration"); Console.WriteLine("What is your player name?"); var playerName = config["playerName"] switch { null => Console.ReadLine(), string name => name }; Console.WriteLine("Hello {0}!", playerName); var serverAddress = config["serverAddress"] ?? "http://localhost:5000"; Console.WriteLine($"Talking to the server at {serverAddress}"); Log.Information("Connected to server at: " + serverAddress); hubConnection = new HubConnectionBuilder() .WithUrl($"{serverAddress}/riskhub") .Build(); hubConnection.On <IEnumerable <BoardTerritory> >(MessageTypes.YourTurnToDeploy, async(board) => { Log.Information("Deploy request received"); var deployLocation = playerLogic.WhereDoYouWantToDeploy(board); Console.WriteLine("Deploying to {0}", deployLocation); Log.Information("Deploy response sent to" + deployLocation.Column + "," + deployLocation.Row); await DeployAsync(deployLocation); }); hubConnection.On <IEnumerable <BoardTerritory> >(MessageTypes.YourTurnToAttack, async(board) => { Log.Information("Attack request received."); try { (var from, var to) = playerLogic.WhereDoYouWantToAttack(board); Console.WriteLine("Attacking from {0} ({1}) to {2} ({3})", from, board.First(c => c.Location == from).OwnerName, to, board.First(c => c.Location == to).OwnerName); Log.Information("Attack response successful from (" + from.Column + "," + from.Row + ") to (" + to.Column + "," + to.Row + ")."); await AttackAsync(from, to); } catch (Exception ex) { Log.Error("Exception caught: " + ex.Message); Console.WriteLine("Yielding turn (nowhere left to attack)"); await AttackCompleteAsync(); } }); hubConnection.On <string, string>(MessageTypes.SendMessage, (from, message) => { Console.WriteLine("From {0}: {1}", from, message); Log.Information("Message received from " + from + ": " + message); }); hubConnection.On <string>(MessageTypes.JoinConfirmation, validatedName => { if (config["useAlternate"] == "true") { playerLogic = new AlternateSampleLogic(validatedName); } else { var shouldSleep = config["sleep"] == "random"; playerLogic = new PlayerLogic(validatedName, shouldSleep); } Console.Title = validatedName; Console.WriteLine($"Successfully joined server. Assigned Name is {validatedName}"); Log.Information("Joining game as: " + validatedName); }); await hubConnection.StartAsync(); Console.WriteLine("My connection id is {0}. Waiting for game to start...", hubConnection.ConnectionId); await SignupAsync(playerName); Console.ReadLine(); Console.WriteLine("Disconnecting from server. Game over."); }
public HomeController(IPlayerLogic playerLogic, ApplicationIdentityUserManager userManager) { _playerLogic = playerLogic; _userManager = userManager; }
public PlayerController(IPlayerLogic client) { _client = client; }
public SyndicateLogic(TauDbContext dbContext, IPlayerLogic playerLogic) { _dbContext = dbContext; _playerLogic = playerLogic; }
static async Task Main(string[] args) { if (args.Any(s => s == "?" || s == "help")) { Console.WriteLine("Valid arguments:"); Console.WriteLine("\t--playerName joe"); Console.WriteLine("\t--serverAddress http://localhost:5000"); Console.WriteLine("\t--useAlternate true"); Console.WriteLine("\t--sleep random"); return; } using IHost host = CreateHostBuilder(args).Build(); config = host.Services.GetService(typeof(IConfiguration)) as IConfiguration ?? throw new Exception("Unable to load configuration"); Console.WriteLine("What is your player name?"); var playerName = config["playerName"] switch { null => Console.ReadLine(), string name => name }; Console.WriteLine("Hello {0}!", playerName); var serverAddress = config["serverAddress"] ?? "http://localhost:5000"; Console.WriteLine($"Talking to the server at {serverAddress}"); hubConnection = new HubConnectionBuilder() .WithUrl($"{serverAddress}/riskhub") .Build(); hubConnection.On <IEnumerable <BoardTerritory> >(MessageTypes.YourTurnToDeploy, async(board) => { var deployLocation = playerLogic.WhereDoYouWantToDeploy(board); Console.WriteLine("Deploying to {0}", deployLocation); await DeployAsync(deployLocation); }); hubConnection.On <IEnumerable <BoardTerritory> >(MessageTypes.YourTurnToAttack, async(board) => { try { (var from, var to) = playerLogic.WhereDoYouWantToAttack(board); Console.WriteLine("Attacking from {0} ({1}) to {2} ({3})", from, board.First(c => c.Location == from).OwnerName, to, board.First(c => c.Location == to).OwnerName); await AttackAsync(from, to); } catch { Console.WriteLine("Yielding turn (nowhere left to attack)"); await AttackCompleteAsync(); } }); hubConnection.On <string, string>(MessageTypes.SendMessage, (from, message) => Console.WriteLine("From {0}: {1}", from, message)); hubConnection.On <string>(MessageTypes.JoinConfirmation, validatedName => { if (config["useAlternate"] == "true") { playerLogic = new AlternateSampleLogic(validatedName); } else { var shouldSleep = config["sleep"] == "random"; playerLogic = new PlayerLogic(validatedName, shouldSleep); } Console.Title = validatedName; Console.WriteLine($"Successfully joined server. Assigned Name is {validatedName}"); }); await hubConnection.StartAsync(); Console.WriteLine("My connection id is {0}. Waiting for game to start...", hubConnection.ConnectionId); await SignupAsync(playerName); Console.ReadLine(); Console.WriteLine("Disconnecting from server. Game over."); }
public InternalPlayer(IPlayerLogic player) : base(player) { this.Cards = new List <Card>(); }
public SyndicateManagementController(IPlayerLogic logic, ISyndicateLogic syndicateLogic, ApplicationIdentityUserManager userManager) : base(syndicateLogic, userManager) { _playerLogic = logic; }
public PlayerController(IPlayerLogic playerLogic, IPortfolioLogic portfolioLogic) { this.playerLogic = playerLogic; this.portfolioLogic = portfolioLogic; }
protected PlayerDecorator(IPlayerLogic player) { this.Player = player; }
public GameBetsRepository(EntityContext entityContext, IPlayerLogic playerLogic) { _entityContext = entityContext; _playerLogic = playerLogic; }
public GameRepository(EntityContext entityContext, ITransactionLogic transactionLogic, IPlayerLogic playerLogic) { _entityContext = entityContext; _transactionLogic = transactionLogic; _playerLogic = playerLogic; }
public PlayersController(IPlayerLogic playerLogic) { _playerLogic = playerLogic; }
public SettingsController(IPlayerLogic playerLogic, ApplicationIdentityUserManager userManager, ISyndicateLogic syndicateLogic) : base(syndicateLogic, userManager) { _playerLogic = playerLogic; }
public HomeController(IPlayerLogic playerLogic) { _playerLogic = playerLogic; }