public SearchPartyHandler(IGamePacketFactory packetFactory, IGameSession gameSession, IGameWorld gameWorld, IPartyManager partyManager, IMapProvider mapProvider, ICountryProvider countryProvider) : base(packetFactory, gameSession) { _gameWorld = gameWorld; _partyManager = partyManager; _mapProvider = mapProvider; _countryProvider = countryProvider; }
private void Init(IGameSession gameSession) { secondaryContainer = CreateChild("secondary"); { secondaryContainer.Size = Vector2.zero; } primaryContainer = CreateChild("primary"); { primaryContainer.Size = Vector2.zero; } pulseContainer = CreateChild("pulse"); { pulseContainer.Size = Vector2.zero; } gameSession.OnSoftDispose += () => { DestroyAllEffects(); }; pulseRecycler = new ManagedRecycler <TouchPulseEffect>(CreatePulseEffect); pulseRecycler.Precook(5); primaryRecycler = new ManagedRecycler <PrimaryTouchEffects>(CreatePrimaryEffect); primaryRecycler.Precook(4); secondaryRecycler = new ManagedRecycler <SecondaryTouchEffects>(CreateSecondaryEffect); secondaryRecycler.Precook(20); }
public HandshakeHandler(IGamePacketFactory packetFactory, IGameSession gameSession, IWorldServer server, IInterServerClient interClient, ISelectionScreenManager selectionScreenManager) : base(packetFactory, gameSession) { _server = server; _interClient = interClient; _selectionScreenManager = selectionScreenManager; _interClient.OnSessionResponse += InitGameSession; }
public EnteredMapHandler(IGamePacketFactory packetFactory, IGameSession gameSession, IGameWorld gameWorld, ITeleportationManager teleportationManager, IMapProvider mapProvider, IWarehouseManager warehouseManager) : base(packetFactory, gameSession) { _gameWorld = gameWorld; _teleportationManager = teleportationManager; _mapProvider = mapProvider; _warehouseManager = warehouseManager; }
private async Task SendToBothAsync(IGameSession session, PlayResult result, int x, int y) { var msgToSend = new MoveResultMessage(result.ToString(), x, y); await messageSender.SendMessageAsync(session.PlayerOne.Socket, msgToSend); await messageSender.SendMessageAsync(session.PlayerTwo.Socket, msgToSend); }
public void Initialize() { this.serializer = new JsonSerializer(); this.player1 = new User { DisplayName = "Player 1", Name = "player1" }; this.player2 = new User { DisplayName = "Player 2", Name = "player2" }; this.sessionPlayer1 = new TestSessionPlayer() { Information = this.player1, SessionName = this.sessionName }; this.sessionPlayer2 = new TestSessionPlayer() { Information = this.player2, SessionName = this.sessionName }; this.session = new GameSession(this.sessionPlayer1, this.sessionPlayer2); this.playerServiceMock = new Mock<IUserService>(); this.sessionServiceMock = new Mock<ISessionService>(); this.notificationServiceMock = new Mock<INotificationService>(); this.playerFactoryMock = new Mock<ISessionPlayerFactory>(); this.playerSetupMock = new Mock<ISessionPlayerSetup>(); this.inviteDecoratorMock = new Mock<IGameInviteDecorator>(); }
public GMCreateMobHandler(IGamePacketFactory packetFactory, IGameSession gameSession, IDatabasePreloader databasePreloader, IMovementManager movementManager, IMobFactory mobFactory, IMapProvider mapProvider) : base(packetFactory, gameSession) { _databasePreloader = databasePreloader; _movementManager = movementManager; _mobFactory = mobFactory; _mapProvider = mapProvider; }
public void PlayerWithRedCowsGoesFirst() { //TODO: Make sure that the the player who goes first has the dark cows IGameSession gameSession = GameSessionFactory.CreateGameSession(); Assert.AreEqual(gameSession.Current_Player.Color, Color.Red); }
public void Initialize() { this.serializer = new JsonSerializer(); var player1 = new TestSessionPlayer() { SessionName = this.sessionName, PendingToMove = false, Information = new User { DisplayName = "Player 1", Name = "player1" } }; var player2 = new TestSessionPlayer() { SessionName = this.sessionName, PendingToMove = true, Information = new User { DisplayName = "Player 2", Name = "player2" } }; this.session = new GameSession(player1, player2); this.moveServiceMock = new Mock<IMoveService<TestMoveObject, TestResponseObject>>(); this.sessionServiceMock = new Mock<ISessionService>(); this.sessionHistoryServiceMock = new Mock<ISessionHistoryService<TestMoveObject, TestResponseObject>>(); this.notificationServiceMock = new Mock<INotificationService>(); this.moveFactoryMock = new Mock<IMoveFactory<TestMoveObject>>(); this.moveResultNotificationFactoryMock = new Mock<IMoveResultNotificationFactory>(); }
public GMGetItemHandler(IGamePacketFactory packetFactory, IGameSession gameSession, IDatabasePreloader databasePreloader, IItemEnchantConfiguration enchantConfig, IItemCreateConfiguration itemCreateConfig, IInventoryManager inventoryManager) : base(packetFactory, gameSession) { _databasePreloader = databasePreloader; _enchantConfig = enchantConfig; _itemCreateConfig = itemCreateConfig; _inventoryManager = inventoryManager; }
public IRavenfallConnection GetConnection(IGameSession ravenfallGameSession) { lock (connectionMutex) { return(connections.FirstOrDefault(x => x.Session?.Name == ravenfallGameSession.Name)); } }
public GMCreateNpcHandler(IGamePacketFactory packetFactory, IGameSession gameSession, IGameDefinitionsPreloder definitionsPreloder, IMovementManager movementManager, IMapProvider mapProvider, IGameWorld gameWorld, INpcFactory npcFactory) : base(packetFactory, gameSession) { _definitionsPreloder = definitionsPreloder; _movementManager = movementManager; _mapProvider = mapProvider; _gameWorld = gameWorld; _npcFactory = npcFactory; }
private IPlayer GetOtherPlayer(IGameSession session, IPlayer player) { if (session.PlayerOne == player) { return(session.PlayerTwo); } return(session.PlayerOne); }
public VehicleHandlers(IGamePacketFactory packetFactory, IGameSession gameSession, IVehicleManager vehicleManager, IInventoryManager inventoryManager, IMapProvider mapProvider, ICountryProvider countryProvider, IMovementManager movementManager) : base(packetFactory, gameSession) { _vehicleManager = vehicleManager; _inventoryManager = inventoryManager; _mapProvider = mapProvider; _countryProvider = countryProvider; _movementManager = movementManager; }
public GameSessionCommand(IGameSession session, string destination, string id, string message, params string[] args) { this.Session = session; this.Receiver = destination; this.Identifier = id; this.Format = message; this.Args = args; }
public IGameSession GetSession(IGraphicObject container, IDependencyContainer dependency) { if (cachedSession == null) { cachedSession = CreateSession(container, dependency); } return(cachedSession); }
public UseSkillHandlers(IGamePacketFactory packetFactory, IGameSession gameSession, IGameWorld gameWorld, ISkillsManager skillsManager, IAttackManager attackManager, IMapProvider mapProvider, ISkillCastingManager skillCastingManager) : base(packetFactory, gameSession) { _gameWorld = gameWorld; _skillsManager = skillsManager; _attackManager = attackManager; _mapProvider = mapProvider; _skillCastingManager = skillCastingManager; }
public CharacterController(IGameSession session, IObserver observer, LowLevelObserver lowLevelObserver, ILog log) { m_session = session; m_observer = observer; m_lowLevelObserver = lowLevelObserver; Log = log; }
private static void Events_GameSessionStarted(IGameSession session) { Console.WriteLine("New game session has been started."); Console.WriteLine($"Player 1: {session.Player1.Name}"); Console.WriteLine($"Player 2: {session.Player2.Name}"); GoHumanPlayer(); }
private void OnTriggerEnter2D(Collider2D collision) { IGameSession gameSession = GameSession.Instance; gameSession.SetCurrentScore(_score.MyScore); AudioSource.PlayClipAtPoint(pickupSound, Camera.main.transform.position); Destroy(this.gameObject); }
private void Init(IGameSession gameSession) { Dependencies.Cache(this); gameSession.OnHardDispose += () => { UnbindInputter(); }; }
/// <summary> /// Disposes current game session. /// </summary> private void DisposeSession() { if (currentSession == null) { return; } currentSession.InvokeHardDispose(); currentSession = null; }
public async Task Initialize(IGameSession session) { _session = session; gameNodeParent.SetActive(false); await EarlyInitializationProcess(); //run all initializations gameNodeParent.SetActive(true); //and then run game node }
public GameManager(Settings settings, ISessionCreator sessionCreator, IGameSession session, IGameController gameController, ISessionHolder sessionHolder, IObsController obsController, ReplayFileWriter replayFileWriter) { this.settings = settings; this.sessionCreater = sessionCreator; this.session = session; this.gameController = gameController; this.sessionHolder = sessionHolder; this.obsController = obsController; this.replayFileWriter = replayFileWriter; }
public ResourceManager(IGameSession gameSession) { _gameSession = gameSession; var gems = _gameSession.Data.GetResource(ResourceType.Gems); var gold = _gameSession.Data.GetResource(ResourceType.Gold); gems.AmountChanged += OnGemsAmountChanged; gold.AmountChanged += OnGoldAmountChanged; }
public GMTeleportHandler(IGamePacketFactory packetFactory, IGameSession gameSession, IGameWorld gameWorld, IMapsLoader mapLoader, ICountryProvider countryProvider, ITeleportationManager teleportationManager, IMovementManager movementManager, IPartyManager partyManager, IGuildManager guildManager) : base(packetFactory, gameSession) { _gameWorld = gameWorld; _mapLoader = mapLoader; _countryProvider = countryProvider; _teleportationManager = teleportationManager; _movementManager = movementManager; _partyManager = partyManager; _guildManager = guildManager; }
public RebirthHandler(IGamePacketFactory packetFactory, IGameSession gameSession, IMapProvider mapProvider, IGameWorld gameWorld, IHealthManager healthManager, ITeleportationManager teleportationManager, IMovementManager movementManager, IBuffsManager buffsManager, IInventoryManager inventoryManager, IGameDefinitionsPreloder definitionsPreloder) : base(packetFactory, gameSession) { _mapProvider = mapProvider; _gameWorld = gameWorld; _healthManager = healthManager; _teleportationManager = teleportationManager; _movementManager = movementManager; _buffsManager = buffsManager; _inventoryManager = inventoryManager; _definitionsPreloder = definitionsPreloder; }
public void AddSession(string gameName, IGameSession gameSession) { lock (this) { if (!_sessions.ContainsKey(gameName)) { _sessions[gameName] = new List <IGameSession>(); } } _sessions[gameName].Add(gameSession); }
/// <summary> /// Initializes a new game session and starts loading the game. /// </summary> private void InitSession(GameParameter parameter) { if (currentSession != null) { throw new InvalidOperationException("Attempted to initialize a redundant game session."); } currentSession = currentModeService.GetSession(Screen, Dependency); currentSession.SetParameter(parameter); currentSession.InvokeHardInit(); }
protected override void DoUpdate() { if (m_addVecSession.Count > 0) { lock (m_addVecSession) { if (m_addVecSession.Count > 0) { Dictionary <int, IGameSession> .Enumerator iterAdd = m_addVecSession.GetEnumerator(); while (iterAdd.MoveNext()) { IGameSession gSession = iterAdd.Current.Value; ServerPeerCallback spc = new ServerPeerCallback(gSession.GetSessionID(), m_serverListener); ReliableOrderServerPeer rsp = new ReliableOrderServerPeer(gSession, spc); rsp.StartServerPeer(spc); m_peerMap.Add(rsp.GetPeerID(), rsp); m_vecSession.Add(iterAdd.Current.Key, gSession); } m_addVecSession.Clear(); } } } Dictionary <int, IGameSession> .Enumerator iter = m_vecSession.GetEnumerator(); while (iter.MoveNext()) { iter.Current.Value.Update(); } if (this.m_removeIDList.Count > 0) { lock (m_removeIDList) { int listLength = this.m_removeIDList.Count; for (int index = 0; index < listLength; index++) { int peerID = this.m_removeIDList[index]; if (this.m_vecSession.ContainsKey(peerID)) { this.m_vecSession.Remove(peerID); } if (this.m_peerMap.ContainsKey(peerID)) { this.m_peerMap.Remove(peerID); } } this.m_removeIDList.Clear(); } } }
static void Main(string[] args) { BuildContainer(); SubscribeToEvents(); _componentsFactory = _container.Resolve <GameComponentsFactory>(); _session = _container.Resolve <IGameSession>(); Console.WriteLine("Welcome in the Battleship game!"); Console.WriteLine(""); StartNewSession(); }
public GameSession(IGameSession gameManager, UInt32 maxPlayerCount, IPlayerCardRepository playerCardRepository, Guid gameSessionToken, CancellationToken cancellationToken, ILoggerFactory loggerFactory) { // No parameter checking done because this is not a public interface. this.GameSessionToken = gameSessionToken; this.gameManager = gameManager; this.clients = new IClientCallback[maxPlayerCount]; this.cancellationToken = cancellationToken; this.playerCardRepository = playerCardRepository; this.playerCards = new Dictionary <IClientCallback, PlayerData>(); this.messageQueue = new ConcurrentQueue <GameSessionMessage>(); this.loggerFactory = loggerFactory; this.clientsThatReceivedMessages = new HashSet <IClientCallback>(); }
public void Decorate(GameInviteReceivedServerMessage gameInviteNotification, IGameSession session) { var sessionPlayer1 = session.Player1 as GuessMyNumberPlayer; gameInviteNotification.AdditionalInformation = sessionPlayer1.Number.ToString(); }
public GameSessionView(IGameSession gameSession) { _gameSession = gameSession; }
public void Decorate(GameInviteReceivedServerMessage gameInviteNotification, IGameSession session) { return; }
///<exception cref="ServiceException">ServiceException</exception> public void Start(IGameSession currentSession) { var sessionToUpdate = currentSession as GameSession; sessionToUpdate.State = SessionState.Active; try { this.sessionRepository.Update(sessionToUpdate); } catch (DataException gameDataEx) { var errorMessage = string.Format("An error occured when starting the session {0}", sessionToUpdate.Name); throw new ServiceException(errorMessage, gameDataEx); } }
public GameSessionController(IGameSession gameSession) { _gameSession = gameSession; }