Exemple #1
0
        // Token: 0x06015896 RID: 88214 RVA: 0x0057C378 File Offset: 0x0057A578
        public static IEnumerator Show(GameObject parentObj, string prefabPath, string msgText, string okText, string cancelText, Action <DialogBoxResult> onClose)
        {
            GameObject dlgObj = null;

            yield return(ResourceManager.Instance.LoadAsset <GameObject>(prefabPath, delegate(string path, GameObject obj)
            {
                dlgObj = UnityEngine.Object.Instantiate <GameObject>(obj);
            }, false, false));

            dlgObj.transform.SetParent(parentObj.transform, false);
            DialogBox dlg = dlgObj.AddComponent <DialogBox>();

            dlg.Initialize();
            bool            isClose = false;
            DialogBoxResult result  = DialogBoxResult.None;

            dlg.Show(msgText, okText, cancelText, delegate(DialogBoxResult ret)
            {
                isClose = true;
                result  = ret;
            });
            yield return(new WaitUntil(() => isClose));

            dlgObj.transform.SetParent(null);
            UnityEngine.Object.Destroy(dlgObj);
            if (onClose != null)
            {
                onClose(result);
            }
            yield break;
        }
Exemple #2
0
 // Token: 0x0601589C RID: 88220 RVA: 0x0057C5C8 File Offset: 0x0057A7C8
 private void OnClose(DialogBoxResult ret)
 {
     this.m_msgText.text          = string.Empty;
     this.m_okButtonText.text     = string.Empty;
     this.m_cancelButtonText.text = string.Empty;
     this.m_ret = ret;
     Utility.SetUIStateClose(this.m_uiStateController, "Close", new Action(this.OnCloseAnimationFinished), null, true);
 }
Exemple #3
0
 internal void AddButton(string button, DialogBoxResult result)
 {
     pnFooter.Controls.Add(new Label()
     {
         Text = "", Width = 10, Dock = DockStyle.Right
     });                                                                                                 // Separador
     pnFooter.Controls.Add(new DialogBoxButton()
     {
         Text = button, Value = result, Dock = DockStyle.Right, Width = GetButtonWidth(button)
     });
 }
Exemple #4
0
 /// <summary>
 /// Draws the buttons and the text of the DialogBox
 /// </summary>
 /// <param name="windowID"></param>
 private static void DrawWindow(int windowID)
 {
     GUI.Label(new Rect(10, 10, 330, 200), _message);
     if (GUI.Button(new Rect(10, 205, 110, 20), _ok))
     {
         _result = DialogBoxResult.Ok;
     }
     if (GUI.Button(new Rect(130, 205, 110, 20), _cancel))
     {
         _result = DialogBoxResult.Cancel;
     }
 }
 // Token: 0x0600A81A RID: 43034 RVA: 0x002F0344 File Offset: 0x002EE544
 private void SkipDialogDialogBoxCallback(DialogBoxResult r)
 {
     if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_SkipDialogDialogBoxCallbackDialogBoxResult_hotfix != null)
     {
         this.m_SkipDialogDialogBoxCallbackDialogBoxResult_hotfix.call(new object[]
         {
             this,
             r
         });
         return;
     }
     BJLuaObjHelper.IsSkipLuaHotfix = false;
     if (r == DialogBoxResult.Ok)
     {
         this.m_isSkipClose = true;
         this.m_battleDialogUIController.CloseDialog();
     }
 }
Exemple #6
0
 // Token: 0x0600DBB4 RID: 56244 RVA: 0x003B974C File Offset: 0x003B794C
 private void SkipDialogDialogBoxCallback(DialogBoxResult r)
 {
     if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_SkipDialogDialogBoxCallbackDialogBoxResult_hotfix != null)
     {
         this.m_SkipDialogDialogBoxCallbackDialogBoxResult_hotfix.call(new object[]
         {
             this,
             r
         });
         return;
     }
     BJLuaObjHelper.IsSkipLuaHotfix = false;
     if (r == DialogBoxResult.Ok)
     {
         this.m_isSkipClose = true;
         this.m_dialogUIController.CloseDialog();
         CommonUIController.Instance.FadeOut(0.5f, Color.black, null);
     }
 }
Exemple #7
0
        void DialogWindow(int windowID)
        {
            float y = 20;
            float x = 5;

            GUI.Label(new Rect(x, y, windowRect.width, 60), dialogList[0].msg);
            y += 60;

            //并排的3个按钮
            x = 5;
            if (GUI.Button(new Rect(x, y, (windowRect.width - 10) / 3 - 5, 20), "Yes"))
            {
                if (dialogList[0].resultSignal != null)
                {
                    DialogBoxResult dbr = new DialogBoxResult(DialogBoxResult.OperateStyle.Yes);
                    dialogList[0].resultSignal.Dispatch(dbr);
                }
                dialogList.RemoveAt(0);
            }
            x += (windowRect.width - 10) / 3 - 5 + 5;

            if (GUI.Button(new Rect(x, y, (windowRect.width - 10) / 3 - 5, 20), "No"))
            {
                if (dialogList[0].resultSignal != null)
                {
                    DialogBoxResult dbr = new DialogBoxResult(DialogBoxResult.OperateStyle.No);
                    dialogList[0].resultSignal.Dispatch(dbr);
                }
                dialogList.RemoveAt(0);
            }
            x += (windowRect.width - 10) / 3 - 5 + 5;

            if (GUI.Button(new Rect(x, y, (windowRect.width - 10) / 3 - 5, 20), "Cancel"))
            {
                if (dialogList[0].resultSignal != null)
                {
                    DialogBoxResult dbr = new DialogBoxResult(DialogBoxResult.OperateStyle.Cancel);
                    dialogList[0].resultSignal.Dispatch(dbr);
                }
                dialogList.RemoveAt(0);
            }
        }
Exemple #8
0
        private void btn_Click(object sender, EventArgs e)
        {
            if (sender == btn1)
            {
                this.m_result = DialogBoxResult.Button1;
            }
            else if (sender == btn2)
            {
                this.m_result = DialogBoxResult.Button2;
            }
            else if (sender == btn3)
            {
                this.m_result = DialogBoxResult.Button3;
            }

            if (((Button)sender).DialogResult == DialogResult.None)
            {
                this.Close();
            }
        }
Exemple #9
0
 public DialogButton(string text, DialogBoxResult result)
 {
     Text   = text;
     Result = result;
 }
Exemple #10
0
 // Token: 0x0600DC0B RID: 56331 RVA: 0x003BA2E4 File Offset: 0x003B84E4
 public void SkipDialogDialogBoxCallback(DialogBoxResult r)
 {
     this.m_owner.SkipDialogDialogBoxCallback(r);
 }
Exemple #11
0
		private void btn_Click(object sender, EventArgs e)
		{
			if (sender == btn1)
				this.m_result = DialogBoxResult.Button1;
			else if (sender == btn2)
				this.m_result = DialogBoxResult.Button2;
			else if (sender == btn3)
				this.m_result = DialogBoxResult.Button3;

			if (((Button)sender).DialogResult == DialogResult.None)
				this.Close();
		}
Exemple #12
0
 private void SetResultAndClose(DialogBoxResult result)
 {
     Result       = result;
     DialogResult = DialogResult.OK;             // si (FormBorderStyle == FixedDialog) -> Cierra
 }
 private void OnDialogBoxTest(DialogBoxResult lbr)
 {
     Debug.Log("Info: DialogBox result:" + lbr.operateStyle.ToString());
 }
Exemple #14
0
 /// <summary>
 /// resets the values when the DialogBox is closing
 /// </summary>
 private static void Reset()
 {
     _result     = DialogBoxResult.None;
     _windowRect = new Rect((Screen.width - 350f) / 2, (Screen.height - 250f) / 2, 350, 250);
 }
        /// <summary>
        /// Draws the buttons under the settings for loading and saving
        /// </summary>
        /// <param name="posY">the position of the buttons in Y-Direction so that they are not collide with other controls</param>
        private void DrawSettingButtons(float posY)
        {
            posY += 3 * _padding;               //little space between settings and buttons
            if (Settings.HasTemporaryChanges()) //show the buttons just if there are changes
            {
                if (GUI.Button(new Rect(0, posY, _menuSettingWidth * 0.24f, _buttonHeight),
                               "Save all Settings"))
                {
                    _showOverwriteFileDialog = true;
                }

                //Draw the Discard changes Button just if there are changes
                if (GUI.Button(new Rect(_menuSettingWidth * 0.25f, posY, _menuSettingWidth * 0.25f, _buttonHeight),
                               "Discard changes"))
                {
                    Settings.DiscardTemporaryChanges();
                }
            }
            if (_namesList.Count != 0) //show just if a Menuitem is selected
            {
                //save button
                if (GUI.Button(new Rect(_menuSettingWidth * 0.51f, posY, _menuSettingWidth * 0.24f, _buttonHeight),
                               "Save " + _namesList.First() + " under"))
                {
                    Settings.SaveTemporaryChanges(_namesList.First());
                    _outstandingObjectsToSave.Add(_namesList.First());
                }

                //load button
                if (GUI.Button(new Rect(_menuSettingWidth * 0.76f, posY, _menuSettingWidth * 0.24f, _buttonHeight),
                               "Load " + _namesList.First()))
                {
                    _outstandingObjectsToLoad.Add(_namesList.First());
                }
            }

            //before saving all Files
            if (_showOverwriteFileDialog)
            {
                DialogBoxResult result = DialogBox.Show("create new Files?",
                                                        "Do you want to crate new Files or do you want to overwrite the last-used files", "new Files",
                                                        "overwrite");
                if (result == DialogBoxResult.Cancel) //Cancel = overwrite
                {
                    Settings.SaveTemporaryChanges();
                    Settings.SaveAllSettings();
                    _showOverwriteFileDialog = false;
                }
                else if (result == DialogBoxResult.Ok) //Ok = new Files
                {
                    Settings.SaveTemporaryChanges();
                    _outstandingObjectsToSave.AddRange(Settings.GetMenuItems(new string[0]));
                    _showOverwriteFileDialog = false;
                }
            }

            //show a FileSelector for each object that shall be saved
            if (_outstandingObjectsToSave.Count != 0 && !_fileSelectorIsShowed)
            {
                _fileSelectorIsShowed = true;
                if (String.IsNullOrEmpty(_lastUsedDirectory))
                {
                    FileSelector.GetFile(GotFileToSave, ".xml");
                }
                else
                {
                    FileSelector.GetFile(_lastUsedDirectory, GotFileToSave, ".xml");
                }
            }

            //show a FileSelector for each object that shall be loaded
            if (_outstandingObjectsToLoad.Count != 0 && !_fileSelectorIsShowed)
            {
                _fileSelectorIsShowed = true;
                if (String.IsNullOrEmpty(_lastUsedDirectory))
                {
                    FileSelector.GetFile(GotFileToLoad, ".xml");
                }
                else
                {
                    FileSelector.GetFile(_lastUsedDirectory, GotFileToLoad, ".xml");
                }
            }
        }