Exemple #1
0
        void Awake()
        {
            m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <bool>(UIStateContext.current, nameof(IToolBarDataProvider.toolbarsEnabled),
                                                                           data =>
            {
                m_ToolbarsEnabled = data;
            }));

            m_LeftSideBarController = GameObject.FindObjectOfType <LeftSideBarController>();

            m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <bool>(ARToolStateContext.current, nameof(IARToolStatePropertiesDataProvider.scaleEnabled),
                                                                           data =>
            {
                m_ScaleButton.transform.parent.gameObject.SetActive(m_ToolbarsEnabled && data);
                m_LeftSideBarController.UpdateLayout();
            }));

            m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <bool>(ARToolStateContext.current, nameof(IARToolStatePropertiesDataProvider.previousStepEnabled),
                                                                           data =>
            {
                m_BackButton.button.interactable = m_ToolbarsEnabled && data;
            }));


            m_DisposeOnDestroy.Add(m_CurrentARInstructionUIGetter = UISelectorFactory.createSelector <IARInstructionUI>(ARContext.current, nameof(IARModeDataProvider.currentARInstructionUI)));

            m_BackButton.buttonClicked   += OnBackButtonClicked;
            m_ScaleButton.buttonClicked  += OnScaleButtonClicked;
            m_TargetButton.buttonClicked += OnTargetButtonClicked;
        }
        void Awake()
        {
            m_BackButton.buttonClicked   += OnBackButtonClicked;
            m_OkButton.buttonClicked     += OnOkButtonClicked;
            m_CancelButton.buttonClicked += OnCancelButtonClicked;
            m_ScaleButton.buttonClicked  += OnScaleButtonClicked;
            m_LeftSideBarController       = GameObject.FindObjectOfType <LeftSideBarController>();

            m_DisposableSelectors.Add(m_ToolBarEnabledSelector         = UISelectorFactory.createSelector <bool>(UIStateContext.current, nameof(IToolBarDataProvider.toolbarsEnabled)));
            m_DisposableSelectors.Add(m_CurrentARInstructionUISelector = UISelectorFactory.createSelector <IARInstructionUI>(ARContext.current, nameof(IARModeDataProvider.currentARInstructionUI)));

            m_DisposableSelectors.Add(UISelectorFactory.createSelector <bool>(ARToolStateContext.current, nameof(IARToolStatePropertiesDataProvider.previousStepEnabled),
                                                                              data =>
            {
                m_BackButton.button.interactable = m_ToolBarEnabledSelector.GetValue() && data;
            }));

            m_DisposableSelectors.Add(UISelectorFactory.createSelector <bool>(ARToolStateContext.current, nameof(IARToolStatePropertiesDataProvider.okEnabled),
                                                                              data =>
            {
                m_OkButton.button.interactable = m_ToolBarEnabledSelector.GetValue() && data;
                m_OkButton.selected            = m_OkButton.button.interactable;
            }));

            m_DisposableSelectors.Add(UISelectorFactory.createSelector <bool>(ARToolStateContext.current, nameof(IARToolStatePropertiesDataProvider.cancelEnabled),
                                                                              data =>
            {
                m_CancelButton.transform.parent.gameObject.SetActive(m_ToolBarEnabledSelector.GetValue() && data);
                m_LeftSideBarController.UpdateLayout();
            }));

            m_DisposableSelectors.Add(UISelectorFactory.createSelector <bool>(ARToolStateContext.current, nameof(IARToolStatePropertiesDataProvider.scaleEnabled),
                                                                              data =>
            {
                m_ScaleButton.transform.parent.gameObject.SetActive(m_ToolBarEnabledSelector.GetValue() && data);
                m_LeftSideBarController.UpdateLayout();
            }));

            m_DisposableSelectors.Add(UISelectorFactory.createSelector <SetARToolStateAction.IUIButtonValidator>(ARToolStateContext.current, nameof(IARToolStatePropertiesDataProvider.okButtonValidator),
                                                                                                                 data =>
            {
                m_Validator = data;
                CheckButtonValidations();
            }));

            m_DisposableSelectors.Add(UISelectorFactory.createSelector <bool>(ARPlacementContext.current, nameof(IARPlacementDataProvider.validTarget),
                                                                              data =>
            {
                CheckButtonValidations();
            }));
        }