Пример #1
0
        /// <summary>
        /// Generates a static tooltip for a given symbol code.
        /// </summary>
        /// <param name="symbolCode">The symbol code which needs the tooltip.</param>
        /// <returns>A string representing a tooltip.</returns>
        private static string GenerateTooltip(string symbolCode)
        {
            var desc = new StringBuilder(MilAppendix.Description(symbolCode));

            desc.AppendLine("Affiliation: " + StandardIdentity.GetName(symbolCode));
            desc.AppendLine("Condition: " + StatusOperationalCapacity.GetName(symbolCode));
            desc.AppendLine("Order of battle: " + OrderOfBattle.GetName(symbolCode));
            desc.AppendLine("Country: " + Countries.GetName(symbolCode));
            desc.Append("Modifier: " + CombinedModifierCode.GetName(symbolCode));
            return(desc.ToString(0, desc.Length));
        }
Пример #2
0
        /// <summary>
        /// This is the current background color for this particular symbol
        /// </summary>
        /// <param name="symbolCode">The symbol code</param>
        /// <returns>A brush representing the current background color for the symbol code</returns>
        public static Brush FindColorScheme(string symbolCode)
        {
            if (!SymbolData.Check(ref symbolCode))
            {
                return(null);
            }

            if (OrderOfBattle.GetCode(symbolCode) == OrderOfBattle.Civilian)
            {
                if (StandardIdentity.IsColorHostile(symbolCode))
                {
                    return(GetDefault(Reds, ColorScheme));
                }

                return(GetDefault(Purples, ColorScheme));
            }

            switch (StandardIdentity.GetCode(symbolCode))
            {
            case StandardIdentity.AssumedFriend:
            case StandardIdentity.ExerciseFriend:
            case StandardIdentity.Friend:
            case StandardIdentity.ExerciseAssumedFriend:
                return(GetDefault(Blues, ColorScheme));

            case StandardIdentity.Hostile:
            case StandardIdentity.Joker:
            case StandardIdentity.Faker:
            case StandardIdentity.Suspect:
                return(GetDefault(Reds, ColorScheme));

            case StandardIdentity.ExerciseNeutral:
            case StandardIdentity.Neutral:
                return(GetDefault(Greens, ColorScheme));

            case StandardIdentity.ExercisePending:
            case StandardIdentity.Pending:
            case StandardIdentity.Unknown:
            case StandardIdentity.ExerciseUnknown:
                return(GetDefault(Yellows, ColorScheme));

            default:
                return(null);
            }
        }
Пример #3
0
        public void OrderOfBattleTest()
        {
            char gc = OrderOfBattle.GetCode(string.Empty);

            Assert.AreEqual(gc, (char)0);
            gc = OrderOfBattle.GetCode(null);
            Assert.AreEqual(gc, (char)0);
            gc = OrderOfBattle.GetCode("qqqqqqqqqqqqqqq");
            Assert.AreEqual(gc, 'Q');
            string str = OrderOfBattle.GetName(string.Empty);

            Assert.AreEqual(str, string.Empty);
            str = OrderOfBattle.GetName(null);
            Assert.AreEqual(str, string.Empty);
            str = OrderOfBattle.GetName("qqqqqqqqqqqqqqq");
            Assert.AreEqual(str, string.Empty);
            str = OrderOfBattle.GetName("qqpqqqqqqqqqqqn");
            Assert.AreEqual(str, "Maritime");
        }
        public static void SetUp(TestContext context)
        {
            fleet = new OrderOfBattle();

            #region Roster Setup
            roster = new List <OpParticipant>()
            {
                new OpParticipant()
                {
                    isFC    = true,
                    profile = new LiteProfile()
                    {
                        nickname = "Mazer Ludd",
                        rank     = new Rank()
                        {
                            name     = "Captain",
                            abbrev   = "CAPT",
                            ordering = 5
                        },
                        primaryRate = new Rate()
                        {
                            name   = "Skipper",
                            abbrev = "SK",
                            rank   = 2
                        }
                    }
                },
                new OpParticipant()
                {
                    isFC    = false,
                    profile = new LiteProfile()
                    {
                        nickname = "Spaceman Timmy",
                        rank     = new Rank()
                        {
                            name     = "Spacer",
                            abbrev   = "S",
                            ordering = 1
                        },
                        primaryRate = new Rate()
                        {
                            name   = "Quartermaster",
                            abbrev = "QM",
                            rank   = 2
                        }
                    }
                },
                new OpParticipant()
                {
                    isFC    = false,
                    profile = new LiteProfile()
                    {
                        nickname = "Karen Fielding",
                        rank     = new Rank()
                        {
                            name     = "Senior Spacer",
                            abbrev   = "SS",
                            ordering = 2
                        },
                        primaryRate = new Rate()
                        {
                            name   = "Fighter Pilot",
                            abbrev = "FP",
                            rank   = 2
                        }
                    }
                },
                new OpParticipant()
                {
                    isFC    = false,
                    profile = new LiteProfile()
                    {
                        nickname = "Sinai Zaftig",
                        rank     = new Rank()
                        {
                            name     = "Senior Spacer",
                            abbrev   = "SS",
                            ordering = 2
                        },
                        primaryRate = new Rate()
                        {
                            name   = "Fighter Pilot",
                            abbrev = "FP",
                            rank   = 2
                        }
                    }
                }
            };
            #endregion
        }