Exemplo n.º 1
0
 // this function changes the current state of the gameobject
 public void ChangeState(GeneralState newState)
 {
     // check that the current state isnt the new state that its being changed to
     if (currState != newState)
     {
         currState = newState;
     }
 }
Exemplo n.º 2
0
        public IndexModel(PoolControl poolControl, IViewLocalizer localizer)
        {
            this.State              = poolControl.GetPoolControlInformation();
            this.GeneralState       = GeneralState.ConvertFromPoolState(poolControl.GetPoolControlInformation());
            this.TemperatureRunTime = this.State.PoolSettings.TemperatureRunTime.ToArray();
            this.PumpingCycles      = this.State.PoolSettings.WorkingMode == PoolWorkingMode.Summer
                ? this.State.PoolSettings.SummerPumpingCycles
                : this.State.PoolSettings.WinterPumpingCycles;

            var chartOptions = new Highcharts
            {
                Title = new Title
                {
                    Text = ""
                },
                XAxis = new List <XAxis>()
                {
                    new XAxis()
                    {
                        Title = new XAxisTitle()
                        {
                            Text = "°C"
                        }
                    }
                },
                YAxis = new List <YAxis>()
                {
                    new YAxis()
                    {
                        Title = new YAxisTitle()
                        {
                            Text = "h"
                        }
                    }
                },
                Series = new List <Series>()
                {
                    new AreaSeries
                    {
                        Name = "h",
                        Data = this.State.PoolSettings.TemperatureRunTime
                               .Select(d => new AreaSeriesData()
                        {
                            X = d.Temperature, Y = d.RunTimeHours
                        })
                               .ToList(),
                    }
                }
            };

            chartOptions.ID    = "chart";
            this.ChartRenderer = new HighchartsRenderer(chartOptions);
        }
Exemplo n.º 3
0
        public void Toggle()
        {
            switch (State)
            {
            case GeneralState.Off:
                State = GeneralState.On;
                break;

            case GeneralState.On:
                State = GeneralState.Off;
                break;
            }

            PrintState();
        }
        public ActionResult Edit(GeneralStateViewModel model)
        {



            try
            {
                var svc = new GeneralStateAppService();

                var o = new GeneralState
                {
                    GeneralStateId= model.GeneralStateId,
                    Name = model.Name,
                    

                };

                if (model.Action == "-1")
                {
                    var exist = svc.GetGeneralState(model.GeneralStateId)!=null;
                    if (!exist)
                    {
                        svc.AddGeneralState(o);
                        ViewBag.Feed = 0;
                    }
                    else
                    {
                        model.Action = "-1";
                        ViewBag.Feed = 3;
                        return View(model);
                    }
                }
                else
                {
                    o.GeneralStateId= model.GeneralStateId;
                    if (model.IsDeleteAction == 0)
                    {

                        svc.SaveGeneralState(o);
                    }
                    else
                    {
                        svc.RemoveGeneralState(model.GeneralStateId);
                    }
                    ViewBag.Feed = 0;
                }
            }
            catch (Exception)
            {
                ViewBag.Feed = 1;

            }

            return View(model);
        }
Exemplo n.º 5
0
 protected void SetEnemyState(GeneralState newState)
 {
     enemyState.ChangeState(newState);
 }
Exemplo n.º 6
0
 // setting player state, mainly for cleaner code
 void SetPlayerState(GeneralState newState)
 {
     playerState.ChangeState(newState);
 }