Example #1
0
        public void Excute(IContextTarget contextTarget)
        {
            string filePath = CommandKey.Value;

            WebXmlContainer.CreateFile(filePath);
            List <string> dataContext = (List <string>)contextTarget.ContextResult[ECommandLevel.s];

            WebXmlContainer.AppendToFile(filePath, dataContext);
        }
        public void Awake()
        {
            m_Dispatcher = DispatcherFactory.GetDispatcher();

            m_ApplicationContextTarget = ApplicationContext.BindTarget(m_UIApplicationState);
            m_DebugContextTarget       = DebugOptionContext.BindTarget(m_UIDebugState);

            DispatchToken = m_Dispatcher.Register <Payload <IViewerAction> >(InvokeOnDispatch);
        }
        public void Setup(IDispatcher dispatcher)
        {
            m_Dispatcher = dispatcher;
            m_MarkerEditContextTarget            = MarkerEditContext.BindTarget(m_MarkerEdit);
            m_MarkerListContextTarget            = MarkerListContext.BindTarget(m_MarkerList);
            m_MarkerDraggableEditorContextTarget = MarkerDraggableEditorContext.BindTarget(m_MarkerDrag);

            DispatchToken = m_Dispatcher.Register <Payload <IViewerAction> >(InvokeOnDispatchMarkers);

            if (m_NavigationModeUIController == null)
            {
                m_NavigationModeUIController = FindObjectOfType <NavigationModeUIController>();
            }
            if (m_MarkerGraphicManager == null)
            {
                m_MarkerGraphicManager = FindObjectOfType <MarkerGraphicManager>();
            }
            if (m_CardSelectionUIController == null)
            {
                m_CardSelectionUIController = FindObjectOfType <ARCardSelectionUIController>();
            }

            // Configure actions in the controller and edit view
            LinkActions(m_MarkerController);
            LinkActions(ref m_MarkerEdit);
            LinkActions(ref m_MarkerList);

            m_NewMarkerButton.onClick.AddListener(OnCreateMarker);
            if (m_SelectionModeButton)
            {
                m_SelectionModeButton.onControlUp.AddListener(ToggleSelectionMode);
            }
            if (m_ScanQRButton)
            {
                m_ScanQRButton.onControlUp.AddListener(OnScanMarkerButton);
            }

            m_MarkerDialogController.OnEditToggled   += HandleEditToggled;
            m_DraggableMarkerPlacement.OnValueUpdate += OnDragMarkerUpdate;
            m_ARModeSelector         = UISelectorFactory.createSelector <SetARModeAction.ARMode>(ARContext.current, nameof(IARModeDataProvider.arMode), OnARModeChange);
            m_NavigationModeSelector = UISelectorFactory.createSelector <SetNavigationModeAction.NavigationMode>(NavigationContext.current, nameof(INavigationDataProvider.navigationMode));
        }
        /// <summary>
        /// 查找文件中的内容
        /// </summary>
        /// <param name="contextTarget">执行上下文</param>
        public void Excute(IContextTarget contextTarget)
        {
            string          fileContext  = (string)contextTarget.ContextResult[ECommandLevel.f];
            MatchCollection matches      = Regex.Matches(fileContext, CommandKey.Value, RegexOptions.Multiline);
            List <string>   matchContent = new List <string>();

            if (matches.Count > 0)
            {
                foreach (Match match in matches)
                {
                    if (match.Groups.Count > 1)
                    {
                        string lastValue = match.Groups[1].Value;
                        matchContent.Add(lastValue);
                    }
                    else
                    {
                        matchContent.Add(match.Value);
                    }
                }
            }
            contextTarget.ContextResult.Add(ECommandLevel.s, matchContent);
        }
Example #5
0
        private T HasContextTargetChanged <T>(Payload <IViewerAction> viewerAction, IUIContext context, T stateData, IContextTarget contextTarget)
        {
            if (viewerAction.ActionType.RequiresContext(context, viewerAction.Data))
            {
                viewerAction.ActionType.ApplyPayload(viewerAction.Data, ref stateData, () =>
                {
                    contextTarget.UpdateWith(ref stateData);
                    HasChanged = true;
                });
            }

            return(stateData);
        }
Example #6
0
 void CreateContextTarget()
 {
     m_ContextTarget = ContextBase <TContext> .BindTarget(Data);
 }