コード例 #1
0
ファイル: Misc.cs プロジェクト: zy9634/Taiwu_mods
        private static void Postfix(YesOrNoWindow __instance)
        {
            if (!Main.enabled || Main.binding_key)
            {
                return;
            }

            // 为通用选择框设置正确的初始状态,防止出现 bug
            OnClick.instance.Over = true;

            var confirmComp = __instance.yesOrNoWindow.gameObject.AddComponent <ConfirmComponent>();

            confirmComp.SetActionOnConfirm(() =>
            {
                if (!YesOrNoWindow.instance.yesOrNoWindow.gameObject.activeInHierarchy)
                {
                    return;
                }
                if (OnClick.instance.Over)
                {
                    return;
                }
                DateFile.instance.PlayeSE(2);
                OnClick.instance.Index();
                YesOrNoWindow.instance.CloseYesOrNoWindow();
            });
        }
コード例 #2
0
 private static void Postfix(YesOrNoWindow __instance)
 {
     if (!Main.on)
     {
         return;
     }
     Utils.ButtonConfirm(__instance.yes);
 }
コード例 #3
0
 private static void Postfix(YesOrNoWindow __instance)
 {
     if (!Main.on)
     {
         return;
     }
     Utils.ButtonConfirm(__instance.yes, (_) =>
                         canYes &&
                         __instance.yesOrNoIsShow &&
                         __instance.yesOrNoWindow.gameObject.activeInHierarchy
                         );
 }
コード例 #4
0
        /// <summary>
        /// Gets a yes or no input from the user.
        /// </summary>
        /// <param name="title">The title of the window</param>
        /// <param name="instructionText">The text to instruct the user about what they're choosing.</param>
        /// <param name="extraButtonText">Text for the extra button.</param>
        /// <returns>A string with either "yes", "no" or "extraButtonClicked".</returns>
        public static string GetYesOrNo(string title, string headline, string instructionBoxText, string extraButtonText)
        {
            YesOrNoWindow window = new YesOrNoWindow();

            window.Title = title;
            if (extraButtonText.Length < 1)
            {
                window.ExtraButton.Opacity = 0;
            }
            window.instructionTextBlock.Text = headline;
            window.InfoBox.Text        = instructionBoxText;
            window.ExtraButton.Content = extraButtonText;
            window.ShowDialog();
            return(window.instructionTextBlock.Text);
        }
コード例 #5
0
        /// <summary>
        /// Gets a yes or no input from the user.
        /// </summary>
        /// <param name="title">The title of the window</param>
        /// <param name="instructionText">The text to instruct the user about what they're choosing.</param>
        /// <param name="extraButtonText">Text for the extra button.</param>
        /// <returns>A string with either "yes", "no" or "extraButtonClicked".</returns>
        public static string GetYesOrNo(string title, string headline, string instructionBoxText, string extraButtonText, bool hasOwner)
        {
            YesOrNoWindow window = new YesOrNoWindow();

            window.Title = title;
            if (extraButtonText.Length < 1)
            {
                window.ExtraButton.Opacity = 0;
            }
            window.instructionTextBlock.Text = headline;
            window.InfoBox.Text        = instructionBoxText;
            window.ExtraButton.Content = extraButtonText;
            if (hasOwner == true)
            {
                window.Owner = Application.Current.MainWindow;
            }
            window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            window.ShowDialog();
            return(window.instructionTextBlock.Text);
        }