Exemplo n.º 1
0
 public void Show(IYesNoDialogOwner owner, DialogWindowType type, string label = "label", string description = "description", bool change_effect = true)
 {
     this.m_DialogType                = type;
     this.m_DW.m_LabelText.text       = label;
     this.m_DW.m_DescriptionText.text = description;
     if (type == DialogWindowType.YesNo)
     {
         this.m_DW.m_Button1.gameObject.SetActive(true);
         this.m_DW.m_Button2.gameObject.SetActive(true);
         this.m_DW.m_Button3.gameObject.SetActive(false);
     }
     if (type == DialogWindowType.Ok)
     {
         this.m_DW.m_Button1.gameObject.SetActive(false);
         this.m_DW.m_Button2.gameObject.SetActive(false);
         this.m_DW.m_Button3.gameObject.SetActive(true);
     }
     base.gameObject.SetActive(true);
     this.m_Screen           = owner;
     this.m_MainCanvasObject = GameObject.Find("MainMenuCanvas");
     if (this.m_MainCanvasObject != null)
     {
         this.m_MainCanvas         = this.m_MainCanvasObject.GetComponent <Canvas>();
         this.m_MainCanvas.enabled = false;
     }
     this.m_ChangeEffect = change_effect;
     if (this.m_ChangeEffect)
     {
         PostProcessManager.Get().SetWeight(PostProcessManager.Effect.InGameMenu, 1f);
     }
     if (this.m_Screen is MainMenuScreen)
     {
         Time.timeScale = 0.5f;
     }
 }
Exemplo n.º 2
0
    public void Show(IYesNoDialogOwner owner, DialogWindowType type, string label = "label", string description = "description", bool change_effect = true)
    {
        this.m_DialogType                = type;
        this.m_DW.m_LabelText.text       = label;
        this.m_DW.m_DescriptionText.text = description;
        if (GreenHellGame.IsPadControllerActive())
        {
            this.m_DW.m_Button1.gameObject.SetActive(false);
            this.m_DW.m_Button2.gameObject.SetActive(false);
            this.m_DW.m_Button3.gameObject.SetActive(false);
            if (type == DialogWindowType.YesNo)
            {
                this.m_DW.m_PadButton1.gameObject.SetActive(true);
                this.m_DW.m_PadButton2.gameObject.SetActive(true);
                this.m_DW.m_PadButton3.gameObject.SetActive(false);
            }
            else if (type == DialogWindowType.Ok)
            {
                this.m_DW.m_PadButton1.gameObject.SetActive(false);
                this.m_DW.m_PadButton2.gameObject.SetActive(false);
                this.m_DW.m_PadButton3.gameObject.SetActive(true);
            }
        }
        else
        {
            this.m_DW.m_PadButton1.gameObject.SetActive(false);
            this.m_DW.m_PadButton2.gameObject.SetActive(false);
            this.m_DW.m_PadButton3.gameObject.SetActive(false);
            if (type == DialogWindowType.YesNo)
            {
                this.m_DW.m_Button1.gameObject.SetActive(true);
                this.m_DW.m_Button2.gameObject.SetActive(true);
                this.m_DW.m_Button3.gameObject.SetActive(false);
            }
            else if (type == DialogWindowType.Ok)
            {
                this.m_DW.m_Button1.gameObject.SetActive(false);
                this.m_DW.m_Button2.gameObject.SetActive(false);
                this.m_DW.m_Button3.gameObject.SetActive(true);
            }
        }
        base.gameObject.SetActive(true);
        this.m_Screen = owner;
        this.SetCanvasActive(false);
        this.m_ChangeEffect = change_effect;
        if (this.m_ChangeEffect)
        {
            PostProcessManager.Get().SetWeight(PostProcessManager.Effect.InGameMenu, 1f);
        }
        MenuScreen menuScreen = this.m_Screen as MenuScreen;

        if (menuScreen != null && !menuScreen.m_IsIngame)
        {
            Time.timeScale = 0.5f;
        }
        InputsManager.Get().RegisterReceiver(this);
    }
Exemplo n.º 3
0
        /// <summary>
        /// Отображение диалогового окна
        /// </summary>
        /// <param name="hostWindow">Родительское окно, из которого запускается диалоговое окно</param>
        /// <param name="message">Сообщение в диалоговом окне</param>
        /// <param name="dialogType">тип диалогового окна (информационное, окно выбора)</param>
        /// <returns></returns>
        public static async Task<bool> ShowDialog(String hostWindow, String message, DialogWindowType dialogType)
        {
            var context = new DialogViewModel(message, dialogType);
            var view = new DialogWindow()
            {
                DataContext = context
            };

            var result = (bool)await DialogHost.Show(view, hostWindow);

            return result;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Создание диалогового окна заданного типа с заданным собщением
        /// </summary>
        /// <param name="message">Сообщение</param>
        /// <param name="dialogType">Тип диалогового окна</param>
        public DialogViewModel(String message, DialogWindowType dialogType)
        {
            this.Message = message;

            if (dialogType == DialogWindowType.INFODIALOG)
            {
                SetUpInfoDialog();
            }
            else
            {
                SetUpOptionDialog();
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// Displays a new window to the user with added view model support
 /// </summary>
 /// <param name="dialog">The dialog window to be opened</param>
 /// <param name="viewModel">The view model attached to the dialog</param>
 /// <param name="async">A flag that control if we are openning a dialog or a window</param>
 /// <returns></returns>
 public Task <int> ShowWindow <T>(DialogWindowType dialog, T viewModel, bool async = false)
     where T : BaseDialogViewModel
 {
     switch (dialog)
     {
     default:
         // Show error dialog
         ShowWindow(DialogWindowType.MessageBoxDialog, new MessageBoxViewModel()
         {
             Title   = "Erro",
             Message = "Erro ao tentar abrir uma janela de diálogo não esperada ou não existente.",
         });
         return(new Task <int>(() => 0));
     }
 }