Example #1
0
 // Use this for initialization
 void Start()
 {
     message              = GameObject.FindGameObjectWithTag("Dialogue");
     messageMenu          = GameObject.FindGameObjectWithTag("MessageMenu");
     player               = GameObject.FindGameObjectWithTag("Player");
     camera               = GameObject.FindGameObjectWithTag("MainCamera");
     gameDataService      = GameObject.FindGameObjectWithTag("GameData");
     menuDataService      = gameDataService.GetComponent <MenuDataService> ();
     characterDataService = gameDataService.GetComponent <CharacterDataService> ();
 }
Example #2
0
        //TODO: We need to handle failure cases, maybe with a window popup and bringing back to the titlescreen.
        /// <inheritdoc />
        public async Task OnGameInitialized()
        {
            //When we reach this scene, the pre lobby burst scene
            //we need to actually connect to the zone/lobby.
            //it verry well could be a zone. Maybe we were in a party and are reconnecting to it
            //no matter what though, we need to get information about our
            //character session and then the zone it should be connecting to
            //then we can connect.

            //First we need to know what zone this session should be going to
            CharacterSessionDataResponse sessionData = await CharacterDataService.GetCharacterSessionData(CharacterDataRepo.CharacterId, AuthTokenRepo.RetrieveWithType())
                                                       .ConfigureAwait(true);

            //TODO: Handle this better
            if (!sessionData.isSuccessful)
            {
                Logger.Error($"Failed to query session data for Character: {CharacterDataRepo.CharacterId}. Cannot connect to instance server.");
                return;
            }

            ResolveServiceEndpointResponse zoneEndpointResponse = await ZoneService.GetServerEndpoint(sessionData.ZoneId);

            if (!zoneEndpointResponse.isSuccessful)
            {
                Logger.Error($"Failed to query endpoint for Zone: {sessionData.ZoneId} which Character: {CharacterDataRepo.CharacterId} is in. Cannot connect to instance server.");
                return;
            }

            //TODO: Don't hardcode gameserver connection details
            //As soon as we start we should attempt to connect to the login server.
            bool result = await Client.ConnectAsync(IPAddress.Parse(zoneEndpointResponse.Endpoint.EndpointAddress), zoneEndpointResponse.Endpoint.EndpointPort)
                          .ConfigureAwait(true);

            if (!result)
            {
                throw new InvalidOperationException($"Failed to connect to Server: {zoneEndpointResponse.Endpoint.EndpointAddress} Port: {zoneEndpointResponse.Endpoint.EndpointPort}");
            }

            if (Logger.IsDebugEnabled)
            {
                Logger.Debug($"Connected client. isConnected: {Client.isConnected}");
            }

            //Basically we just take the network client and tell the client manager to start dealing with it
            //since it's connecting the manager should start pumping the messages out of it.
            await NetworkClientManager.StartHandlingNetworkClient(Client)
            .ConfigureAwait(true);

            //We should broadcast that the connection has been established to any interested subscribers
            OnNetworkConnectionEstablished?.Invoke(this, EventArgs.Empty);
        }
Example #3
0
 // Use this for initialization
 void Start()
 {
     if (gameController)
     {
         gameServer = gameController.GetComponent <GameServer> ();
     }
     characters           = GameObject.FindGameObjectsWithTag("Character");
     controls             = GameObject.FindGameObjectsWithTag("Controls");
     gameData             = GameObject.FindGameObjectWithTag("GameData");
     gameMessage          = GameObject.FindGameObjectWithTag("GameMessage");
     menuDataService      = gameData.GetComponent <MenuDataService> ();
     characterDataService = gameData.GetComponent <CharacterDataService> ();
     inventoryDataService = gameData.GetComponent <InventoryDataService> ();
 }
Example #4
0
        private void Start()
        {
            if (!m_isSetup)
            {
                m_TCPClient             = ClientNetworkingManager.Instance.TCPClient;
                m_UDPClient             = ClientNetworkingManager.Instance.UDPClient;
                m_HTTPClient            = ClientNetworkingManager.Instance.HTTPClient;
                m_dispatcherService     = ClientNetworkingManager.Instance.Dispatcher;
                m_authenticationService = ClientNetworkingManager.Instance.Authentication;
                m_characterService      = ClientNetworkingManager.Instance.CharacterData;
                m_userService           = ClientNetworkingManager.Instance.User;

                m_isSetup = true;
            }
            StateStart();
        }
Example #5
0
 // Use this for initialization
 void Start()
 {
     characterDataService = GameObject.Find("CharacterDataService").GetComponent <CharacterDataService>();
     menuManager          = GameObject.Find("MenuManager").GetComponent <MenuManager>();
 }