コード例 #1
0
        /// <summary>
        ///     Adds a copy to clipboard option for a <see cref="ConfirmationDialog" />.
        /// </summary>
        private void AddCopyToClipboardOption(ConfirmationDialog confDialog)
        {
            confDialog.cancelButton = new ClickableTextureComponent("COPY",
                                                                    new Rectangle(
                                                                        confDialog.xPositionOnScreen + confDialog.width - IClickableMenu.borderWidth -
                                                                        IClickableMenu.spaceToClearSideBorder - 64,
                                                                        confDialog.yPositionOnScreen + confDialog.height - IClickableMenu.borderWidth -
                                                                        IClickableMenu.spaceToClearTopBorder + 21, 64, 64), null, null, this.clipboardTexture,
                                                                    new Rectangle(0, 0, 64, 64), 1f);
            this.Helper.Reflection.GetField <ConfirmationDialog.behavior>(confDialog, "onCancel")
            .SetValue(this.CopyDialog);

            if (Game1.options.SnappyMenus)
            {
                confDialog.populateClickableComponentList();
                confDialog.snapToDefaultClickableComponent();
            }
        }