예제 #1
0
 public void GetCountMethod()
 {
     Assert.AreEqual(StringMethod.GetCount("abcabcab", "ab"), 3);
     Assert.Throws <Exception>(() => StringMethod.GetCount("abc", "abccc"));
     Assert.Throws <Exception>(() => StringMethod.GetCount("", ""));
     Assert.Throws <Exception>(() => StringMethod.GetCount("abc", ""));
     Assert.Throws <Exception>(() => StringMethod.GetCount(null, null));
 }
예제 #2
0
        public void TestString()
        {
            StringMethod stringMethod = new StringMethod();

            string value = stringMethod.ReverseString("Hello");

            Assert.AreEqual(value, "olleH");
        }
예제 #3
0
        //as a matter of course, it is probably wise to update your map AFTER your player, but
        //draw your map BEFORE your player.
        //some map elements are based on how the player moves, but you do not want the map drawn OVER the player.

        public override void Draw(SpriteBatch spriteBatch)
        {
            base.Draw(spriteBatch);
            map.Draw(spriteBatch, camera);
            player.Draw(spriteBatch, camera);
            if (map.LivingEnemies > 0)
            {
                //spriteBatch.DrawString(font, "Enemy HP: " + map.CurrentEnemies[0].HP + "/ " + map.CurrentEnemies[0].MaxHP, new Vector2(10, 80), Color.PaleVioletRed);
                //spriteBatch.DrawString(font, "Susp: " + map.CurrentEnemies[0].TotalofAlertPoints, new Vector2(10, 100), Color.PaleVioletRed);
                if (map.CurrentEnemies.Count > 1)
                {
                    //spriteBatch.DrawString(font, "Enemy 2 HP: " + map.CurrentEnemies[1].HP + "/ " + map.CurrentEnemies[1].MaxHP, new Vector2(10, 130), Color.MidnightBlue);
                    //spriteBatch.DrawString(font, "Susp 2 : " + map.CurrentEnemies[1].TotalofAlertPoints, new Vector2(10, 150), Color.MidnightBlue);
                }
            }

            HPBar.Draw(spriteBatch, player.Stats.HP, player.Stats.MaxHP);
            if (map.CurrentEnemies.Count > 0)
            {
                suspicionBar.Draw(spriteBatch, map.CurrentAvgSuspicion);
            }
            int EnemiesKilled = map.NextEnemyIndex - NumOfEnemies;

            spriteBatch.DrawString(font, "Total Enemies Killed: " + EnemiesKilled, new Vector2(10, 80), Color.AliceBlue);
            spriteBatch.DrawString(font, "Block State" + player.BlockStatus, new Vector2(10, 100), Color.Azure);
            if (CurrentQuest != null)
            {
                if (CurrentQuest.CompleteYet)
                {
                    spriteBatch.DrawString(font, "Quest Complete!", new Vector2(10, 450), Color.White);
                }
            }

            //AI Display info, only shown when bool is TRUE as defined at top of screen
            if (EnableAITesting && map.CurrentEnemyTotal > 0)
            {
                suspicionOverlay.Draw(spriteBatch, camera);

                Enemy test = map.CurrentEnemies[map.CurrentEnemies.Keys.ToList().ElementAt(0)];
                spriteBatch.DrawString(font, "Enemy 1 HP: " + test.Stats.HP + "/ " + test.Stats.MaxHP, new Vector2(10, 130), Color.Wheat);
                spriteBatch.DrawString(font, "Current Alert Level: " + test.AlertLevel + ", Current Behaviour: " + test.CurrentBS.getName(), new Vector2(10, 150), Color.Wheat);
                if (test.SawPlayerRecently(player.TilePosition))
                {
                    spriteBatch.DrawString(font, "E1 Can currently see player", new Vector2(10, 170), Color.Wheat);
                }
                else
                {
                    spriteBatch.DrawString(font, "E1: player not in sight", new Vector2(10, 170), Color.Wheat);
                }
                if (test.HaveConfirmedTile)
                {
                    spriteBatch.DrawString(font, "PLAYER CONFIRMED: " + StringMethod.CoordsAsString(test.ConfirmedTile),
                                           new Vector2(10, 190), Color.Red);
                }
            }
        }
예제 #4
0
        internal static void BuilderAppendMeCardName(ref StringBuilder builder, string lastname, string firstname)
        {
            string tempStr = lastname;

            if (!string.IsNullOrWhiteSpace(tempStr))
            {
                builder.Append(StringMethod.MeCardStringRevamp(tempStr));
            }
            builder.Append(',');
            builder.Append(StringMethod.MeCardStringRevamp(firstname));
            builder.Append(';');
        }
예제 #5
0
 public void MimicJoinTest()
 {
     Assert.AreEqual(StringMethod.MimicJoin(
                         StringMethod._character, StringMethod._array),
                     "a-b-c-d");
 }