예제 #1
0
        public BuildFacility(FacilityType facilityType)
        {
            this.facilityType = facilityType;
            var metadata = facilityType.Metadata();

            AddControl(new Border(40, 192, 128, 160, ColorScheme.Blue, Backgrounds.Title, 12));
            AddControl(new Label(50, 202, metadata.Name, Font.Normal, ColorScheme.Blue));
            AddControl(new Label(62, 202, "COST>", Font.Normal, ColorScheme.Blue));
            AddControl(new Label(70, 202, metadata.Cost.FormatNumber(), Font.Large, ColorScheme.White));
            AddControl(new Label(90, 202, "CONSTRUCTION TIME>", Font.Normal, ColorScheme.Blue));
            AddControl(new Label(98, 202, metadata.DaysToConstruct.FormatNumber() + " days", Font.Large, ColorScheme.White));
            AddControl(new Label(118, 202, "MAINTENANCE>", Font.Normal, ColorScheme.Blue));
            AddControl(new Label(126, 202, metadata.Maintenance.FormatNumber(), Font.Large, ColorScheme.White));
            AddControl(new Button(176, 200, 112, 16, "Cancel", ColorScheme.Blue, Font.Normal, OnCancel));
            AddControl(new BaseFacilities(facilityType, OnClickFacility));
        }
예제 #2
0
 private static TopicMetadata Facility(FacilityType facility)
 {
     return new TopicMetadata
     {
         Name = facility.Metadata().Name,
         Category = TopicCategory.BaseFacilities,
         Background = Backgrounds.InfoFacility,
         BackgroundPalette = 1,
         Scheme = ColorScheme.LightWhite,
         RequiredResearch = new[] { facility.Metadata().RequiredResearch }
             .Where(research => research != null)
             .Cast<ResearchType>()
             .ToArray(),
         Subject = facility
     };
 }
예제 #3
0
		private void AddTopicControls(FacilityType facility)
		{
			var metadata = facility.Metadata();
			if (metadata.Shape == FacilityShape.Hangar)
			{
				AddControl(new Picture(18, 233, metadata.Image));
			}
			else
			{
				AddControl(new Picture(31, 249, metadata.Shape.BuildingImage()));
				AddControl(new Picture(30 + metadata.RowOffset, 248 + metadata.ColumnOffset, metadata.Image));
			}
			AddControl(new Label(24, 10, metadata.Name, Font.Large, ColorScheme.Blue));

			var nextTop = 40;
			var stats = new[]
			{
				Tuple.Create("Construction Time", $"{metadata.DaysToConstruct} days"),
				Tuple.Create("Construction Cost", $"${metadata.Cost.FormatNumber()}"),
				Tuple.Create("Maintenance Cost", $"${metadata.Maintenance.FormatNumber()}"),
				Tuple.Create("Defense Value", metadata.DefenseValue == 0 ? null : metadata.DefenseValue.FormatNumber()),
				Tuple.Create("Hit Ratio", metadata.HitRatio == 0 ? null : $"{metadata.HitRatio}\t%")
			};
			foreach (var stat in stats.Where(stat => stat.Item2 != null))
			{
				var top = nextTop;
				nextTop += 10;
				AddControl(new ExtendedLabel(top, 10, 140, stat.Item1, Font.Normal, ColorScheme.Blue));
				AddControl(new Label(top, 150, stat.Item2, Font.Normal, ColorScheme.White));
			}

			nextTop = 104;
			foreach (var descriptionLine in metadata.DescriptionLines)
			{
				var top = nextTop;
				nextTop += 8;
				AddControl(new Label(top, 10, descriptionLine, Font.Normal, ColorScheme.Blue));
			}
		}