예제 #1
0
        private async void GetReactionsCommand()
        {
            ReactionList.Clear();
            List <ReactionInfo> tmp = new List <ReactionInfo>();

            if (Mode == "my")
            {
                OutputMessages.Add(new OutputMessage {
                    Message = "Loading " + CurrentUser + "'s reaction(s)...", Level = ""
                });
                _logService.Write(this, "Loading " + CurrentUser + "'s reaction(s)...", "debug");
                tmp = await _dbService.GetReactions(Person);
            }
            else
            {
                OutputMessages.Add(new OutputMessage {
                    Message = "Loading all reaction(s)...", Level = ""
                });
                _logService.Write(this, "Loading all reaction(s)...", "debug");
                tmp = await _dbService.GetReactions();
            }
            OutputMessages.Add(new OutputMessage {
                Message = tmp.Count + " reaction(s) loaded!", Level = ""
            });
            _logService.Write(this, tmp.Count + " reaction(s) loaded", "debug");
            foreach (var item in tmp)
            {
                ReactionList.Add(item);
            }
        }
예제 #2
0
 private MayhemEntry()
 {
     // Set up our three lists
     EventList      = new EventList();
     ReactionList   = new ReactionList();
     ConnectionList = new ConnectionList();
 }
예제 #3
0
 public Npc(string name, Location location) : base(name, location)
 {
     _greeting = " ... ";
     location.NpcList.Add(this);
     ReactionList.Clear();
     ReactionList.Add("Argh!");
 }
예제 #4
0
 public Npc(string name, string greeting, Location location) : base(name, location)
 {
     _greeting = greeting;
     ReactionList.Clear();
     ReactionList.Add("Argh!");
     MoveTo(location);
 }
예제 #5
0
        public async Task <IUserMessage> SendPaginatedMessageAsync(SocketCommandContext context,
                                                                   PaginatedMessage pager,
                                                                   ReactionList reactions,
                                                                   ICriterion <SocketReaction> criterion = null)
        {
            var callback = new PaginatedMessageCallback(this, context, pager, criterion);
            await callback.DisplayAsync(reactions).ConfigureAwait(false);

            return(callback.Message);
        }
예제 #6
0
        /// <summary>
        ///     This will generate a paginated Message which allows users to use reactions to change the content of the Message
        /// </summary>
        /// <param name="pager">Our paginated Message</param>
        /// <param name="reactionList">The reaction config</param>
        /// <param name="fromSourceUser">True = only Context.User may react to the Message</param>
        /// <returns>The Message that was sent</returns>
        public Task <IUserMessage> PagedReplyAsync(PaginatedMessage pager, ReactionList reactionList, bool fromSourceUser = true)
        {
            var criterion = new Criteria <SocketReaction>();

            if (fromSourceUser)
            {
                criterion.AddCriterion(new EnsureReactionFromSourceUserCriterion());
            }

            return(PagedReplyAsync(pager, criterion, reactionList));
        }
    private void Start()
    {
        //this.trajectory = new FollowTrajectory(new LinearTrajectory(), this.gameObject, Target);
        // this.trajectory = TrajectoryManager.Instance.Create("FollowTrajectory.LinearTrajectory", this.gameObject, this.gameObject.transform.position, this.Target.transform.position, this.Target);
        //this.trajectory = new FollowTrajectory(new LinearTrajectory(), this.gameObject, this.Target);
        this.trajectory = new LookAtTrajectory(new FollowTrajectory(new LinearTrajectory(), this.gameObject, this.Target), this.gameObject, this.LookAtTarget);
        this.trajectory.CallbackWhenCompleted = () => Debug.LogError("JASKDJAKSLDJKLSAD");

        list          = new ReactionList <GameObject>();
        list.changed += () => Debug.LogError("ASDJKSADKLSA");

        list.Add(this.gameObject);
    }
예제 #8
0
        /// <summary>
        /// Creates and sends a paginated message as reply, containing the full description about all commands.
        /// </summary>
        /// <returns>A completed task.</returns>
        private async Task SendPagedHelpReplyAsync()
        {
            EmbedBuilder embed = GenerateEmbeddedHelp();
            List <PaginatedMessage.Page> pages = new List <PaginatedMessage.Page>();
            int pageCount = 0;

            foreach (EmbedFieldBuilder embedField in embed.Fields)
            {
                pages.Add(new PaginatedMessage.Page
                {
                    Description = embed.Description,
                    Title       = embed.Title,
                    Fields      = new List <EmbedFieldBuilder>()
                    {
                        embedField
                    },
                    ImageUrl       = embed.ImageUrl,
                    Color          = embed.Color,
                    FooterOverride = new EmbedFooterBuilder
                    {
                        Text = $"Página {++pageCount} de {embed.Fields.Count}"
                    },
                    ThumbnailUrl = embed.ThumbnailUrl
                });
            }

            PaginatedMessage pager = new PaginatedMessage
            {
                Pages        = pages,
                ThumbnailUrl = pages.First().ThumbnailUrl
            };
            ReactionList reactions = new ReactionList
            {
                Forward  = true,
                Backward = true,
                First    = true,
                Last     = true,
                Info     = false,
                Jump     = false,
                Trash    = false
            };

            await PagedReplyAsync(pager, reactions).ConfigureAwait(false);
        }
예제 #9
0
        public async Task Test_Paginator()
        {
            var pages = new PaginatedMessage();
            var page1 = new PaginatedMessage.Page();
            List <PaginatedMessage.Page> pageList = new List <PaginatedMessage.Page>();

            var reactions = new ReactionList();

            var emoteBank = Context.Client.GetGuild(397846250797662208);

            reactions.Forward = true;

            pageList.Add(page1);

            pages.Title       = "test";
            pages.Pages       = pageList;
            page1.Description = "1";

            await PagedReplyAsync(pages, reactions);
        }
예제 #10
0
        /// <summary>
        /// Shows the character help menu.
        /// </summary>
        public async Task ShowCharacterHelpAsync(SocketCommandContext context)
        {
            var page1 = PaginatedMessageHelper.BuildPageWithFields("Command: $help character",
                                                                   PaginatedMessageHelper.CreatePageFields(Pages.HELP_CHAR_PAGE1_TITLES, Pages.HELP_CHAR_PAGE1_CONTENTS));

            var page2 = PaginatedMessageHelper.BuildPageWithFields("Command: $help character",
                                                                   PaginatedMessageHelper.CreatePageFields(Pages.HELP_CHAR_PAGE2_TITLES, Pages.HELP_CHAR_PAGE2_CONTENTS));

            var pager = PaginatedMessageHelper.BuildPaginatedMessage(new[] { page1, page2 }, context.User);

            var reactions = new ReactionList
            {
                Forward  = true,
                Backward = true,
                Jump     = false,
                Trash    = true
            };

            var callback = new CustomPaginatedMessageCallback(_interactiveService, context, pager);
            await callback.DisplayDMAsync(reactions).ConfigureAwait(false);
        }
예제 #11
0
        private async void DeleteReactionCommand(ReactionInfo deleteThis)
        {
            try
            {
                OutputMessages.Add(new OutputMessage {
                    Message = "Deleting reaction...", Level = ""
                });
                _logService.Write(this, "Deleting reaction...", "debug");
                await _dbService.DeleteReaction(deleteThis.ReactionID);

                ReactionList.Remove(deleteThis);
                OutputMessages.Add(new OutputMessage {
                    Message = "Reaction deleted!", Level = ""
                });
                _logService.Write(this, "Reaction(s) deleted!", "debug");
            }
            catch (Exception e)
            {
                OutputMessages.Add(new OutputMessage {
                    Message = e.Message, Level = "fatal"
                });
                _logService.Write(this, e.Message, "fatal");
            }
        }
예제 #12
0
        /// <summary>
        ///     Sends a multi-pages Message
        /// </summary>
        /// <param name="context"></param>
        /// <param name="pager"></param>
        /// <param name="Reactions"></param>
        /// <param name="criterion"></param>
        /// <returns></returns>
        public async Task <IUserMessage> SendPaginatedMessageAsync(SocketCommandContext context, PaginatedMessage pager, ReactionList Reactions, ICriterion <SocketReaction> criterion = null)
        {
            var callback = new PaginatedMessageCallback(new InteractiveService(Discord.GetShardFor(context.Guild)), context, pager, criterion);
            await callback.DisplayAsync(Reactions).ConfigureAwait(false);

            return(callback.Message);
        }
예제 #13
0
 /// <summary>
 ///     Sends a paginated Message
 /// </summary>
 /// <param name="pager">The paginated Message</param>
 /// <param name="criterion">The criterion for the reply</param>
 /// <param name="reactions">Customized reaction list</param>
 /// <returns>The Message sent.</returns>
 public Task <IUserMessage> PagedReplyAsync(PaginatedMessage pager, ICriterion <SocketReaction> criterion, ReactionList reactions)
 {
     return(Interactive.SendPaginatedMessageAsync(SocketContext(), pager, reactions, criterion));
 }