コード例 #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
ファイル: MayhemEntry.cs プロジェクト: Cacowned/mayhem
 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));
        }
コード例 #7
0
    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
ファイル: Interactive.cs プロジェクト: oatsfx/Geometric
        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
ファイル: HelpService.cs プロジェクト: MickMelon/FalloutRPG
        /// <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));
 }