Exemplo n.º 1
0
        public void LoadDirectoryRecursive([Values] BehaviorMode mode)
        {
            Dec.Config.TestParameters = new Dec.Config.UnitTestParameters {
                explicitTypes = new Type[] { typeof(IntDec) }
            };

            var parser = new Dec.Parser();

            parser.AddDirectory("data/Parser.LoadDirectoryRecursive");
            parser.Finish();

            DoBehavior(mode);

            Assert.AreEqual(40, Dec.Database <IntDec> .Get("TestDec1").value);
            Assert.AreEqual(80, Dec.Database <IntDec> .Get("TestDec2").value);
        }
Exemplo n.º 2
0
        public void Integration()
        {
            Directory.SetCurrentDirectory(new DirectoryInfo(TestContext.CurrentContext.TestDirectory).Parent.Parent.Parent.FullName);

            Dec.Config.UsingNamespaces = new string[] { "DecTestIntegration" };

            var parser = new Dec.Parser();

            parser.AddDirectory("data");
            parser.Finish();

            Assert.IsNotNull(Dec.Database <IntegrationDec> .Get("ItemAlpha"));
            Assert.IsNotNull(Dec.Database <IntegrationDec> .Get("ItemBeta"));

            Assert.AreSame(IntegrationDecs.ItemAlpha, Dec.Database <IntegrationDec> .Get("ItemAlpha"));
        }
Exemplo n.º 3
0
        private static void Init()
        {
            // Configure Dec's error reporting
            Dec.Config.InfoHandler      = str => Dbg.Inf(str);
            Dec.Config.WarningHandler   = str => Dbg.Wrn(str);
            Dec.Config.ErrorHandler     = str => Dbg.Err(str);
            Dec.Config.ExceptionHandler = e => Dbg.Ex(e);

            // Configure Dec's namespaces
            Dec.Config.UsingNamespaces = new string[] { "Fuzzgen" };

            // In most cases, you'll just want to read all the XML files in your data directory, which is easy
            var parser = new Dec.Parser();

            parser.AddDirectory("data/dec");
            parser.Finish();
        }
Exemplo n.º 4
0
        public static void Main()
        {
            // Configure Dec's error reporting
            Dec.Config.InfoHandler      = str => Dbg.Inf(str);
            Dec.Config.WarningHandler   = str => Dbg.Wrn(str);
            Dec.Config.ErrorHandler     = str => Dbg.Err(str);
            Dec.Config.ExceptionHandler = e => Dbg.Ex(e);

            // Configure Dec's namespaces
            Dec.Config.UsingNamespaces = new string[] { "Loaf" };

            // In most cases, you'll just want to read all the XML files in your data directory, which is easy
            var parser = new Dec.Parser();

            parser.AddDirectory("data");
            parser.Finish();

            // Everything is now initialized; start the game!
            Game.Run();

            // In most actual games you'd put this code behind a loading screen of some sort.
            // At the moment, dec loading is essentially atomic and without a progress bar; also, nobody has ever written enough dec files to justify a progress bar.
            // Please let the developers know if you need this functionality!
        }