Beispiel #1
0
 public ClientFullColonyStateDataResponse(ColonyModel cm, PlanetTypes planetType, IEnumerable <IStructureModel> structureModels)
 {
     Pages = new ClientColonyPages()
     {
         Overview = new ColonyOverviewPageData(cm, structureModels)
     };
     MetaData = new ColonyMetaData()
     {
         PlanetType = planetType, ColonyName = cm.Name
     };
 }
Beispiel #2
0
        public static bool ClickedOnColony(ColonyModel c1, ColonyModel c2)
        {
            // CHECK IF GIVEN LOCATION IS NOT THE SAME AS LOCATION OF COLONY
            bool clicked = false;

            if (c1.Center.X >= c2.Center.X - c2.Radius && c1.Center.X <= c2.Center.X + c2.Radius)
            {
                if (c1.Center.Y >= c2.Center.Y - c2.Radius && c1.Center.Y <= c2.Center.Y + c2.Radius)
                {
                    clicked = true;
                }
            }
            return(clicked);
        }
Beispiel #3
0
        /// <summary>
        /// Check if the given position is equal to a existing colony.
        /// </summary>
        /// <param name="x">Mouse X position.</param>
        /// <param name="y">Mouse Y position.</param>
        /// <param name="c">Current used ColonyModel</param>
        /// <returns></returns>
        public static bool ClickedOnColony(int x, int y, ColonyModel c)
        {
            // CHECK IF GIVEN LOCATION IS NOT THE SAME AS LOCATION OF COLONY
            bool clicked = false;

            if (x >= c.Center.X - c.Radius && x <= c.Center.X + c.Radius)
            {
                if (y >= c.Center.Y - c.Radius && y <= c.Center.Y + c.Radius)
                {
                    clicked = true;
                }
            }
            return(clicked);
        }
 public static bool ClickedOnColony(ColonyModel c1, ColonyModel c2)
 {
     // CHECK IF GIVEN LOCATION IS NOT THE SAME AS LOCATION OF COLONY
     bool clicked = false;
     if (c1.Center.X >= c2.Center.X - c2.Radius && c1.Center.X <= c2.Center.X + c2.Radius)
     {
         if (c1.Center.Y >= c2.Center.Y - c2.Radius && c1.Center.Y <= c2.Center.Y + c2.Radius)
         {
             clicked = true;
         }
     }
     return clicked;
 }
 /// <summary>
 /// Check if the given position is equal to a existing colony.
 /// </summary>
 /// <param name="x">Mouse X position.</param>
 /// <param name="y">Mouse Y position.</param>
 /// <param name="c">Current used ColonyModel</param>
 /// <returns></returns>
 public static bool ClickedOnColony(int x, int y, ColonyModel c)
 {
     // CHECK IF GIVEN LOCATION IS NOT THE SAME AS LOCATION OF COLONY
     bool clicked = false;
     if (x >= c.Center.X - c.Radius && x <= c.Center.X + c.Radius)
     {
         if (y >= c.Center.Y - c.Radius && y <= c.Center.Y + c.Radius)
         {
             clicked = true;
         }
     }
     return clicked;
 }
        public ColonyOverviewPageData(ColonyModel cm, IEnumerable <IStructureModel> structureModels)
        {
            StatDisplays = new List <StatDisplay>();

            IsEnabled = true;
            Order     = 0;
            PageName  = "Overview";
            PageType  = ColonyPages.Overview;

            ColonyEvents = cm.NewsEvents;

            var indicators = new List <StatusIndicatorData>();

            foreach (var pf in cm.ProblemFlags)
            {
                indicators.Add(new StatusIndicatorData(pf));
            }

            //Population
            StatDisplays.Add(new StatDisplay
            {
                Type         = StatDisplayTypes.Population,
                DisplayName  = "Population",
                CurrentValue = cm.TotalPopulation,
                RateOfChange = cm.PopulationRate,
                MaxValue     = cm.MaxPopulation,
                TimeUnit     = TimeUnits.Hour,
                Tooltip      = "The population of the colony. This indicates the size of the colony."
            });

            //Morale
            StatDisplays.Add(new StatDisplay
            {
                Type         = StatDisplayTypes.Morale,
                DisplayName  = "Morale",
                CurrentValue = cm.MoraleAvg,
                RateOfChange = cm.MoraleRateAvg,
                MaxValue     = -1,
                TimeUnit     = TimeUnits.Hour,
                Tooltip      = "The morale of the colony. This indicates the happiness of the colony."
            });

            //Power
            StatDisplays.Add(new StatDisplay
            {
                Type         = StatDisplayTypes.Power,
                DisplayName  = "Power",
                CurrentValue = cm.PowerInUse,
                RateOfChange = -1,
                MaxValue     = cm.MaxPowerAvailable,
                TimeUnit     = TimeUnits.Hour,
                Tooltip      = "Power generated/consumed"
            });

            //Cash
            StatDisplays.Add(new StatDisplay
            {
                Type         = StatDisplayTypes.Cash,
                DisplayName  = "Ilaanbux",
                CurrentValue = cm.Cash,
                RateOfChange = cm.CashRate * 1000f * 60f * 60f,
                MaxValue     = cm.MaxCash,
                TimeUnit     = TimeUnits.Hour,
                Tooltip      = "The money on the colony. Colonies generate more money with higher taxes."
            });

            //Tax rate
            StatDisplays.Add(new StatDisplay
            {
                Type         = StatDisplayTypes.TaxRate,
                DisplayName  = "Tax Rate",
                CurrentValue = cm.Sliders[SliderTypes.TaxRate].CurrentValue,
                RateOfChange = -1,
                MaxValue     = 100,
                TimeUnit     = TimeUnits.None,
                Tooltip      = "Hard earned money stolen by big gubment fo dem programs"
            });

            Sliders = cm.Sliders.Values;
            WebStructuresOverviewData = new WebStructuresOverviewData(structureModels);
        }
Beispiel #7
0
 public Client_ColonyDataResponse(ColonyModel model)
 {
     Name = model.Name;
 }