示例#1
0
        public void BindCommandEngine(CommandEngine engine)
        {
            if (this.engine == engine)
            {
                return;
            }

            if (this.engine != null)
            {
                foreach (var item in settings)
                {
                    this.engine.RemoveCommand(item.Name);
                }
            }

            this.engine = engine;
            if (engine != null)
            {
                foreach (var item in settings)
                {
                    engine.RemoveOption(item.Name);
                    engine.AddOption(item, "Value", item.Name, item.Description);
                }
            }
        }
示例#2
0
        public Box <T> Add <T>(string name, string description = null, T defaultValue = default(T))
        {
            var box     = renderer.Data.Get(name, defaultValue);
            var setting = new Setting <T>()
            {
                Name        = name,
                Description = description,
                Target      = box,
            };

            settings.Add(setting);

            if (engine != null)
            {
                engine.RemoveOption(name);
                engine.AddOption(setting, "Value", name, description);
            }

            return(box);
        }