public void DefaultParserTest()
        {
            using (TCODFileParser parser = new TCODFileParser())
            {
                AddParserTestStructs(parser);
                parser.Run("exampleConfig.txt");

                Assert.IsTrue(parser.GetIntProperty("item_type.cost") == 300);
                Assert.IsTrue(parser.GetFloatProperty("item_type.weight") == 3.5);
                Assert.IsTrue(parser.GetBoolProperty("item_type.deal_damage") == true);

                TCODDice testDice = new TCODDice(3, 6, 1, 2);
                Assert.IsTrue(parser.GetDiceProperty("item_type.damages") == testDice);

                Color color1 = Color.FromRGB(255, 0, 0);
                Color color2 = Color.FromRGB(128, 96, 96);
                Assert.IsTrue(parser.GetColorProperty("item_type.color") == color1);
                Assert.IsTrue(parser.GetColorProperty("item_type.damaged_color") == color2);
                Assert.IsTrue(parser.GetStringProperty("item_type.damage_type") == "slash");

                //parser.getValueList("list");
                //parser.GetFlag("abstract");
                Assert.IsTrue(parser.GetStringProperty("video.mode") == "800x600");
                Assert.IsTrue(parser.GetBoolProperty("video.fullscreen") == false);
                Assert.IsTrue(parser.GetFloatProperty("input.mouse.sensibility") == .5);
            }
        }
Beispiel #2
0
 /// <summary>
 /// Create Copy of TCODDIce
 /// </summary>
 /// <param name="d">Dice to copy</param>
 public TCODDice(TCODDice d)
 {
     nb_dices   = d.nb_dices;
     nb_faces   = d.nb_faces;
     multiplier = d.multiplier;
     addsub     = d.addsub;
 }
Beispiel #3
0
        /// <summary>
        /// Compare two TCODDice
        /// </summary>
        /// <param name="obj">Other object</param>
        /// <returns>Are Equal?</returns>
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }
            TCODDice rhs = (TCODDice)obj;

            return((nb_dices == rhs.nb_dices) && (nb_faces == rhs.nb_faces) && (multiplier == rhs.multiplier) && (addsub == rhs.addsub));
        }
 /// <summary>
 /// Create Copy of TCODDIce
 /// </summary>
 /// <param name="d">Dice to copy</param>
 public TCODDice(TCODDice d)
 {
     nb_dices = d.nb_dices;
     nb_faces = d.nb_faces;
     multiplier = d.multiplier;
     addsub = d.addsub;
 }