Пример #1
0
        public static Stream GetOtherIcon(OtherIcon otherIcon)
        {
            if (OtherIcons.ContainsKey(otherIcon))
            {
                return(HeroesIconsAssembly.GetManifestResourceStream(OtherIcons[otherIcon]));
            }

            return(null);
        }
        public BitmapImage GetOtherIcon(OtherIcon otherIcon)
        {
            if (OtherIcons.ContainsKey(otherIcon))
            {
                try
                {
                    BitmapImage image = new BitmapImage(OtherIcons[otherIcon]);
                    image.Freeze();

                    return(image);
                }
                catch (IOException)
                {
                    LogMissingImage($"Missing image: {OtherIcons[otherIcon]}");
                    return(null);
                }
            }
            else
            {
                LogReferenceNameNotFound($"Other Icons: {otherIcon}");
                return(null);
            }
        }
Пример #3
0
        public static Rect VesselTypeIcon(VesselType type, OtherIcon icon)
        {
            int         x          = 0;
            int         y          = 0;
            const float symbolSpan = 0.2f;

            if (icon != OtherIcon.None)
            {
                switch (icon)
                {
                case OtherIcon.AP:
                    x = 1;
                    y = 4;
                    break;

                case OtherIcon.PE:
                    x = 0;
                    y = 4;
                    break;

                case OtherIcon.AN:
                    x = 2;
                    y = 4;
                    break;

                case OtherIcon.DN:
                    x = 3;
                    y = 4;
                    break;

                case OtherIcon.NODE:
                    x = 2;
                    y = 1;
                    break;

                case OtherIcon.SHIPATINTERCEPT:
                    x = 0;
                    y = 1;
                    break;

                case OtherIcon.TGTATINTERCEPT:
                    x = 1;
                    y = 1;
                    break;

                case OtherIcon.ENTERSOI:
                    x = 0;
                    y = 2;
                    break;

                case OtherIcon.EXITSOI:
                    x = 1;
                    y = 2;
                    break;

                case OtherIcon.PLANET:
                    // Not sure if it is (2,3) or (3,2) - both are round
                    x = 2;
                    y = 3;
                    break;
                }
            }
            else
            {
                switch (type)
                {
                case VesselType.Base:
                    x = 2;
                    y = 0;
                    break;

                case VesselType.Debris:
                    x = 1;
                    y = 3;
                    break;

                case VesselType.EVA:
                    x = 2;
                    y = 2;
                    break;

                case VesselType.Flag:
                    x = 4;
                    y = 0;
                    break;

                case VesselType.Lander:
                    x = 3;
                    y = 0;
                    break;

                case VesselType.Probe:
                    x = 1;
                    y = 0;
                    break;

                case VesselType.Rover:
                    x = 0;
                    y = 0;
                    break;

                case VesselType.Ship:
                    x = 0;
                    y = 3;
                    break;

                case VesselType.Station:
                    x = 3;
                    y = 1;
                    break;

                case VesselType.Unknown:
                    x = 3;
                    y = 3;
                    break;

                case VesselType.SpaceObject:
                    x = 4;
                    y = 1;
                    break;

                default:
                    x = 3;
                    y = 2;
                    break;
                }
            }
            var result = new Rect();

            result.x      = symbolSpan * x;
            result.y      = symbolSpan * y;
            result.height = result.width = symbolSpan;
            return(result);
        }
Пример #4
0
 Stream IHeroesIconsService.GetOtherIcon(OtherIcon otherIcon) => GetOtherIcon(otherIcon);
Пример #5
0
				public static Rect VesselTypeIcon(VesselType type, OtherIcon icon)
				{
						int x = 0;
						int y = 0;
						const float symbolSpan = 0.2f;
						if (icon != OtherIcon.None) {
								switch (icon) {
								case OtherIcon.AP:
										x = 1;
										y = 4;
										break;
								case OtherIcon.PE:
										x = 0;
										y = 4;
										break;
								case OtherIcon.AN:
										x = 2;
										y = 4;
										break;
								case OtherIcon.DN:
										x = 3;
										y = 4;
										break;
								case OtherIcon.NODE:
										x = 2;
										y = 1;
										break;
								case OtherIcon.SHIPATINTERCEPT:
										x = 0;
										y = 1;
										break;
								case OtherIcon.TGTATINTERCEPT:
										x = 1;
										y = 1;
										break;
								case OtherIcon.ENTERSOI:
										x = 0;
										y = 2;
										break;
								case OtherIcon.EXITSOI:
										x = 1;
										y = 2;
										break;
								case OtherIcon.PLANET:
										// Not sure if it is (2,3) or (3,2) - both are round
										x = 2;
										y = 3;
										break;
								}
						} else {
								switch (type) {
								case VesselType.Base:
										x = 2;
										y = 0;
										break;
								case VesselType.Debris:
										x = 1;
										y = 3;
										break;
								case VesselType.EVA:
										x = 2;
										y = 2;
										break;
								case VesselType.Flag:
										x = 4;
										y = 0;
										break;
								case VesselType.Lander:
										x = 3;
										y = 0;
										break;
								case VesselType.Probe:
										x = 1;
										y = 0;
										break;
								case VesselType.Rover:
										x = 0;
										y = 0;
										break;
								case VesselType.Ship:
										x = 0;
										y = 3;
										break;
								case VesselType.Station:
										x = 3;
										y = 1;
										break;
								case VesselType.Unknown:
										x = 3;
										y = 3;
										break;
								case VesselType.SpaceObject:
										x = 4;
										y = 1;
										break;
								default:
										x = 3;
										y = 2;
										break;
								}
						}
						var result = new Rect();
						result.x = symbolSpan * x;
						result.y = symbolSpan * y;
						result.height = result.width = symbolSpan;
						return result;
				}