void Awake() { m_DisposeOnDestroy.Add(m_ToolBarEnabledSelector = UISelectorFactory.createSelector <bool>(UIStateContext.current, nameof(IToolBarDataProvider.toolbarsEnabled))); m_DisposeOnDestroy.Add(m_CurrentARInstructionUISelector = UISelectorFactory.createSelector <IARInstructionUI>(ARContext.current, nameof(IARModeDataProvider.currentARInstructionUI))); m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <bool>(ARToolStateContext.current, nameof(IARToolStatePropertiesDataProvider.previousStepEnabled), data => { m_BackButton.button.interactable = m_ToolBarEnabledSelector.GetValue() && data; CheckButtonValidations(); })); m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <SetARToolStateAction.IUIButtonValidator>(ARToolStateContext.current, nameof(IARToolStatePropertiesDataProvider.okButtonValidator), data => { m_Validator = data; CheckButtonValidations(); })); m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <SetOrbitTypeAction.OrbitType>(ToolStateContext.current, nameof(IToolStateDataProvider.orbitType))); m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <OpenDialogAction.DialogType>(UIStateContext.current, nameof(IDialogDataProvider.activeDialog))); ProjectContext.current.stateChanged += OnProjectStateDataChanged; m_OkButton.buttonClicked += OnOkButtonClicked; m_BackButton.buttonClicked += OnBackButtonClicked; }
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(); })); }
public ARToolStateData(bool selectionEnabled, bool navigationEnabled, bool previousStepEnabled, bool okEnabled, bool cancelEnabled, bool scaleEnabled, bool wallIndicatorsEnabled, bool anchorPointsEnabled, SetARToolStateAction.IUIButtonValidator okButtonValidator, bool arWallIndicatorsEnabled, bool arAnchorPointsEnabled, bool rotateEnabled, bool measureToolEnabled) { this.selectionEnabled = selectionEnabled; this.navigationEnabled = navigationEnabled; this.previousStepEnabled = previousStepEnabled; this.okEnabled = okEnabled; this.cancelEnabled = cancelEnabled; this.scaleEnabled = scaleEnabled; this.wallIndicatorsEnabled = wallIndicatorsEnabled; this.anchorPointsEnabled = anchorPointsEnabled; this.okButtonValidator = okButtonValidator; this.arWallIndicatorsEnabled = arWallIndicatorsEnabled; this.arAnchorPointsEnabled = arAnchorPointsEnabled; this.rotateEnabled = rotateEnabled; this.measureToolEnabled = measureToolEnabled; }