Exemple #1
0
        private IEnumerator I_AutoHide(float t)
        {
            yield return(new WaitForSeconds(t));

            Hide();
            UDialogManager.NewTimeOut(Id);
        }
Exemple #2
0
        private void Awake()
        {
            if (_instance != null && _instance != this)
            {
                Destroy(this);
                return;
            }

            _instance = this;

            if (Persistent)
            {
                DontDestroyOnLoad(gameObject);
            }
        }
Exemple #3
0
        internal static void DisplayDialogInternal(string id, string text, ButtonOptions OkOptions = null, ButtonOptions NoOptions = null,
                                                   ButtonOptions CancelOptions = null, DialogType type             = DialogType.Info
                                                   , DialogButtons buttons     = DialogButtons.None, float TimeOut = 0f)
        {
            UDialogManager manager = Instance;

            if (manager.db.ContainsKey(id))
            {
                return;
            }

            UDialogMessage msg = Instantiate(manager.DialogWindowBase, manager.WindowsContainer.transform).
                                 GetComponent <UDialogMessage>();

            Sprite _icon = null;

            switch (type)
            {
            case DialogType.Error:
                _icon = manager.ErrorIcon;
                break;

            case DialogType.Info:
                _icon = manager.InfoIcon;
                break;

            case DialogType.Loading:
                _icon = manager.LoadingIcon;
                break;

            case DialogType.Warning:
                _icon = manager.WarningIcon;
                break;
            }

            msg.Init(id, _icon, type == DialogType.Loading, buttons, text, OkOptions, NoOptions, CancelOptions, TimeOut);

            manager.db.Add(id, msg);

            manager.Background.gameObject.SetActive(true);
        }
Exemple #4
0
        public static void HideDialogWindow(string id)
        {
            UDialogManager manager = Instance;

            if (manager.db.TryGetValue(id, out UDialogMessage msg))
            {
                msg.Kill();

                manager.db.Remove(id);

                if (OnHide != null)
                {
                    OnHide.Invoke();
                }
                manager.OnHideDialog.Invoke();
            }

            if (manager.db.Keys.Count == 0)
            {
                manager.Background.gameObject.SetActive(false);
            }
        }
Exemple #5
0
 public void Hide()
 {
     UDialogManager.HideDialogWindow(Id);
 }