Esempio n. 1
0
        public async Task <IActionResult> UseXmasEffect(EffectsConfig config)
        {
            if (ModelState.IsValid)
            {
                await _backgroundService.StartEffect(config.XmasEffectConfig, new XmasHandler(config.XmasEffectConfig, _loggerFactory, _hueClient));

                return(RedirectToAction("Index"));
            }
            return(View("Index", config));
        }
Esempio n. 2
0
        public async Task <IActionResult> UseWarmupEffect(EffectsConfig config)
        {
            if (ModelState.IsValid)
            {
                config.WarmupEffectConfig.TurnOnAt.Location  = _options.Location; // TODO: It would be nice to have this injected into TimeConfig
                config.WarmupEffectConfig.TurnOffAt.Location = _options.Location;
                await _backgroundService.StartEffect(config.WarmupEffectConfig, new WarmupHandler(config.WarmupEffectConfig, _loggerFactory, _hueClient));

                return(RedirectToAction("Index"));
            }
            return(View("Index", config));
        }
Esempio n. 3
0
    private void Start()
    {
        config = Resources.Load <EffectsConfig>("EffectsConfig");
        var names = config.Effects;

        foreach (var objName in names)
        {
            var btn = Instantiate(baseButton, baseButton.transform.parent);
            btn.Setup(objName, OnEffectButton);
        }

        baseButton.Setup("Random", OnRandomEffectButton);
    }
Esempio n. 4
0
        public async Task <IActionResult> Index()
        {
            var model = new EffectsConfig
            {
                LightGroups        = await _hueClient.GetGroupsAsync(),
                SunPhases          = TimeConfig.GetSunPhases(_options.Location),
                XmasEffectConfig   = await _storageService.LoadConfig <XmasEffectConfig>(),
                WarmupEffectConfig = await _storageService.LoadConfig <WarmupEffectConfig>()
            };

            model.XmasEffectConfig.Active               = _backgroundService.ActiveHandler != null && _backgroundService.ActiveHandler.GetType() == typeof(XmasHandler);
            model.WarmupEffectConfig.Active             = _backgroundService.ActiveHandler != null && _backgroundService.ActiveHandler.GetType() == typeof(WarmupHandler);
            model.WarmupEffectConfig.TurnOnAt.Location  = _options.Location; // TODO: It would be nice to have this injected into TimeConfig
            model.WarmupEffectConfig.TurnOffAt.Location = _options.Location;

            return(View(model));
        }
Esempio n. 5
0
 public static void Init()
 {
     TouchEffect.Init();
     Commands.Init();
     EffectsConfig.Init();
 }
 private void Awake()
 {
     instance = this;
 }