Example #1
0
		protected override void OnEventFired(object source, GenericSocialEventArgs<GuildMemberInviteResponseModel> args)
		{
			UnityAsyncHelper.UnityMainThreadContext.PostAsync(async () =>
			{
				string inviterName = args.Data.InvitedEntityGuid == NetworkEntityGuid.Empty ? "" : await EntityNameQueryable.RetrieveAsync(args.Data.InvitedEntityGuid)
					.ConfigureAwait(true);

				//Only certain response codes actually need to be logged.
				switch (args.Data.ResultCode)
				{
					case GuildMemberInviteResponseCode.GeneralServerError:
						TextChatPublisher.PublishEvent(this, new TextChatEventArgs($"Failed to invite to guild due to server error.", ChatChannelType.System));
						break;
					case GuildMemberInviteResponseCode.PlayerAlreadyInGuild:
						TextChatPublisher.PublishEvent(this, new TextChatEventArgs($"{inviterName} is already in a guild.", ChatChannelType.System));
						break;
					case GuildMemberInviteResponseCode.PlayerDeclinedGuildInvite:
						TextChatPublisher.PublishEvent(this, new TextChatEventArgs($"{inviterName} declined your invite to join the guild.", ChatChannelType.System));
						break;
					case GuildMemberInviteResponseCode.PlayerAlreadyHasPendingInvite:
						TextChatPublisher.PublishEvent(this, new TextChatEventArgs($"{inviterName} already has a pending invite to join a guild.", ChatChannelType.System));
						break;
					case GuildMemberInviteResponseCode.PlayerNotFound:
						TextChatPublisher.PublishEvent(this, new TextChatEventArgs($"Unable to invite player to guild; they either don't exist or are not online.", ChatChannelType.System));
						break;
				}
			});
		}
Example #2
0
 protected sealed override void OnEventFired(object source, GenericSocialEventArgs <GuildStatusChangedEventModel> args)
 {
     //Only if it's matching the local player should we dispatch.
     if (LocalPlayerDetails.LocalPlayerGuid == args.Data.EntityGuid)
     {
         OnGuildStatusChanged(args.Data);
     }
 }
Example #3
0
        public async Task ReceiveGuildInviteEventAsync(GuildMemberInviteEventModel message)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            OnGuildMemberInviteEvent?.Invoke(this, GenericSocialEventArgs.Create(message));
        }
Example #4
0
        protected override void OnThreadUnSafeEventFired(object source, GenericSocialEventArgs <GuildMemberInviteEventModel> args)
        {
            UnityAsyncHelper.UnityMainThreadContext.PostAsync(async() =>
            {
                //TODO: We need a better way to handle guild query.
                //We need to translate the names first.
                var nameQueryResponse = await NameQueryService.RetrieveGuildNameAsync(args.Data.GuildId)
                                        .ConfigureAwait(true);
                string inviterName = await EntityNameQueryable.RetrieveAsync(args.Data.InviterGuid)
                                     .ConfigureAwait(true);

                TextChatPublisher.PublishEvent(this, new TextChatEventArgs($"{inviterName} invited you to join the guild <{nameQueryResponse.Result.EntityName}>.", ChatChannelType.System));
            });
        }
Example #5
0
        protected override void OnThreadUnSafeEventFired(object source, GenericSocialEventArgs <GuildMemberInviteEventModel> args)
        {
            UnityAsyncHelper.UnityMainThreadContext.PostAsync(async() =>
            {
                //We need to translate the names first.
                var nameQueryResponse = await NameQueryService.RetrieveGuildNameAsync(args.Data.GuildId)
                                        .ConfigureAwait(true);
                string inviterName = await EntityNameQueryable.RetrieveAsync(args.Data.InviterGuid)
                                     .ConfigureAwait(true);

                if (nameQueryResponse.isSuccessful)
                {
                    GuildInviteWindow.GuildNameText.Text  = $"<{nameQueryResponse.Result.EntityName}>";
                    GuildInviteWindow.InvitationText.Text = $"<color=green><b>{inviterName}</b></color> invites you to join the guild:";

                    //Now it can popup.
                    GuildInviteWindow.SetElementActive(true);
                }
            });
        }
Example #6
0
 public async Task ReceiveGuildStatusChangedEventAsync(GuildStatusChangedEventModel message)
 {
     OnGuildStatusChanged?.Invoke(this, GenericSocialEventArgs.Create(message));
 }