Exemple #1
0
        private void OnLocalPlayerSpawnedEvent(object sender, LocalPlayerSpawnedEventArgs e)
        {
            State |= PositionalAudioState.PlayerSpawned;

            //Now is the time to initialize the actual
            //local player's positional information.
            PositionalChannelUpdateTickable.InitializeTrackerGameObject(e.EntityGuid);
        }
Exemple #2
0
        protected override void OnLocalPlayerSpawned(LocalPlayerSpawnedEventArgs args)
        {
            //Even if we don't know the experience yet, we should initialize. It could end up as 0 but that's ok.
            int currentExperience = PlayerDetails.EntityData.GetFieldValue <int>(PlayerObjectField.PLAYER_TOTAL_EXPERIENCE);

            OnPlayerExperienceChanged(args.EntityGuid, new EntityDataChangedArgs <int>(currentExperience, currentExperience));

            RegisterPlayerDataChangeCallback <int>(PlayerObjectField.PLAYER_TOTAL_EXPERIENCE, OnPlayerExperienceChanged);
        }
Exemple #3
0
        /// <inheritdoc />
        protected override void OnLocalPlayerSpawned(LocalPlayerSpawnedEventArgs args)
        {
            if (Logger.IsInfoEnabled)
            {
                Logger.Info($"Movement input enabled.");
            }

            //Local player is spawned, we should actually handle input now.
            isLocalPlayerSpawned = true;
        }
Exemple #4
0
		protected override void OnLocalPlayerSpawned(LocalPlayerSpawnedEventArgs args)
		{
			UnityAsyncHelper.UnityMainThreadContext.PostAsync(async () =>
			{
				CharacterActionBarInstanceModel[] barInstanceModels = await CharacterService.GetCharacterActionBarDataAsync(PlayerDetails.LocalPlayerGuid.EntityId);

				foreach (CharacterActionBarInstanceModel actionBarModel in barInstanceModels)
				{
					ActionBarStateChangePublisher.PublishEvent(this, new ActionBarButtonStateChangedEventArgs(actionBarModel.BarIndex, actionBarModel.Type, actionBarModel.ActionId));
					ActionBarCollection.Add(actionBarModel);
				}
			});
		}
Exemple #5
0
 /// <inheritdoc />
 protected override void OnLocalPlayerSpawned(LocalPlayerSpawnedEventArgs args)
 {
     RegisterPlayerDataChangeCallback <int>(BaseObjectField.UNIT_FIELD_LEVEL, OnLevelChanged);
 }
Exemple #6
0
        protected override void OnLocalPlayerSpawned(LocalPlayerSpawnedEventArgs args)
        {
            UnityAsyncHelper.UnityMainThreadContext.PostAsync(async() =>
            {
                try
                {
                    //We need to connect the hub to the social backend
                    ResolveServiceEndpointResponse endpointResponse = await ServiceDiscoveryService.DiscoverService(new ResolveServiceEndpointRequest(ClientRegionLocale.US, GladMMONetworkConstants.SOCIAL_SERVICE_NAME))
                                                                      .ConfigureAwaitFalse();

                    if (!endpointResponse.isSuccessful)
                    {
                        throw new InvalidOperationException($"Failed to query for SocialService. Reason: {endpointResponse.ResultCode}");
                    }

                    string hubConnectionString = $@"{endpointResponse.Endpoint.EndpointAddress}:{endpointResponse.Endpoint.EndpointPort}/realtime/social";

                    if (Logger.IsInfoEnabled)
                    {
                        Logger.Info($"Social HubConnection String: {hubConnectionString}");
                    }

                    //TODO: Handle failed service disc query
                    HubConnection connection = new HubConnectionBuilder()
                                               .WithUrl(hubConnectionString, options =>
                    {
                        options.Headers.Add(SocialNetworkConstants.CharacterIdRequestHeaderName, PlayerDetails.LocalPlayerGuid.EntityId.ToString());
                        options.AccessTokenProvider = () => Task.FromResult(AuthTokenProvider.Retrieve());
                    })
                                               .AddJsonProtocol()
                                               .Build();

                    //Register the reciever interface instance for the Connection Hub
                    connection.RegisterClientInterface <IRemoteSocialHubClient>(RemoteSocialClient);

                    foreach (var initable in ConnectionHubInitializable)
                    {
                        initable.Connection = connection;
                    }

                    //Just start the service when the game initializes
                    //This will make it so that the signalR clients will start to recieve messages.
                    await connection.StartAsync()
                    .ConfigureAwaitFalseVoid();

                    if (Logger.IsInfoEnabled)
                    {
                        Logger.Info($"Connected to realtime Social Service.");
                    }

                    OnRealtimeSocialServiceConnected?.Invoke(this, EventArgs.Empty);
                }
                catch (Exception e)
                {
                    if (Logger.IsErrorEnabled)
                    {
                        Logger.Error($"Failed to connect to Social Service: {e.ToString()}");
                    }

                    throw;
                }
            });
        }
Exemple #7
0
 protected override void OnLocalPlayerSpawned(LocalPlayerSpawnedEventArgs args)
 {
     //Just add the main camera.
     CameraMappable.AddObject(args.EntityGuid, Camera.main);
 }
Exemple #8
0
 /// <inheritdoc />
 protected override void OnLocalPlayerSpawned(LocalPlayerSpawnedEventArgs args)
 {
     RegisterPlayerDataChangeCallback <int>(EntityObjectField.UNIT_FIELD_CASTING_SPELLID, OnSpellCastingIdChanged);
 }
Exemple #9
0
 protected override void OnLocalPlayerSpawned(LocalPlayerSpawnedEventArgs args)
 {
     RegisterPlayerDataChangeCallback <ulong>(EntityObjectField.UNIT_FIELD_TARGET, OnPlayerTargetEntityDatChanged);
 }