예제 #1
0
 public void ClearDialogBoxData()
 {
     yesCallback    = null;
     noCallback     = null;
     dialogBoxKey   = null;
     dialogBoxColor = Color.white;
 }
예제 #2
0
    public void FinalRoundRobbed(Player pirate, ref DialogCallback goToHarbor, ref DialogCallback goToTomb)
    {
        if (!isRobbed)
        {
            investors.Clear();
            investments.Clear();
            isRobbed = true;
        }

        investments.Add(new GoodInvestmentRecord(investors.Count, pirate.GetPlayerColor()));
        investors.Add(pirate);

        goToHarbor  = null;
        goToTomb    = null;
        goToHarbor += RobbedToHarbor;
        goToTomb   += RobbedToTomb;

        /*
         * if(key != null)
         * {
         *              UIManager.Singleton.CloseUI(UIType.DIALOG_BOX);
         *              UIManager.Singleton.RegisterDialogBoxData(pirate.GetPlayerColor(), key, RobToHarbor, RobToTomb);
         *              UIManager.Singleton.ShowUI(UIType.DIALOG_BOX);
         * }
         */
    }
예제 #3
0
        public static DialogHandler Create(Browser parent, DialogCallback dialogCallback, MenuCallback contextCallback)
        {
            if (dialogPage == null)
            {
                dialogPage = Resources.Load <TextAsset>("Browser/Dialogs").text;
            }
            GameObject    gameObject = new GameObject("Browser Dialog for " + parent.name);
            DialogHandler handler    = gameObject.AddComponent <DialogHandler>();

            handler.parentBrowser  = parent;
            handler.dialogCallback = dialogCallback;
            Browser browser = (handler.dialogBrowser = handler.GetComponent <Browser>());

            browser.UIHandler          = parent.UIHandler;
            browser.EnableRendering    = false;
            browser.EnableInput        = false;
            browser.allowContextMenuOn = BrowserNative.ContextMenuOrigin.Editable;
            browser.Resize(parent.Texture);
            browser.LoadHTML(dialogPage, "about:dialog");
            browser.UIHandler = parent.UIHandler;
            browser.RegisterFunction("reportDialogResult", delegate(JSONNode args)
            {
                dialogCallback(args[0], args[1], args[3]);
                handler.Hide();
            });
            browser.RegisterFunction("reportContextMenuResult", delegate(JSONNode args)
            {
                contextCallback(args[0]);
                handler.Hide();
            });
            return(handler);
        }
 public StateDialogPrompt(PromptType type, DialogCallback onYes, DialogCallback onNo)
 {
     gameSystem = GameSystem.Instance;
     if (!gameSystem.UsePrompts && type != 0)
     {
         Debug.Log("Immediately completing dialog, dialogs disabled in config.");
         gameSystem.RegisterAction(delegate
         {
             if (onYes != null)
             {
                 onYes();
             }
             gameSystem.PopStateStack();
         });
         gameSystem.ExecuteActions();
     }
     else
     {
         GameObject gameObject = UnityEngine.Object.Instantiate(gameSystem.PromptPrefab);
         promptController = gameObject.GetComponent <PromptController>();
         if (promptController == null)
         {
             throw new Exception("Failed to instantiate promptController!");
         }
         promptController.Open(type, onYes, onNo);
     }
 }
예제 #5
0
 /* ----------------------------------------------------------------- */
 ///
 /// CloseMessage
 ///
 /// <summary>
 /// Creates a message to show the MessageBox of overwriting
 /// confirmation.
 /// </summary>
 ///
 /// <param name="callback">
 /// Callback action when terminating the user operation.
 /// </param>
 ///
 /// <returns>DialogMessage object.</returns>
 ///
 /* ----------------------------------------------------------------- */
 public static DialogMessage CloseMessage(DialogCallback callback) =>
 new DialogMessage(Properties.Resources.MessageOverwrite,
                   Assembly.GetExecutingAssembly(), callback)
 {
     Buttons = System.Windows.MessageBoxButton.YesNoCancel,
     Image   = System.Windows.MessageBoxImage.Information,
 };
예제 #6
0
 public void RegisterDialogBoxData(Color color, string key, DialogCallback yes, DialogCallback no)
 {
     ClearDialogBoxData();
     dialogBoxColor = new Color(color.r, color.g, color.b, color.a);
     dialogBoxKey   = key;
     yesCallback   += yes;
     noCallback    += no;
 }
        private void Save()
        {
            var cleanStartupArguments = StartupArgumentList.Where(item => !string.IsNullOrEmpty(item.Command)).ToList();

            _ConfigManager.SaveStartupArgumentList(cleanStartupArguments, GameType);
            DialogCallback?.Invoke(true);
            ((ICommand)ControlCommands.Close).Execute(null);
        }
예제 #8
0
 void OnDisable()
 {
     if (callback_ != null)
     {
         callback_(Result);
         callback_ = null;
     }
 }
        /// <summary>
        /// Show a dialog for opening a directory
        /// </summary>
        /// <param name="resultCallback">Callback function called when the user has selected a directory</param>
        /// <param name="directory">Path of the directory to open</param>
        public static void ShowOpenDirectoryDialog(DialogCallback resultCallback, string directory = "")
        {
            GameObject dialogObject = new GameObject("_OpenDirectoryDialog");
            RuntimeFileBrowserComponent dialogComp = dialogObject.AddComponent <RuntimeFileBrowserComponent>();

            dialogComp.dialogMode       = RuntimeFileBrowserComponent.DialogMode.OpenDirectory;
            dialogComp.callback         = resultCallback;
            dialogComp.currentDirectory = GetAbsoluteDirectoryPath(directory);
        }
예제 #10
0
 /* ----------------------------------------------------------------- */
 ///
 /// RemoveWarning
 ///
 /// <summary>
 /// 削除時の警告メッセージを生成します。
 /// </summary>
 ///
 /// <param name="name">削除名</param>
 /// <param name="e">コールバック関数</param>
 ///
 /// <returns>DialogMessage オブジェクト</returns>
 ///
 /* ----------------------------------------------------------------- */
 public static DialogMessage RemoveWarning(string name, DialogCallback e) =>
 new DialogMessage(
     string.Format(Properties.Resources.MessageRemove, name),
     Properties.Resources.TitleInformation,
     e
     )
 {
     Button = MessageBoxButton.YesNo,
     Image  = MessageBoxImage.Information,
 };
예제 #11
0
        public void modalPost(Form parent, String message,
            String title, Object clientData, DialogCallback okCallback,
            DialogCallback cancelCallback, DialogCallback helpCallback,
            String okLabel, String cancelLabel, String helpLabel, int cancelBtnNum)
        {
            if (parent == null)
            {
                this.Owner = MainProgram.theApplication.getAnchorForm();
            }
            else
            {
                this.Owner = parent;
            }

            createDialog();
            this.messageLabel.Text = Utils.WordWrap(message, 50);
            if (title != null)
                this.Text = title;
            Debug.Assert((cancelBtnNum >= 1) && (cancelBtnNum <= 3));

            data = clientData;
            if (okLabel != null)
                this.okButton.Text = okLabel;
            if (cancelLabel != null)
                this.cancelButton.Text = cancelLabel;
            if (helpLabel != null)
                this.helpButton.Text = helpLabel;

            if (helpCallback == null)
            {
                this.helpButton.Visible = false;
            }
            else
                this.helpButton.Click += new EventHandler(helpCallback);

            if (okCallback != null)
            {
                this.okButton.Click += new EventHandler(okCallback);
                this.okButton.Tag = clientData;
            }
            if (cancelCallback != null)
            {
                this.cancelButton.Click += new EventHandler(cancelCallback);
                this.cancelButton.Tag = clientData;
            }

            this.StartPosition = FormStartPosition.Manual;
            int x = this.Owner.Location.X + (int)((this.Owner.Width - this.Width) / 2.0) + numOpenDialogs * 5;
            int y = this.Owner.Location.Y + (int)((this.Owner.Height - this.Height) / 2.0) + numOpenDialogs * 5;
            this.Location = new Point(x, y);

            numOpenDialogs++;
            this.ShowDialog();
        }
예제 #12
0
    public void SecondRoundRobbed(Player pirate, ref DialogCallback goToHarbor, ref DialogCallback goToTomb)
    {
        int totalInvestment = (goodType == GoodType.JADE) ? 4 : 3;

        if (!investors.Contains(pirate))
        {
            if (investors.Count < totalInvestment)
            {
                investments.Add(new GoodInvestmentRecord(investors.Count, pirate.GetPlayerColor()));
                investors.Add(pirate);
            }
            else
            {
                int random = Random.Range(0, totalInvestment);
                int index  = investments[random].index;

                investors[random] = pirate;
                investments.RemoveAt(random);
                investments.Add(new GoodInvestmentRecord(index, pirate.GetPlayerColor()));
            }
        }
        else
        {
            if (investors.Count < totalInvestment)
            {
                investments.Add(new GoodInvestmentRecord(investors.Count, pirate.GetPlayerColor()));
                investors.Add(pirate);
            }
            else
            {
                int random = 0;
                do
                {
                    random = Random.Range(0, totalInvestment);
                }while (investors[random] == pirate);

                int index = investments[random].index;
                investors[random] = pirate;
                investments.RemoveAt(random);
                investments.Add(new GoodInvestmentRecord(index, pirate.GetPlayerColor()));
            }
        }

        goToHarbor += RobbedToHarbor;
        goToTomb   += RobbedToTomb;
    }
예제 #13
0
        public static DialogHandler Create(Browser parent, DialogCallback dialogCallback, MenuCallback contextCallback)
        {
            if (dialogPage == null)
            {
                dialogPage = Resources.Load <TextAsset>("Browser/Dialogs").text;
            }


            var go      = new GameObject("Browser Dialog for " + parent.name);
            var handler = go.AddComponent <DialogHandler>();

            handler.parentBrowser  = parent;
            handler.dialogCallback = dialogCallback;


            var db = handler.dialogBrowser = handler.GetComponent <Browser>();

            db.UIHandler          = parent.UIHandler;
            db.EnableRendering    = false;
            db.EnableInput        = false;
            db.allowContextMenuOn = BrowserNative.ContextMenuOrigin.Editable;
            //Use the parent texture. Except, we don't actually use it. So
            //mostly we just mimic the size and don't consume more texture memory.
            db.Resize(parent.Texture);
            db.LoadHTML(dialogPage, "about:dialog");
            db.UIHandler = parent.UIHandler;

            db.RegisterFunction("reportDialogResult", args => {
                dialogCallback(args[0], args[1], args[3]);
                handler.Hide();
            });
            db.RegisterFunction("reportContextMenuResult", args => {
                contextCallback(args[0]);
                handler.Hide();
            });

            return(handler);
        }
예제 #14
0
파일: DialogWindow.cs 프로젝트: nqnq/pa22
    public void showDialog(DialogType dialogType, string message, DialogCallback callback)
    {
        GameGlobals.Instance.audioController.playSound("UIQuestion", false);

        dialogPanel.SetActive(true);
        this.callback = callback;

        if (dialogType == DialogType.YesNo)
        {
            yesButton.SetActive(true);
            noButton.SetActive(true);
            okButton.SetActive(false);
        }
        else
        {
            yesButton.SetActive(false);
            noButton.SetActive(false);
            okButton.SetActive(true);
        }

        messageText.text = message;
        //scaleTween.ResetToBeginning();
        scaleTween.PlayForward();
    }
예제 #15
0
 public virtual void Init(string title, string message, string[] buttonLabel, DialogCallback callback)
 {
     m_callback = callback;
 }
 private void Complete()
 {
     DialogCallback?.Invoke(true);
     ((ICommand)ControlCommands.Close).Execute(null);
 }
        private void Finish()
        {
            if (string.IsNullOrEmpty(MFPath))
            {
                UtilHelper.ShowAlertDialog(new Model.AlertDialogInterfaceModel {
                    Content = "未选择美服游戏路径"
                });
                return;
            }

            if (!UserType)
            {
                if (string.IsNullOrEmpty(PickUsername) || PickUsername.Equals(pickUserPlaceholder))
                {
                    UtilHelper.ShowAlertDialog(new Model.AlertDialogInterfaceModel {
                        Content = "请选择用户或新建用户"
                    });
                    return;
                }
            }
            else
            {
                if (string.IsNullOrEmpty(NewUsername))
                {
                    UtilHelper.ShowAlertDialog(new Model.AlertDialogInterfaceModel {
                        Content = "请输入新用户名"
                    });
                    return;
                }

                if (AllUsernameList.IndexOf(NewUsername) != -1)
                {
                    UtilHelper.ShowAlertDialog(new Model.AlertDialogInterfaceModel {
                        Content = "用户名已存在,或者是系统保留用户名"
                    });
                    return;
                }
            }

            if (string.IsNullOrEmpty(Password))
            {
                UtilHelper.ShowAlertDialog(new Model.AlertDialogInterfaceModel {
                    Content = "请输入密码"
                });
                return;
            }

            if (!UserType)
            {
                if (UtilHelper.VerifySystemUser(PickUsername, Password))
                {
                    try
                    {
                        UtilHelper.CheckSystemUserFolderAndCreate(PickUsername, Password);
                    }
                    catch (Exception e)
                    {
                        UtilHelper.ShowAlertDialog(new Model.AlertDialogInterfaceModel {
                            Content = "生成用户文件夹失败:\r\n" + e.Message
                        });
                        return;
                    }

                    _ConfigManager.SaveMFUser(PickUsername, Password);
                }
                else
                {
                    UtilHelper.ShowAlertDialog(new Model.AlertDialogInterfaceModel {
                        Content = "密码不正确"
                    });
                    return;
                }
            }
            else
            {
                try
                {
                    UtilHelper.CreateSystemUser(NewUsername, Password);
                }
                catch (Exception e)
                {
                    UtilHelper.ShowAlertDialog(new Model.AlertDialogInterfaceModel {
                        Content = "创建新用户失败:\r\n" + e.Message
                    });
                    return;
                }

                try
                {
                    UtilHelper.CheckSystemUserFolderAndCreate(NewUsername, Password);
                }
                catch (Exception e)
                {
                    UtilHelper.ShowAlertDialog(new Model.AlertDialogInterfaceModel {
                        Content = "生成用户文件夹失败:\r\n" + e.Message
                    });
                    return;
                }

                _ConfigManager.SaveMFUser(NewUsername, Password);
            }

            _ConfigManager.SaveGamePath(MFPath, "MF");
            DialogCallback?.Invoke(true);
            ((ICommand)ControlCommands.Close).Execute(null);
        }
예제 #18
0
        public void Open(PromptType type, DialogCallback onYes, DialogCallback onNo)
        {
            pType = type;
            if (!GameSystem.Instance.UseEnglishText)
            {
                switch (type)
                {
                case PromptType.DialogEdit:
                    DialogPromptImage.mainTexture = TextureEditJapanese;
                    break;

                case PromptType.DialogExit:
                    DialogPromptImage.mainTexture = TextureExitJapanese;
                    break;

                case PromptType.DialogLoad:
                    DialogPromptImage.mainTexture = TextureLoadJapanese;
                    break;

                case PromptType.DialogSave:
                    DialogPromptImage.mainTexture = TextureSaveJapanese;
                    break;

                case PromptType.DialogTitle:
                    DialogPromptImage.mainTexture = TextureTitleJapanese;
                    break;

                case PromptType.DialogDelete:
                    DialogPromptImage.mainTexture = TextureDeleteJapanese;
                    break;

                case PromptType.DialogLanguage:
                    DialogPromptImage.mainTexture = TextureLanguage;
                    break;
                }
            }
            else
            {
                switch (type)
                {
                case PromptType.DialogEdit:
                    DialogPromptImage.mainTexture = TextureEdit;
                    break;

                case PromptType.DialogExit:
                    DialogPromptImage.mainTexture = TextureExit;
                    break;

                case PromptType.DialogLoad:
                    DialogPromptImage.mainTexture = TextureLoad;
                    break;

                case PromptType.DialogSave:
                    DialogPromptImage.mainTexture = TextureSave;
                    break;

                case PromptType.DialogTitle:
                    DialogPromptImage.mainTexture = TextureTitle;
                    break;

                case PromptType.DialogDelete:
                    DialogPromptImage.mainTexture = TextureDelete;
                    break;

                case PromptType.DialogLanguage:
                    DialogPromptImage.mainTexture = TextureLanguage;
                    break;
                }
            }
            DialogPromptImage.MakePixelPerfect();
            if (type == PromptType.DialogExit || type == PromptType.DialogTitle || type == PromptType.DialogDelete)
            {
                DialogScreenshot.gameObject.SetActive(value: false);
                ButtonYes.transform.localPosition = new Vector3(-56f, -16f, 0f);
                ButtonNo.transform.localPosition  = new Vector3(56f, -16f, 0f);
            }
            if (type != 0 && type != PromptType.DialogSave)
            {
                Object.Destroy(BottomBox.GetComponent <UIInput>());
            }
            TopBox.text    = string.Empty;
            BottomBox.text = string.Empty;
            yesCallback    = onYes;
            noCallback     = onNo;
            if (type == PromptType.DialogLanguage)
            {
                DialogScreenshot.gameObject.SetActive(value: false);
                ButtonYes.transform.localPosition = new Vector3(-56f, -66f, 0f);
                ButtonNo.transform.localPosition  = new Vector3(56f, -66f, 0f);
                ButtonYes.ChangeButtonImages("btn_lang_normal", "btn_lang_hover", "btn_lang_down");
                ButtonNo.ChangeButtonImages("btn_lang_normal_jp", "btn_lang_hover_jp", "btn_lang_down_jp");
            }
            ButtonYes.RegisterController(this);
            ButtonNo.RegisterController(this);
        }
예제 #19
0
 public void Show(string text, DialogCallback callback)
 {
     callback_       = callback;
     DialogText.text = text;
     gameObject.SetActive(true);
 }