Esempio n. 1
0
    float updateRate = 4.0f; //4 updates per sec

    // Use OnEnable rather than Start() to make sure initialization happends every new cycle
    void OnEnable()
    {
        //if text asset is empty throw error and disable object
        if (textAsset == null)
        {
            Debug.LogError("Error: Text asset is empty can not load any commands");
            this.gameObject.SetActive(false);
        }
        else
        {
            //Initialize command variables
            //Get command from text and get commands and size of the commands
            commandList  = CommandExtractor.LoadCommand(textAsset);
            commandsSize = commandList.Count - 1;
            commandIndex = 0;

            //Initialize robot state to default
            robotState = State.INITIALIZE;

            transform.position = Vector3.zero;
            transform.rotation = Quaternion.identity;

            isRotating = false;
            isMoving   = false;
            isWaiting  = false;

            //Initialize to calculate fps
            frameCount = 0;
            dt         = fps = 0.0f;
        }
    }
Esempio n. 2
0
        internal void UnsubscribeToMultiCommandChildrenAutoInvalidationEvents()
        {
            var childMultiCommands = CommandExtractor.MultiGlobalCommands.Where(c => CommandExtractor.GetMultiMenuMetadata <MenuPath>(c).ParentPath == MenuPath);

            foreach (var multiCommand in childMultiCommands)
            {
                multiCommand.OnCommandsComputed -= MultiCommandInvalidationDelegate;
            }
        }
        private void AddQueryToPipeline(IQueryable query)
        {
            var stages = CommandExtractor.ExtractStages <TEntity>(query);

            foreach (var stage in stages)
            {
                AggregateFluent = AggregateFluent.AppendStage(stage);
            }
        }
Esempio n. 4
0
        static void InitTerminal()
        {
            CommandRunner runner = null;

            _terminal = new Terminal.Terminal(Core.Window, Core.Text.DefaultFont, _terminalInput, () => runner, s => string.IsNullOrWhiteSpace(s) ? new List <string>() : _commands.Where(a => a.Name.ToLower().Contains(s.ToLower())).Select(a => a.Name).OrderBy(a => a.Length).ToList());
            var commandExtractor = new CommandExtractor(_logger);

            _commands = commandExtractor.GetAllStaticCommands(Assembly.GetExecutingAssembly());
            runner    = new CommandRunner(_commands);
            sc(.5f, .5f, .2f, .5f);
        }
Esempio n. 5
0
        public IEnumerable <IMainMenuItemViewModel> CreateChildren()
        {
            var children = new List <IMainMenuItemViewModel>();

            var globalCommands       = CommandExtractor.GlobalCommands.Where(c => CommandExtractor.GetMenuMetadata <MenuPath>(c).ParentPath == MenuPath);
            var multiGlobalCommands  = CommandExtractor.MultiGlobalCommands.Where(c => CommandExtractor.GetMultiMenuMetadata <MenuPath>(c).ParentPath == MenuPath);
            var subAbstractMenuPaths = CommandExtractor.AbstractMenuPaths.Where(path => path.ParentPath == MenuPath);
            var panelMenuOptions     = CommandExtractor.StaticPanelDefinitions.Where(def => def.OfType <PanelMenuOption>().Any() && def.OfType <PanelMenuOption>().Single().OfType <MenuPath>().Single().ParentPath == MenuPath);

            var rawChildren = new Dictionary <IMenuEntry, object>();

            globalCommands.ForEach(c => rawChildren.Add(CommandExtractor.GetMenuMetadata <MenuPath>(c), c));
            multiGlobalCommands.ForEach(c => rawChildren.Add(CommandExtractor.GetMultiMenuMetadata <MenuPath>(c), c));
            subAbstractMenuPaths.ForEach(path => rawChildren.Add(path, path));
            panelMenuOptions.ForEach(o => rawChildren.Add(CommandExtractor.GetPanelMenuOptionMetadata <MenuPath>(o), o));

            int categoryIndex        = 0;
            int categoriesCount      = rawChildren.Select(o => o.Key.CategoryIndex).Distinct().Count();
            var childrenByCategories = rawChildren.GroupBy(o => o.Key.CategoryIndex).OrderBy(o => o.Key);

            foreach (var category in childrenByCategories)
            {
                categoryIndex++;
                foreach (var entry in category.OrderBy(o => o.Key.OrderIndex))
                {
                    entry.Value.IfIs((IGlobalCommand c) => children.Add(new MainMenuCommandViewModel(InitializationService, CommandExtractor, c)));

                    entry.Value.IfIs((IMultiGlobalCommand c) =>
                    {
                        var subCommands = c.SubCommands.Where(subCmd => subCmd.Metadata.OfType <SubMainMenuOption>().Any());
                        foreach (var subCommand in subCommands)
                        {
                            children.Add(new MainMenuSubCommandViewModel(InitializationService, CommandExtractor, subCommand));
                        }
                    });

                    entry.Value.IfIs((IStaticPanelDefinition def) => children.Add(new MainMenuPanelEntryViewModel(InitializationService, CommandExtractor, def)));

                    entry.Value.IfIs((AbstractMenuPath p) => children.Add(new MainMenuPathViewModel(InitializationService, CommandExtractor, p)));
                }

                if (categoryIndex < categoriesCount)
                {
                    children.Add(new MainMenuSeparatorViewModel());
                }
            }


            return(children);
        }
 public virtual OptionsModel Build() => new OptionsModel
 (
     Token.Build(),
     CancellationCheckInterval.Build(),
     HttpClient.Build(),
     Proxy.Build(),
     StateFactory.Build(),
     CommandExtractor.Build(),
     AllowedUpdates.Build(),
     Parsers.Build(),
     Converters.Build(),
     DefaultValueProviders.Build(),
     SpecialValueProviders.Build(),
     Linkers.Build(),
     CommandInvoker.Build(),
     ResultProcessors.Build()
 );
 public void SetUp()
 {
     _cache = CommandCache.GetEmptyCache();
     _cache.RegisterAll(new CommandFactory());
     _extractor = new CommandExtractor(_cache);
 }
		/// <summary>
		/// Runs the specified script lines.
		/// </summary>
		/// <param name="lines"></param>
		private void runScript(object lines)
		{
			string[] editorLines = (string[])lines;

			BrowserType browserType = _currentTestBrowserType;

            // CloseBrowsersBeforeTestStart depends on the following 'using' command
			using (CommandExtractor extractor = new CommandExtractor(browserType))
			{
				extractor.CommandProcessed += new CommandExtractor.CommandProcessedHandler(extractor_CommandProcessed);
				this.Invoke(new testStatusDelegate(startTest));
                TestManager.ResetForNewTest();
                if (_parent.GetMainForm.DDEditor.Active)
                     testResults = extractor.ProcessWikiCommands(this.FilePath, editorLines, _currentTestThread, this);
                else
                    extractor.ProcessWikiCommands(editorLines, breakPoints, _currentTestThread, this);
				this.Invoke(new testStatusDelegate(endTest));
			}
		}
 public virtual OptionsModelBuilder SetDefaultCommandExtractor()
 {
     CommandExtractor.Set(DefaultCommandExtractor);
     return(this);
 }