Exemplo n.º 1
0
 private void OnLeaveButtonClick()
 {
     ToggleActiveState();
     NetworkingService.LeaveRoom(true, () =>
     {
         SceneManager.LoadScene("Main");
     });
 }
Exemplo n.º 2
0
        private void Awake()
        {
            defaultOutlineWidth        = playerOneHead.outlineWidth;
            playerOneHead.outlineWidth = playerTurnOutlineWidth;

            GameBoardHandler.OnSetupFinished += OnSetupFinished;
            NetworkingService.AddGameEventListener(NameOfTurnFinishedEvent, OnTurnFinished);
        }
Exemplo n.º 3
0
        private void Awake()
        {
            State = GameState.WaitingForPlayers;

            GameBoardHandler.OnSetupFinished += OnGameBoardSetupFinish;
            GameBoardHandler.OnGameFinished  += OnGameFinished;

            NetworkingService.AddClientsLoadedSceneListener(OnAllClientsLoadedScene);
        }
Exemplo n.º 4
0
        // <summary>Called when the join lobby button is pressed to jon the currently selected lobby</summary>
        public void JoinSelectedLobby()
        {
            ListItem lobbyItem = lobbyListItems.CurrentSelected;

            if (lobbyItem != null)
            {
                NetworkingService.JoinLobby(lobbyItem.TxtName.text);
            }
        }
Exemplo n.º 5
0
        public void Init()
        {
            _gcSpeechRecognition = GCSpeechRecognition.Instance;

            _networkingService = new NetworkingService();
            _networkingService.NetworkResponseEvent += NetworkResponseEventHandler;

            CurrentConfig = Resources.Load <Config>("GCSpeechRecognitonConfig");
        }
Exemplo n.º 6
0
        private void OnDestroy()
        {
            joinRoomForm.RemoveListener(OnJoinRoomFinish);

            btnCreate.onClick.RemoveListener(ToggleCreateRoomForm);
            btnJoin.onClick.RemoveListener(OnJoinbuttonClick);

            NetworkingService.RemoveRoomListListener(UpdateListItemsWithRoomData);
        }
Exemplo n.º 7
0
        /// <summary>Setsup player color picking and shares the first available color as this clients player color property</summary>
        private void SetupPlayerColorButton()
        {
            RefreshPlayerColorButtonListeners();

            playerColorPicker.UpdateAvailableColors();

            //set first available color from color picker as player color property
            NetworkingService.UpdateClientProperty(ClientHandler.PlayerColorKey, playerColorPicker.FirstAvailableColor);
        }
Exemplo n.º 8
0
        private void CreatePlayerPawns(bool isPlayerOne)
        {
            Transform lineup       = isPlayerOne ? playerOneSpawns : playerTwoSpawns;
            string    nameOfPrefab = isPlayerOne ? nameOfDiskPrefab : nameOfCrossPrefab;

            foreach (Transform child in lineup)
            {
                pawns.Add(NetworkingService.InstantiateOwnedObject(nameOfPrefab, child.position, child.rotation));
            }
        }
Exemplo n.º 9
0
 private static async Task Start()
 {
     using (var networkingService = new NetworkingService(
                new TcpClientWrapper(),
                new IoService(),
                new ConfigurationProvider()))
     {
         await networkingService.Connect();
     }
 }
Exemplo n.º 10
0
        private void OnDestroy()
        {
            playerColorPicker.OnColorPicked -= OnColorPicked;
            playerColorPicker.OnCancel      -= ToggleInteractabilityOfColorButton;

            NetworkingService.RemoveCallbackListener(MatchmakingCallbackEvent.JoinedRoom, OnJoinedRoom);
            NetworkingService.RemoveCallbackListener(InRoomCallbackEvent.ClientJoined, OnRoomUpdate);
            NetworkingService.RemoveCallbackListener(InRoomCallbackEvent.ClientLeft, OnRoomUpdate);
            NetworkingService.RemoveCallbackListener(InRoomCallbackEvent.HostChanged, OnRoomUpdate);
            NetworkingService.RemoveClientPropertyUpdateListener(OnClientPropertyUpdate);
        }
        public static void Register()
        {
            if (registered)
            {
                return;
            }

            NetworkingService.RegisterCustomSerializable(typeof(TurnFinishedInfo), 'T', TurnFinishedInfo.Serialize, TurnFinishedInfo.Deserialize);
            NetworkingService.RegisterGameEvent(TurnManager.NameOfTurnFinishedEvent, typeof(TurnFinishedInfo));
            registered = true;
        }
Exemplo n.º 12
0
        private void Start()
        {
            ToggleCreateRoomForm();
            ToggleJoinRoomForm();

            btnCreate.onClick.AddListener(ToggleCreateRoomForm);
            btnJoin.onClick.AddListener(OnJoinbuttonClick);

            joinRoomForm.AddListener(OnJoinRoomFinish);

            NetworkingService.AddRoomListListener(UpdateListItemsWithRoomData);
        }
Exemplo n.º 13
0
        private void Awake()
        {
            playerColorPicker.OnColorPicked += OnColorPicked;
            playerColorPicker.OnCancel      += ToggleInteractabilityOfColorButton;

            MultiplayerRegistrations.Register();

            NetworkingService.AddCallbackListener(MatchmakingCallbackEvent.JoinedRoom, OnJoinedRoom);
            NetworkingService.AddCallbackListener(InRoomCallbackEvent.ClientJoined, OnRoomUpdate);
            NetworkingService.AddCallbackListener(InRoomCallbackEvent.ClientLeft, OnRoomUpdate);
            NetworkingService.AddCallbackListener(InRoomCallbackEvent.HostChanged, OnRoomUpdate);
            NetworkingService.AddClientPropertyUpdateListener(OnClientPropertyUpdate);
        }
        public Layer3ExtensionTests(ITestOutputHelper testLog)
        {
            var testOutput = new XunitTraceListener(testLog);
            Trace.Listeners.Add(testOutput);
            OpenStackNet.Tracing.Http.Listeners.Add(testOutput);

            // The operator identity is necessary to create external networks
            var authenticationProvider = TestIdentityProvider.GetOperatorIdentity();
            _networkingService = new NetworkingService(authenticationProvider, "RegionOne");

            _testData = new NetworkingTestDataManager(_networkingService);
            var compute = new ComputeService(authenticationProvider, "RegionOne");
            _computeTestData = new ComputeTestDataManager(compute);
        }
Exemplo n.º 15
0
        private void OnDestroy()
        {
            btnMultiplayer.onClick.RemoveListener(OnMultiplayerButtonClick);
            btnOffline.onClick.RemoveListener(OnOfflineButtonClick);
            btnSettings.onClick.RemoveListener(OnSettingsButtonClick);
            lobbyListItems.RemoveListener(OnLobbyItemSelect);
            roomListItems.RemoveListener(OnRoomItemSelect);

            //remove listeners on destroy
            NetworkingService.RemoveCallbackListener(MatchmakingCallbackEvent.Disconnected, OnDisconnected);
            NetworkingService.RemoveCallbackListener(MatchmakingCallbackEvent.JoinedLobby, OnJoinedLobby);
            NetworkingService.RemoveCallbackListener(MatchmakingCallbackEvent.JoinedRoom, OnJoinedRoom);
            NetworkingService.RemoveCallbackListener(MatchmakingCallbackEvent.LeftRoom, OnLeftRoom);
            NetworkingService.RemoveCallbackListener(MatchmakingCallbackEvent.LeftLobby, OnLeftLobby);
            NetworkingService.RemoveCallbackListener(MatchmakingCallbackEvent.CreatedRoom, OnCreatedRoom);
        }
Exemplo n.º 16
0
 /// <summary>Starts offline mode and switches to offline mode buttons</summary>
 private void OnOfflineButtonClick()
 {
     if (!NetworkingService.IsConnected)
     {
         ChangeGroupFocus("OfflineButtons");
         NetworkingService.SetOffline(true);
     }
     else
     {
         NetworkingService.Disconnect(() =>
         {
             ChangeGroupFocus("OfflineButtons");
             NetworkingService.SetOffline(true);
         });
     }
 }
Exemplo n.º 17
0
        public Layer3ExtensionTests(ITestOutputHelper testLog)
        {
            var testOutput = new XunitTraceListener(testLog);

            Trace.Listeners.Add(testOutput);
            OpenStackNet.Tracing.Http.Listeners.Add(testOutput);

            // The operator identity is necessary to create external networks
            var authenticationProvider = TestIdentityProvider.GetOperatorIdentity();

            _networkingService = new NetworkingService(authenticationProvider, "RegionOne");

            _testData = new NetworkingTestDataManager(_networkingService);
            var compute = new ComputeService(authenticationProvider, "RegionOne");

            _computeTestData = new ComputeTestDataManager(compute);
        }
Exemplo n.º 18
0
        public void ContainsPort_Mac_returns_true_if_port_is_listening(int port, bool isListening, string fileName)
        {
            FileInfo responseFile = new FileInfo(Path.Combine(Directory.GetCurrentDirectory(), "SystemResponses", "Mac", fileName));

            if (!responseFile.Exists)
                throw new FileNotFoundException($"Could not find test file: {responseFile.FullName}");

            _runtimeInfoMock.Setup(m => m.NewLine).Returns("\n").Verifiable();
            _runtimeInfoMock.Setup(m => m.IsMac).Returns(true).Verifiable();

            string netstatResponse = File.ReadAllText(responseFile.FullName);

            NetworkingService service = (NetworkingService)CreateService();

            Assert.Equal(isListening, service.ContainsNetstatPort(netstatResponse, port));

            _runtimeInfoMock.Verify();
        }
Exemplo n.º 19
0
        private void Awake()
        {
            var clients = NetworkingService.ClientsInRoom;

            if (clients.Count != 2)
            {
                Debug.LogError("for this game there can only be 2 clients");
                return;
            }

            InitGridState();
            SetupPlayerDistinction(clients);

            playerOneHead.alpha = 0f;
            playerTwoHead.alpha = 0f;

            NetworkingService.AddClientsLoadedSceneListener(OnAllClientsLoadedScene);
            NetworkingService.AddGameEventListener(TurnManager.NameOfTurnFinishedEvent, OnTurnFinished);
        }
Exemplo n.º 20
0
        public void SetupDefaultTestValues()
        {
            _configMock = new Mock <IConfigurationProvider>();
            _configMock.Setup(m => m.Host).Returns(_host);
            _configMock.Setup(m => m.Port).Returns(_port);
            _configMock.Setup(m => m.Nickname).Returns("nickname");
            _configMock.Setup(m => m.Username).Returns("username");
            _configMock.Setup(m => m.RealName).Returns("realname");

            _tcpClientMock = new Mock <ITcpClientWrapper>();
            _tcpClientMock.Setup(m => m.ConnectAsync(_host, _port)).Returns(Task.CompletedTask);
            _tcpClientMock.Setup(m => m.GetStream()).Returns((NetworkStream)null);

            _ioServiceMock = new Mock <IIoService>();

            _networkingService = new NetworkingService(
                _tcpClientMock.Object,
                _ioServiceMock.Object,
                _configMock.Object);
        }
Exemplo n.º 21
0
 public Layer3Tests()
 {
     _networking = new NetworkingService(Stubs.AuthenticationProvider, "region");
 }
 public NetworkingServiceTestFixture()
 {
     processProxy      = new Mock <IProcessProxy>();
     config            = new Mock <IConfiguration>();
     networkingService = new NetworkingService(processProxy.Object);
 }
Exemplo n.º 23
0
 public Layer3Tests()
 {
     _networking = new NetworkingService(Stubs.AuthenticationProvider, "region");
 }
 /// <inheritdoc cref="NetworkingService_Layer3_Extensions.ListSecurityGroupRulesAsync" />
 public static IEnumerable <SecurityGroupRule> ListSecurityGroupRules(this NetworkingService service, SecurityGroupRuleListOptions options = null)
 {
     return(service.ListSecurityGroupRulesAsync(options).ForceSynchronous());
 }
 /// <inheritdoc cref="NetworkingService_Layer3_Extensions.DeleteFloatingIPAsync" />
 public static void DeleteFloatingIP(this NetworkingService service, Identifier floatingIPId)
 {
     service._networkingApiBuilder.DeleteFloatingIPAsync(floatingIPId).ForceSynchronous();
 }
 /// <inheritdoc cref="NetworkingApiBuilder.ListFloatingIPsAsync{T}" />
 public static async Task <IEnumerable <FloatingIP> > ListFloatingIPsAsync(this NetworkingService service, FloatingIPListOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(await service._networkingApiBuilder.ListFloatingIPsAsync <FloatingIPCollection>(options, cancellationToken).ConfigureAwait(false));
 }
 /// <inheritdoc cref="NetworkingApiBuilder.DeleteFloatingIPAsync" />
 public static Task DeleteFloatingIPAsync(this NetworkingService service, Identifier floatingIPId, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(service._networkingApiBuilder.DeleteFloatingIPAsync(floatingIPId, cancellationToken));
 }
 /// <inheritdoc cref="NetworkingApiBuilder.UpdateFloatingIPAsync{T}" />
 public static Task <FloatingIP> UpdateFloatingIPAsync(this NetworkingService service, FloatingIPUpdateDefinition floatingIP, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(service._networkingApiBuilder.CreateFloatingIPAsync <FloatingIP>(floatingIP, cancellationToken));
 }
 /// <inheritdoc cref="NetworkingApiBuilder.DetachSubnetFromRouterAsync" />
 public static Task DetachSubnetFromRouterAsync(this NetworkingService service, Identifier routerId, Identifier subnetId, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(service._networkingApiBuilder.DetachSubnetFromRouterAsync(routerId, subnetId, cancellationToken));
 }
 /// <inheritdoc cref="NetworkingApiBuilder.AttachSubnetToRouterAsync" />
 public static async Task <Identifier> AttachSubnetToRouterAsync(this NetworkingService service, Identifier routerId, Identifier subnetId, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(await service._networkingApiBuilder.AttachSubnetToRouterAsync(routerId, subnetId, cancellationToken).ConfigureAwait(false));
 }
 /// <inheritdoc cref="NetworkingApiBuilder.AttachPortToRouterAsync" />
 public static Task AttachPortToRouterAsync(this NetworkingService service, Identifier routerId, Identifier portId, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(service._networkingApiBuilder.AttachPortToRouterAsync(routerId, portId, cancellationToken));
 }
 /// <inheritdoc cref="NetworkingApiBuilder.UpdateRouterAsync{T}" />
 public static Task <Router> UpdateRouterAsync(this NetworkingService service, RouterUpdateDefinition router, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(service._networkingApiBuilder.CreateRouterAsync <Router>(router, cancellationToken));
 }