public void ReturnNullWhenProfileDataIsNull() { var lobbyManager = new LobbyManagerStub(); var lobbyUrl = GameWorker.GetProLobbyUrl(lobbyManager, "123456"); Assert.IsNull(lobbyUrl, "Lobby url must be null when profile data is null."); }
public void ReturnNullWhenGameIdIsNull() { var lobbyManager = new LobbyManagerStub(null, "1234"); var lobbyUrl = GameWorker.GetProLobbyUrl(lobbyManager, "123456"); Assert.IsNull(lobbyUrl, "Lobby url must be null when gameId is null."); }
public void ReturnNullWhenLobbySteamIdIsNull() { var lobbyManager = new LobbyManagerStub("9876", null); var lobbyUrl = GameWorker.GetProLobbyUrl(lobbyManager, "123456"); Assert.IsNull(lobbyUrl, "Lobby url must be null when lobbySteamId is null."); }
public Player(GameWorker game, EntityId id, Dispatcher dispatcher, Connection connection) { _score = new PlayerScore(game, id, dispatcher, connection); _game = game; _dispatcher = dispatcher; _connection = connection; _entityId = id; }
public PlayerScore(GameWorker game, EntityId id, Dispatcher dispatcher, Connection connection) { _game = game; _dispatcher = dispatcher; _connection = connection; _entityId = id; Initialise(); }
public void SetupData() { dataContext = new MemoryDataContext(); dataContext.AddBotWith("plaprobot", EBotState.Worked); botRepository = new BotRepository(dataContext); logger = new LoggerStub(); steamClient = new SteamClientMock(logger); gameWorker = new GameWorker(botRepository, logger, steamClient); }
public void ReturnCorrectLobbyUrlWhenPlayerHasCorrectProfileData() { const string gameId = "9876"; const string lobbyId = "1234"; const string playerId = "13579"; var lobbyManager = new LobbyManagerStub(gameId, lobbyId); var lobbyUrl = GameWorker.GetProLobbyUrl(lobbyManager, playerId); Assert.IsNotNull(lobbyUrl, "LobbyUrl must be not null."); StringAssert.IsMatch($"steam://joinlobby/{gameId}/{lobbyId}/{playerId}", lobbyUrl, "Lobby has incorrect format."); }
public string ProLobbyUrl(string proId) { if (string.IsNullOrEmpty(proId)) { return(null); } var webClient = new WebClient(); var lobbyManager = new LobbyManager(webClient); var result = GameWorker.GetProLobbyUrl(lobbyManager, proId); return(result); }
public EGameWorkerResult Invite([FromBody] InviteQuery query) { if (query.UserIds == null || query.UserIds.Length < 1) { return(EGameWorkerResult.InvalidQuery); } var botRepository = new BotRepository(botDataContext); var steamClient = new SteamClient(logger); var gameWorker = new GameWorker(botRepository, logger, steamClient); var result = gameWorker.Invite(query); return(result); }
void Start() { if (GM == null) { GM = this; } Time.timeScale = 1; rnd = new System.Random(); // UI pm = GameObject.FindGameObjectsWithTag("PauseMenu"); gom = GameObject.FindGameObjectsWithTag("GameOverMenu"); foreach (GameObject item in pm) { item.SetActive(false); } foreach (GameObject item in gom) { item.SetActive(false); } }
public EGameWorkerResult Invite([FromBody] DebugInviteQuery query) { var dataContext = new MemoryDataContext(); dataContext.AddBot( new BotModel { Login = query.Login, Password = query.Password, State = EBotState.Free } ); var botRepository = new BotRepository(dataContext); var steamClient = new SteamClient(logger); var gameWorker = new GameWorker(botRepository, logger, steamClient); var result = gameWorker.Invite(query.InviteSubQuery); return(result); }
static int Main(string[] args) { if (args.Length < 1) { return(1); } Assembly.Load("GeneratedCode"); var parameters = new ConnectionParameters { WorkerType = "GameWorker", Network = { ConnectionType = NetworkConnectionType.Tcp, UseExternalIp = false } }; var hostname = "localhost"; if (args.Length >= 2) { hostname = args[1]; } var port = 7777; if (args.Length >= 3) { port = int.Parse(args[2]); } var connection = Connection.ConnectAsync(hostname, (ushort)port, args[0], parameters).Get(); GameWorker worker = new GameWorker(connection, new View()); worker.RunEventLoop(); return(0); }