Beispiel #1
0
        public static void Attach(ModalView modalView)
        {
            var window     = ApplicationHelpers.GetMainWindow();
            var firstChild = window.GetLogicalChildren().FirstOrDefault();

            if (firstChild is Grid grid)
            {
                _reserved = false;
                grid.Children.Add(modalView);

                return;
            }

            if (_grid == null)
            {
                _grid = new Grid();
            }

            window.Content = null;

            _reserved = true;
            _grid.Children.Add((IControl)firstChild);
            _grid.Children.Add(modalView);

            window.Content = _grid;
        }
Beispiel #2
0
 private async void InputString_Executed()
 {
     inputString = await ModalView.InputStringDialogAsync(
         "What is your favorite beer?",
         "Trappist"
         );
 }
Beispiel #3
0
 public async void InputText_Click(object sender, RoutedEventArgs e)
 {
     var bananas = await ModalView.InputTextDialogAsync(
         "Dinges",
         "Danges"
         );
 }
Beispiel #4
0
        public override GameObject CreateObject(Transform parent)
        {
            ModalView yoinkFromView = Resources.FindObjectsOfTypeAll <ModalView>().First(x => x.name == "DropdownTableView");
            ModalView modalView     = GameObject.Instantiate(yoinkFromView, parent);

            modalView.SetField("_presentPanelAnimations", yoinkFromView.GetField <PanelAnimationSO, ModalView>("_presentPanelAnimations"));
            modalView.SetField("_dismissPanelAnimation", yoinkFromView.GetField <PanelAnimationSO, ModalView>("_dismissPanelAnimation"));
            modalView.SetField("_container", BeatSaberUI.DiContainer);
            modalView.GetComponent <VRGraphicRaycaster>().SetField("_physicsRaycaster", BeatSaberUI.PhysicsRaycasterWithCache);

            GameObject.Destroy(modalView.GetComponent <TableView>());
            GameObject.Destroy(modalView.GetComponent <TableViewScroller>());
            GameObject.Destroy(modalView.GetComponent <ScrollRect>());

            foreach (RectTransform child in modalView.transform)
            {
                if (child.name == "BG")
                {
                    child.anchoredPosition = Vector2.zero;
                    child.sizeDelta        = Vector2.zero;
                }
                else
                {
                    GameObject.Destroy(child.gameObject);
                }
            }

            RectTransform rectTransform = modalView.transform as RectTransform;

            rectTransform.anchorMin = new Vector2(0.5f, 0.5f);
            rectTransform.anchorMax = new Vector2(0.5f, 0.5f);
            rectTransform.sizeDelta = new Vector2(0, 0);

            return(modalView.gameObject);
        }
        private async void MessageBox_Click(object sender, RoutedEventArgs e)
        {
            Debug.WriteLine("Message Dialog will be opened.");

            await ModalView.MessageDialogAsync("Ready to go?", "Place a cat, a flask of poison, and a radioactive source in a sealed box.", "Got it");

            Debug.WriteLine("Message Dialog was closed.");
        }
Beispiel #6
0
 private async void Confirmation_Executed()
 {
     confirmed = await ModalView.ConfirmationDialogAsync(
         "What's the status of Schrödinger's cat?",
         "Alive",
         "Dead",
         "Both"
         );
 }
Beispiel #7
0
        public async void InputText_Click(object sender, RoutedEventArgs e)
        {
            Debug.WriteLine("Opening Text Input Dialog.");
            var inputText = await ModalView.InputTextDialogAsync(
                "What whas your point actually?",
                "I just wanted to criticize the existing view of quantum mechanics by explaining how one could, in principle, create a superposition in a large-scale system by making it dependent on a quantum particle that was in a superposition, and end up in an ridiculous state.\n\nAnd I hate cats anyway..."
                );

            Debug.WriteLine(string.Format("Text Input Dialog was closed with {0}.", inputText));
        }
        /// <summary>
        /// Установить всем
        /// </summary>
        public void SetAll()
        {
            MassiveSetViewModel model  = new MassiveSetViewModel(Properties);
            ModalView           window = new ModalView {
                DataContext = model
            };

            if (window.ShowDialog() == true)
            {
            }
        }
Beispiel #9
0
        public ModalViewSettings RegisterModalView(ModalView modalView)
        {
            var settings = new ModalViewSettings {
                TopOffset = topOffset, ZIndex = zIndex
            };

            zIndex    += zIndexIncrement;
            topOffset += topOffsetIncrement;

            return(settings);
        }
Beispiel #10
0
        private async void Confirmation2Buttons_Executed()
        {
            Debug.WriteLine("2-State Confirmation Dialog will be opened.");
            confirmed = await ModalView.ConfirmationDialogAsync(
                "Are you planning to open the box?",
                "Sure",
                "No, thanks"
                );

            Debug.WriteLine("2-State Confirmation Dialog was closed with {0}.", confirmed);
        }
        /// <summary>
        /// Добавить таблицу
        /// </summary>
        public void AddGrid()
        {
            ModalView     window         = new ModalView();
            GridViewModel panelViewModel = new GridViewModel(_rootPanel);

            window.DataContext = panelViewModel;
            if (window.ShowDialog() == true)
            {
                _rootPanel.Children.Add(panelViewModel);
            }
        }
        /// <summary>
        /// Добавить свойство
        /// </summary>
        public void AddProperty()
        {
            ModalView      window = new ModalView();
            ModalViewModel model  = new ModalViewModel(_rootPanel);

            window.DataContext = model;
            if (window.ShowDialog() == true)
            {
                _rootPanel.Children.Add(model);
                NotifyOfPropertyChange(nameof(CanWriteResourses));
            }
        }
Beispiel #13
0
    void Awake()
    {
        modalView     = this.transform.GetComponentInChildren <ModalView>();
        spriteManager = this.transform.GetComponentInChildren <InGameSpriteManager>();

        //Set up event notificaiton
        subject = new Subject();
        models  = new ModelManager(spriteManager);

        RegisterAllController(subject);
        subject.notify(EventFlag.Game.SetUp);
    }
Beispiel #14
0
        private async void InputString_Executed()
        {
            Debug.WriteLine("Opening String Input Dialog.");
            inputString = await ModalView.InputStringDialogAsync(
                "How do you want to call this phenomenon?",
                "Verschränkung",
                "Claim",
                "Forget it"
                );

            Debug.WriteLine(string.Format("String Input Dialog was closed with {0}.", inputString));
        }
Beispiel #15
0
        private async void Confirmation3Buttons_Executed()
        {
            Debug.WriteLine("3-State Confirmation Dialog will be opened.");
            confirmed = await ModalView.ConfirmationDialogAsync(
                "So, what's the status of the cat?\nHint: use Quantum Mechanics.",
                "It's alive",
                "It's dead",
                "It's both"
                );

            Debug.WriteLine("3-State Confirmation Dialog was closed with {0}.", confirmed);
        }
        public override GameObject CreateObject(Transform parent)
        {
            GameObject gameObject = new GameObject();

            gameObject.SetActive(false);
            gameObject.name = "BSMLModalView";

            RectTransform rectTransform = gameObject.AddComponent <RectTransform>();

            rectTransform.SetParent(parent, false);
            rectTransform.anchorMin = new Vector2(0.5f, 0.5f);
            rectTransform.anchorMax = new Vector2(0.5f, 0.5f);
            rectTransform.sizeDelta = new Vector2(0, 0);

            ModalView modalView     = gameObject.AddComponent <ModalView>();
            ModalView yoinkFromView = Resources.FindObjectsOfTypeAll <ModalView>().First(x => x.name == "TableView");

            modalView.SetPrivateField("_presentPanelAnimations", yoinkFromView.GetPrivateField <PanelAnimationSO>("_presentPanelAnimations"));
            modalView.SetPrivateField("_dismissPanelAnimation", yoinkFromView.GetPrivateField <PanelAnimationSO>("_dismissPanelAnimation"));

            GameObject child = new GameObject();

            child.transform.SetParent(rectTransform, false);
            child.name = "Shadow";
            RectTransform shadowTransform = child.gameObject.AddComponent <RectTransform>();

            shadowTransform.anchorMin = new Vector2(0, 0);
            shadowTransform.anchorMax = new Vector2(1, 1);
            shadowTransform.sizeDelta = new Vector2(10, 10);
            child.gameObject.AddComponent <Backgroundable>().ApplyBackground("round-rect-panel-shadow");

            child = new GameObject();
            child.transform.SetParent(rectTransform, false);
            child.name = "Content";
            RectTransform backgroundTransform = child.gameObject.AddComponent <RectTransform>();

            backgroundTransform.anchorMin = new Vector2(0, 0);
            backgroundTransform.anchorMax = new Vector2(1, 1);
            backgroundTransform.sizeDelta = new Vector2(0, 0);

            Backgroundable backgroundable = child.gameObject.AddComponent <Backgroundable>();

            backgroundable.ApplyBackground("round-rect-panel");
            backgroundable.background.color    = new Color(0.706f, 0.706f, 0.706f, 1);
            backgroundable.background.material = Resources.FindObjectsOfTypeAll <Material>().First(x => x.name == "UIFogBG");

            ExternalComponents externalComponents = child.AddComponent <ExternalComponents>();

            externalComponents.components.Add(modalView);
            externalComponents.components.Add(rectTransform);

            return(child);
        }
        public void EditProperty()
        {
            if (CurrentProperty == null)
            {
                return;
            }
            ModalView window = new ModalView();

            window.DataContext = CurrentProperty;
            if (window.ShowDialog() == true)
            {
            }
        }
Beispiel #18
0
        public void TestAfterDialog()
        {
            ModalDialogService modalDialogService = new ModalDialogService(new RegionManager(), new Container());

            ModalViewArguments args = new ModalViewArguments {
                Title = "Modal Dialog Title",
                Count = 25
            };

            ModalView view = modalDialogService.Show <ModalView, ModalViewArguments>(args);

            view.Should().NotBeNull();
            view.Title.Should().Be("Modal Dialog Title");
            view.Count.Should().Be(25);
        }
Beispiel #19
0
    public override void Awake()
    {
        base.Awake();
        buttonPrototype.gameObject.SetActive(false);
        instance = this;

        alertViewCanvasGroup.alpha          = 0;
        alertViewCanvasGroup.interactable   = false;
        alertViewCanvasGroup.blocksRaycasts = false;
        alertRect.transform.localScale      = new Vector3(0.01f, 0.01f, 0.01f);
        ViewWillDissappear();
        SetVisible(false);
        ViewDisappeared();

        audioSource = this.GetComponent <AudioSource> ();
    }
Beispiel #20
0
        public ColorModuleViewModel(ILoggingService loggingService, ModalView modalView)
        {
            _loggingService = loggingService;
            _dialogService  = modalView;

            // 'ThemeAwareViewModel'
            _theme = Messenger.Send <ThemeRequestMessage>();
            _loggingService.Log($"ColorModule requested theme and received {_theme.Name}.");
            if (_theme.Name == "Red")
            {
                Color = Colors.Red;
            }
            else
            {
                Color = Colors.Blue;
            }
        }
        private void Parse()
        {
            if (!parsed)
            {
                BSMLParser.instance.Parse(BeatSaberMarkupLanguage.Utilities.GetResourceContent(Assembly.GetExecutingAssembly(), "PlaylistManager.UI.Views.PlaylistDetailsView.bsml"), levelPackDetailViewController.transform.Find("Detail").gameObject, this);
                modalPosition = modalTransform.position;

                ModalView nameKeyboardModal = nameSettingTransform.Find("BSMLModalKeyboard").GetComponent <ModalView>();
                nameKeyboardModal.SetField("_animateParentCanvas", false);

                ModalView authorKeyboardModal = authorSettingTransform.Find("BSMLModalKeyboard").GetComponent <ModalView>();
                authorKeyboardModal.SetField("_animateParentCanvas", false);

                parsed = true;
            }
            modalTransform.position = modalPosition;
        }
Beispiel #22
0
        public static void Detach(ModalView view)
        {
            var window = ApplicationHelpers.GetMainWindow();
            var grid   = (Grid)window.GetLogicalChildren().FirstOrDefault();

            grid?.Children.Remove(view);

            if (!_reserved)
            {
                return;
            }

            var originalChild = grid?.Children.FirstOrDefault();

            // this prevent exception: the control already has visual parent
            grid?.Children.Clear();
            window.Content = originalChild;
        }
Beispiel #23
0
        static void Postfix(ModalView __instance, GameObject ____blockerGO)
        {
            var cb = ____blockerGO.GetComponent <Canvas>();

            var h = (__instance.transform.parent.GetComponentInParent <HMUI.Screen>()
                     ?.GetComponentsInChildren <Canvas>()
                     .Where(x => x.sortingLayerID == cb.sortingLayerID)
                     .Select(x => x.sortingOrder)
                     .DefaultIfEmpty(0)
                     .Max() ?? 0) + 1;

            cb.overrideSorting = true;
            cb.sortingOrder    = h;

            cb = __instance.GetComponent <Canvas>();
            cb.overrideSorting = true;
            cb.sortingOrder    = h + 1;
        }
Beispiel #24
0
        private void Parse(Transform parent)
        {
            if (!parsed)
            {
                BSMLParser.instance.Parse(Utilities.GetResourceContent(Assembly.GetExecutingAssembly(), "NiceMiss.UI.hitscoreModal.bsml"), parent.gameObject, this);

                parsed             = true;
                hitscoreColorModal = hitscoreColorSetting.transform.Find("BSMLModalColorPicker").GetComponent <ModalView>();

                SliderButton.Register(GameObject.Instantiate(leftButton), GameObject.Instantiate(rightButton), minSlider, 1);
                SliderButton.Register(GameObject.Instantiate(leftButton), GameObject.Instantiate(rightButton), maxSlider, 1);
                GameObject.Destroy(leftButton.gameObject);
                GameObject.Destroy(rightButton.gameObject);
            }
            FieldAccessor <ModalView, bool> .Set(ref hitscoreColorModal, "_animateParentCanvas", false);

            FieldAccessor <ModalView, bool> .Set(ref modalView, "_animateParentCanvas", true);
        }
        void ReleaseDesignerOutlets()
        {
            if (CancelButton != null)
            {
                CancelButton.Dispose();
                CancelButton = null;
            }

            if (ConfidenceTextField != null)
            {
                ConfidenceTextField.Dispose();
                ConfidenceTextField = null;
            }

            if (EditTitle != null)
            {
                EditTitle.Dispose();
                EditTitle = null;
            }

            if (LabelStaticText != null)
            {
                LabelStaticText.Dispose();
                LabelStaticText = null;
            }

            if (LabelTextField != null)
            {
                LabelTextField.Dispose();
                LabelTextField = null;
            }

            if (ModalView != null)
            {
                ModalView.Dispose();
                ModalView = null;
            }

            if (OkButton != null)
            {
                OkButton.Dispose();
                OkButton = null;
            }
        }
Beispiel #26
0
        /// <summary>
        /// Получить скрипт для редактирования
        /// </summary>
        public void GetPageScript(string param)
        {
            bool           isEdit = param == "e";
            ModalView      window = new ModalView();
            RolesViewModel model  = new RolesViewModel {
                Roles = _dal.GetGlobalRoles()
            };

            window.DataContext = model;
            if (window.ShowDialog() == true)
            {
                ScriptConstructorHelper helper = new ScriptConstructorHelper {
                    Visability = 3
                };
                helper.Constructor(_constructorViewModel.Properties, isEdit, CurrentMenuPageView.Id, model.SelectRoles.Select(i => i.Id));
                Clipboard.SetText(helper.ToString());
                _aggregator.PublishOnUIThread("[Инфо]:Скопированно в буфер");
            }
        }
        public override GameObject CreateObject(Transform parent)
        {
            if (modalViewTemplate == null)
            {
                modalViewTemplate = Resources.FindObjectsOfTypeAll <ModalView>().First(x => x.name == "DropdownTableView");
            }
            ModalView modalView = Object.Instantiate(modalViewTemplate, parent);

            modalView.SetField("_presentPanelAnimations", modalViewTemplate.GetField <PanelAnimationSO, ModalView>("_presentPanelAnimations"));
            modalView.SetField("_dismissPanelAnimation", modalViewTemplate.GetField <PanelAnimationSO, ModalView>("_dismissPanelAnimation"));
            modalView.SetField("_container", BeatSaberUI.DiContainer);
            modalView.GetComponent <VRGraphicRaycaster>().SetField("_physicsRaycaster", BeatSaberUI.PhysicsRaycasterWithCache);

            Object.DestroyImmediate(modalView.GetComponent <TableView>());
            Object.DestroyImmediate(modalView.GetComponent <ScrollRect>());
            Object.DestroyImmediate(modalView.GetComponent <ScrollView>());
            Object.DestroyImmediate(modalView.GetComponent <EventSystemListener>());
            //GameObject.DestroyImmediate(modalView.GetComponent<Touchable>());
            //modalView.gameObject.AddComponent<CurvedCanvasSettings>();
            //modalView.gameObject.AddComponent<EventSystemListener>();

            foreach (RectTransform child in modalView.transform)
            {
                if (child.name == "BG")
                {
                    child.anchoredPosition = Vector2.zero;
                    child.sizeDelta        = Vector2.zero;
                }
                else
                {
                    Object.Destroy(child.gameObject);
                }
            }

            RectTransform rectTransform = modalView.transform as RectTransform;

            rectTransform.anchorMin = new Vector2(0.5f, 0.5f);
            rectTransform.anchorMax = new Vector2(0.5f, 0.5f);
            rectTransform.sizeDelta = new Vector2(0, 0);

            return(modalView.gameObject);
        }
        public override void HandleType(ComponentTypeWithData componentType, BSMLParserParams parserParams)
        {
            try
            {
                ModalView modalView      = componentType.component as ModalView;
                Transform originalParent = modalView.transform.parent;
                bool      moveToCenter   = true;
                if (componentType.data.TryGetValue("moveToCenter", out string moveToCenterString))
                {
                    moveToCenter = bool.Parse(moveToCenterString);
                }

                if (componentType.data.TryGetValue("showEvent", out string showEvent))
                {
                    parserParams.AddEvent(showEvent, delegate
                    {
                        modalView.Show(true, moveToCenter);
                    });
                }

                if (componentType.data.TryGetValue("hideEvent", out string hideEvent))
                {
                    parserParams.AddEvent(hideEvent, delegate
                    {
                        modalView.Hide(true, () => modalView.transform.SetParent(originalParent, true));
                    });
                }

                if (componentType.data.TryGetValue("clickOffCloses", out string clickOffCloses) && Parse.Bool(clickOffCloses))
                {
                    modalView._blockerClickedEvent += delegate
                    {
                        modalView.Hide(true, () => modalView.transform.SetParent(originalParent, true));
                    };
                }
            }
            catch (Exception ex)
            {
                Logger.log?.Error(ex);
            }
        }
Beispiel #29
0
 /// <summary>
 /// Получить скрипт для редактирования
 /// </summary>
 public void GetPageScript(string param)
 {
     bool isEdit = param == "e";
     ModalView window = new ModalView();
     RolesViewModel model = new RolesViewModel { Roles = _dal.GetGlobalRoles() };
     window.DataContext = model;
     if (window.ShowDialog() == true)
     {
         ScriptConstructorHelper helper = new ScriptConstructorHelper { Visability = 3 };
         helper.Constructor(_constructorViewModel.Properties, isEdit, CurrentMenuPageView.Id, model.SelectRoles.Select(i => i.Id));
         Clipboard.SetText(helper.ToString());
         _aggregator.PublishOnUIThread("[Инфо]:Скопированно в буфер");
     }
 }
 /// <summary>
 /// Добавить панель
 /// </summary>
 public void AddPanel()
 {
     ModalView window = new ModalView();
     PanelViewModel panelViewModel = new PanelViewModel(_rootPanel);
     window.DataContext = panelViewModel;
     if (window.ShowDialog() == true)
     {
         _rootPanel.Children.Add(panelViewModel);
     }
 }
 public void EditProperty()
 {
     if (CurrentProperty == null)
         return;
     ModalView window = new ModalView();
     window.DataContext = CurrentProperty;
     if (window.ShowDialog() == true)
     {
     }
 }
 /// <summary>
 /// Установить всем
 /// </summary>
 public void SetAll()
 {
     MassiveSetViewModel model = new MassiveSetViewModel(Properties);
     ModalView window = new ModalView { DataContext = model };
     if (window.ShowDialog() == true)
     {
     }
 }
Beispiel #33
0
 public void UnRegisterModalView(ModalView modalView)
 {
     zIndex    -= zIndexIncrement;
     topOffset -= topOffsetIncrement;
 }
 private async void MessageBox_Click(object sender, RoutedEventArgs e)
 {
     await ModalView.MessageDialogAsync("There is no WIFI.", "Try again later", "Got it");
 }
 /// <summary>
 /// Добавить свойство
 /// </summary>
 public void AddProperty()
 {
     ModalView window = new ModalView();
     ModalViewModel model = new ModalViewModel(_rootPanel);
     window.DataContext = model;
     if (window.ShowDialog() == true)
     {
         _rootPanel.Children.Add(model);
         NotifyOfPropertyChange(nameof(CanWriteResourses));
     }
 }