示例#1
0
    void Start()
    {
        _confirmDialogButton.OnClickAsObservable().Subscribe(_ =>
        {
            var dialog       = new ConfirmDialog("Are you ok?", ConfirmDialogSize.Minimum);
            dialog.Stackable = false;
            _dialogRoot.Enqueue(dialog);
        }).AddTo(this);

        _menuDialogButton.OnClickAsObservable().Subscribe(_ =>
        {
            var content = new MenuDialogContentModel();
            content.MenuItems.Add(new MenuDialogItemModel("apple", "Apple"));
            content.MenuItems.Add(new MenuDialogItemModel("banana", "Banana"));
            content.MenuItems.Add(new MenuDialogItemModel("tomato", "Tomato"));

            var dialog = new MenuDialog("Menu", content);
            dialog.OnClickAsObservable().Subscribe(b =>
            {
                _dialogRoot.Enqueue(new ConfirmDialog(b.Name, ConfirmDialogSize.Minimum));
                dialog.Close();
            }).AddTo(this);

            _dialogRoot.Enqueue(dialog);
        }).AddTo(this);

        _stackDialogButton.OnClickAsObservable().Subscribe(_ =>
        {
            n = 0;
            AddDialog(n++, true);
        }).AddTo(this);
    }