private void setImage(string image) { var message = new ClientMessage.ImageMessage(); message.image = image; ServerComponents.SendMessage(server, JsonConvert.SerializeObject(message)); }
private void setMoney(int money) { var message = new ClientMessage.MoneyMessage(); message.money = money; ServerComponents.SendMessage(server, JsonConvert.SerializeObject(message)); }
public GameMain(bool join) { InitializeComponent(); new DatabaseConn("", "").DownloadAndSet(); TopMost = true; FormBorderStyle = FormBorderStyle.FixedSingle; WindowState = FormWindowState.Maximized; MaximizeBox = false; conn = new Thread(new ServerComponents(this).connection); conn.Start(); while (!connected) { Thread.Sleep(1); } if (join) { var message = new ClientMessage.JoinMessage(); message.room_code = Prompt.ShowDialog("Enter the room code", "Prompt"); var message1 = JsonConvert.SerializeObject(message); //Console.WriteLine(message1); ServerComponents.SendMessage(server, message1); } //Console.WriteLine("ORIGINAL SIZE: " + Width); }
private void setName(string name) { var message = new ClientMessage.NameMessage(); message.name = name; ServerComponents.SendMessage(server, JsonConvert.SerializeObject(message)); }
private void UnregisterGameServer() { var peerId = ClientPeerWrapper.PeerId; var gameServerInformationRemover = ServerComponents.GetComponent <IGameServerInformationRemover>(); gameServerInformationRemover?.Remove(peerId); }
public AuthorizationOperationHandler(Action <int> onAuthorizedArg, Action onNonAuthorized) { this.onAuthorizedArg = onAuthorizedArg; this.onNonAuthorized = onNonAuthorized; authorizationServiceApi = ServerComponents.GetComponent <IAuthorizationServiceAPI>().AssertNotNull(); }
private static int GenerateId() { var idGenerator = ServerComponents.GetComponent <IIdGenerator>().AssertNotNull(); var id = idGenerator.GenerateId(); return(id); }
public void ChangeUserProfileProperties() { var userProfileServiceAPI = ServerComponents.GetComponent <IUserProfileServiceAPI>().AssertNotNull(); var parameters = new ChangeUserProfilePropertiesRequestParameters(userId, clientPeerProvider.PeerId, serverType, ConnectionStatus.Connected); userProfileServiceAPI.ChangeUserProfileProperties(parameters); }
private void AddComponents() { ServerComponents.AddComponent(new AuthorizationService()); ServerComponents.AddComponent(new UserProfileService()); ServerComponents.AddComponent(new GameServersInformationStorage()); ServerComponents.AddComponent(new UpdateGameServerConnectionsInfo()); }
public CharacterValidationOperationHandler(int userId, Action <CharacterParameters?> onCharacterSelected) { this.userId = userId; this.onCharacterSelected = onCharacterSelected; characterServiceAPI = ServerComponents.GetComponent <ICharacterServiceAPI>().AssertNotNull(); }
protected override void OnAwake() { base.OnAwake(); peerContainer = ServerComponents.GetComponent <IPeerContainer>().AssertNotNull(); clientPeerProvider = Components.GetComponent <IClientPeerProvider>().AssertNotNull(); }
private PlayerGameObject CreatePlayerGameObject(CharacterParameters character) { var characterSceneObjectCreator = ServerComponents.GetComponent <IPlayerGameObjectCreator>().AssertNotNull(); var characterSceneObject = characterSceneObjectCreator.Create(character); return(characterSceneObject); }
private void OnRegisterToUserProfileService(int id) { serverId = id; var serverIdToPeerIdConverter = ServerComponents.GetComponent <IServerIdToPeerIdConverter>().AssertNotNull(); serverIdToPeerIdConverter.Add(serverId, ClientPeerWrapper.PeerId); }
public AuthenticationOperationHandler(Action <int> onAuthenticated) { this.onAuthenticated = onAuthenticated; databaseUserVerifier = ServerComponents.GetComponent <IDatabaseUserVerifier>().AssertNotNull(); databaseUserPasswordVerifier = ServerComponents.GetComponent <IDatabaseUserPasswordVerifier>().AssertNotNull(); databaseUserIdProvider = ServerComponents.GetComponent <IDatabaseUserIdProvider>().AssertNotNull(); authorizationServiceApi = ServerComponents.GetComponent <IAuthorizationServiceAPI>().AssertNotNull(); }
private void AddComponents() { ServerComponents.AddComponent(new AuthorizationService()); ServerComponents.AddComponent(new UserProfileService()); ServerComponents.AddComponent(new DatabaseConnectionProvider()); ServerComponents.AddComponent(new DatabaseUserVerifier()); ServerComponents.AddComponent(new DatabaseUserPasswordVerifier()); ServerComponents.AddComponent(new DatabaseUserIdProvider()); }
public ChangeSceneOperationHandler(int userId, PlayerGameObject playerGameObject) { this.userId = userId; this.playerGameObject = playerGameObject; sceneContainer = ServerComponents.GetComponent <ISceneContainer>().AssertNotNull(); CharacterSpawnDetailsProvider = ServerComponents.GetComponent <ICharacterSpawnDetailsProvider>().AssertNotNull(); characterServiceApi = ServerComponents.GetComponent <ICharacterServiceAPI>().AssertNotNull(); }
protected override void OnAwake() { base.OnAwake(); var fiber = ServerComponents.GetComponent <IFiberStarter>().AssertNotNull(); IScheduler fiberExecutor = fiber.GetFiberStarter(); fiberExecutor.ScheduleOnInterval(Update, 0, 10); }
public UserProfileService() { var idGenerator = ServerComponents.GetComponent <IRandomNumberGenerator>().AssertNotNull(); serverId = idGenerator.GenerateRandomNumber(); peerContainer = ServerComponents.GetComponent <IPeerContainer>().AssertNotNull(); userIdToPeerIdConverter = ServerComponents.AddComponent(new UserIdToPeerIdConverter()); }
public ChangeUserProfilePropertiesOperationHandler(IUsersContainer usersContainer, IUserProfilePropertiesChangesNotifier userProfilePropertiesChangesNotifier) { this.usersContainer = usersContainer; this.userProfilePropertiesChangesNotifier = userProfilePropertiesChangesNotifier; databaseUserProfileExistence = ServerComponents.GetComponent <IDatabaseUserProfileExistence>().AssertNotNull(); databaseUserProfilePropertiesUpdater = ServerComponents.GetComponent <IDatabaseUserProfilePropertiesUpdater>().AssertNotNull(); databaseUserProfileCreator = ServerComponents.GetComponent <IDatabaseUserProfileCreator>().AssertNotNull(); }
private void AddComponents() { ServerComponents.AddComponent(new AuthorizationService()); ServerComponents.AddComponent(new DatabaseConnectionProvider()); ServerComponents.AddComponent(new DatabaseUserProfileCreator()); ServerComponents.AddComponent(new DatabaseUserProfilePropertiesUpdater()); ServerComponents.AddComponent(new DatabaseUserProfileExistence()); ServerComponents.AddComponent(new ServerIdToPeerIdConverter()); ServerComponents.AddComponent(new UserIdToServerIdConverter()); }
public override void Startup() { base.Startup(); AddCommonComponents(); ServerComponents.AddComponent(new Server2Service()); RunTestForServer2Service(); }
private void RunTestForServer2Service() { var server2Service = ServerComponents.GetComponent <IServer2ServiceAPI>().AssertNotNull(); server2Service.TestAction += OnTestEvent; var coroutinesExecutor = ServerComponents.GetComponent <ICoroutinesManager>().AssertNotNull(); coroutinesExecutor.StartCoroutine(Server2Service()); }
private void submit_Click(object sender, EventArgs e) { setBet = currentBet; setC = currentChoice; var message = new ClientMessage.BetMessage(); message.bet = setBet >= 100 ? setBet : 100;; message.choice = setC; ServerComponents.SendMessage(server, JsonConvert.SerializeObject(message)); }
public GameSceneWrapper(Maps map, Vector2 sceneSize, Vector2 regionSize) : base(sceneSize, regionSize) { this.map = map; pythonScriptEngine = ServerComponents.GetComponent <IPythonScriptEngine>().AssertNotNull(); characterSpawnDetailsProvider = ServerComponents.GetComponent <ICharacterSpawnDetailsProvider>().AssertNotNull(); scriptScope = pythonScriptEngine.GetScriptEngine().CreateScope(); scriptScope.SetVariable("scene", this); }
private void AddComponents() { ServerComponents.AddComponent(new AuthorizationService()); ServerComponents.AddComponent(new DatabaseConnectionProvider()); ServerComponents.AddComponent(new DatabaseCharacterCreator()); ServerComponents.AddComponent(new DatabaseCharacterRemover()); ServerComponents.AddComponent(new DatabaseCharacterNameVerifier()); ServerComponents.AddComponent(new DatabaseCharacterGetter()); ServerComponents.AddComponent(new DatabaseCharactersGetter()); ServerComponents.AddComponent(new DatabaseCharacterExistence()); ServerComponents.AddComponent(new DatabaseCharacterMapUpdater()); }
private void AddComponents() { ServerComponents.AddComponent(new AuthorizationService()); ServerComponents.AddComponent(new CharacterService()); ServerComponents.AddComponent(new UserProfileService()); ServerComponents.AddComponent(new GameServerProviderService()); ServerComponents.AddComponent(new PythonScriptEngine()); ServerComponents.AddComponent(new PythonAssemblies()); ServerComponents.AddComponent(new CharacterSpawnDetailsProvider()); ServerComponents.AddComponent(new SceneContainer()); ServerComponents.AddComponent(new PlayerGameObjectCreator()); }
private void OnAuthenticated() { outboundServerPeerLogic.Dispose(); outboundServerPeerLogic = OutboundServerPeer.CreateOutboundServerPeerLogic <ServerOperations, EmptyEventCode>(); LogUtils.Log(MessageBuilder.Trace("Authenticated with GameServerProvider service.")); RegisterGameServer(); var coroutinesManager = ServerComponents.GetComponent <ICoroutinesManager>().AssertNotNull(); updateGameServerConnectionsContinuously = coroutinesManager.StartCoroutine(UpdateGameServerConnectionsContinuously()); }
private void ChangeUserToOfflineStatus() { if (isManuallyDisconnected || !isUserProfileChanged) { return; } var userProfileServiceAPI = ServerComponents.GetComponent <IUserProfileServiceAPI>().AssertNotNull(); var parameters = new ChangeUserProfilePropertiesRequestParameters(userId, ConnectionStatus.Disconnected); userProfileServiceAPI.ChangeUserProfileProperties(parameters); RemoveAuthorizationForUser(); }
private IEnumerator <IYieldInstruction> Server2Service() { yield return(new WaitForSeconds(15)); var server2Service = ServerComponents.GetComponent <IServer2ServiceAPI>().AssertNotNull(); var coroutinesExecutor = ServerComponents.GetComponent <ICoroutinesManager>().AssertNotNull(); coroutinesExecutor.StartTask(async(y) => { var parameters = new Server1OperationRequestParameters(50); var responseParams = await server2Service.Server1Operation(y, parameters); LogUtils.Log(MessageBuilder.Trace($"Received number: {responseParams.Number}")); }); }
public ComponentServerCached GetComponentServerCached( string name, IReadOnlyDictionary <string, RoleCached> roles) { if (ServerComponents.TryGetValue(name, out ComponentServerCached componentServerCached)) { if (componentServerCached.Roles.Any(x => roles.Keys.Any(role => String.Equals(x.Value.Name, role, StringComparison.OrdinalIgnoreCase)))) { return(componentServerCached); } } return(null); }