コード例 #1
0
ファイル: DialogService.cs プロジェクト: AliBashaSY/Coddee
        private void OnDialogStateChanged(object sender, DialogState e)
        {
            if (sender is IDialog dialog)
            {
                switch (e)
                {
                case DialogState.Active:
                    if (ActiveDialogs.Contains(dialog))
                    {
                        return;
                    }
                    MinimizedDialogs.RemoveIfExists(dialog);
                    ActiveDialogs.Add(dialog);
                    break;

                case DialogState.Minimized:
                    if (MinimizedDialogs.Contains(dialog))
                    {
                        return;
                    }
                    ActiveDialogs.RemoveIfExists(dialog);
                    MinimizedDialogs.Add(dialog);
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(e), e, null);
                }
                DialogStateChanged?.Invoke(this, dialog);
            }
        }
コード例 #2
0
 public void CloseAllDialogs(bool clearQueue = false)
 {
     ActiveDialogs.ForEach(d => d.Close());
     if (clearQueue)
     {
         _queue.Clear();
     }
 }
コード例 #3
0
ファイル: DialogService.cs プロジェクト: AliBashaSY/Coddee
 private void ContainerClosed(object sender, EventArgs e)
 {
     if (sender is IDialog dialog)
     {
         MinimizedDialogs.RemoveIfExists(dialog);
         ActiveDialogs.RemoveIfExists(dialog);
         DialogClosed?.Invoke(this, dialog);
     }
 }
コード例 #4
0
ファイル: UIDialog.cs プロジェクト: xJayLee/Elarion
        protected override void BeforeOpen(bool skipAnimation)
        {
            base.BeforeOpen(skipAnimation);

            ActiveDialogs.Push(this);

            Canvas.overrideSorting = true;
            Canvas.sortingOrder    = ActiveDialogs.Count;
        }
コード例 #5
0
ファイル: UIDialog.cs プロジェクト: xJayLee/Elarion
        // close/submit dialogs when the scene changes/gets deselected

        // TODO Timeout component (as in graphic settings) - executes an action when the timer expires (also updates a UI element)

        // TODO scene changed event

        /// <summary>
        /// OnBlurred callback. Activate it only on the dialog
        /// </summary>
        protected virtual void OnBlurred()
        {
            if (!IsOpened || ActiveDialogs.Peek() != this)
            {
                return;
            }

            switch (deselectAction)
            {
            case DeselectAction.None:
                break;

            case DeselectAction.Submit:
                Submit();
                break;

            case DeselectAction.Cancel:
                Cancel();
                break;

            default:
                goto case DeselectAction.None;
            }
        }
コード例 #6
0
ファイル: DialogService.cs プロジェクト: AliBashaSY/Coddee
 /// <inheritdoc />
 public IEnumerable <IDialog> GetActiveDialogs()
 {
     return(ActiveDialogs.ToList());
 }
コード例 #7
0
ファイル: UIDialog.cs プロジェクト: xJayLee/Elarion
        protected override void AfterClose()
        {
            ActiveDialogs.Pop();

            Canvas.overrideSorting = false;
        }