public void StarClassIsParsedCorrectly(string starClass, string expectedBaseClass, StarClass.Kind expectedKind)
        {
            var entry = (StartJump)JsonConvert.DeserializeObject <JournalEntry>($"{{ \"event\":\"StartJump\", \"StarClass\":\"{starClass}\" }}");

            Assert.Equal(starClass, entry.StarClass);

            var kind = StarClass.GetKind(entry.StarClass, out var baseClass);

            Assert.Equal(expectedBaseClass, baseClass);
            Assert.Equal(expectedKind, kind);
        }
示例#2
0
        public static Color GetStarClassColor(string starClass)
        {
            StarClass.GetKind(starClass, out var baseClass);

            if (_baseStarClass.TryGetValue(baseClass, out var res))
            {
                return(res);
            }

            return(Color.Black);
        }
示例#3
0
        public static Color GetStarClassColor(string starClass)
        {
            var kind = StarClass.GetKind(starClass, out var baseClass);

            if (kind != StarClass.Kind.Unknown && _baseStarClass.TryGetValue(baseClass, out var res))
            {
                return(res);
            }

            return(Color.Black);
        }
示例#4
0
        private static HazardLevel GetHazardLevel(string starClass)
        {
            switch (StarClass.GetKind(starClass, out _))
            {
            case StarClass.Kind.MainSequence:
                return(HazardLevel.Low);

            case StarClass.Kind.Neutron:
            case StarClass.Kind.WhiteDwarf:
            case StarClass.Kind.BlackHole:
                return(HazardLevel.High);

            default:
                return(HazardLevel.Medium);
            }
        }