Exemple #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);
    }
Exemple #2
0
        public override void Initialize(IDialogContent argument)
        {
            _model = (MenuDialogContentModel)argument;

            foreach (var item in _model.MenuItems)
            {
                var m = item;
                m.Owner = _model.Owner;
                var p = Instantiate(_menuDialogItemPrefab, _container.transform);
                p.OnClickAsObservable().Subscribe(_ =>
                {
                    _model.Owner.Click(m);
                }).AddTo(this);
                p.Initialize(m);
            }
        }