Ejemplo n.º 1
0
        public void HaloWars_AppSaveTest()
        {
            var hw = PhxEngine.CreateForHaloWars(kGameRoot, kUpdateRoot);

            Load(hw);

            using (var s = IO.XmlElementStream.CreateForWrite("Serina", hw))
            {
                s.InitializeAtRootElement();
                s.StreamMode = FA.Write;

                hw.Database.Serialize(s);

                var xw_settings = new System.Xml.XmlWriterSettings();
                xw_settings.Indent       = true;
                xw_settings.IndentChars  = "\t";
                xw_settings.NewLineChars = "\n";
                string output_path = System.IO.Path.Combine(TestContext.TestResultsDirectory, "Serina.xml");
                Console.WriteLine("Saving to: {0}", output_path);
                using (var xw = System.Xml.XmlWriter.Create(output_path, xw_settings))
                {
                    s.Document.Save(xw);
                }
            }
        }
Ejemplo n.º 2
0
        public void HaloWars_DumpSortedObjectDbIdsTest()
        {
            var  hw = PhxEngine.CreateForHaloWars(kGameRoot, kUpdateRoot);
            bool success;

            success = hw.Load();
            Assert.IsTrue(success, "Failed to preload");

            var objs = new List <Phx.BProtoObject>(hw.Database.Objects);

            objs.Sort((x, y) => x.DbId - y.DbId);

            using (var s = IO.XmlElementStream.CreateForWrite("ObjectDBIDs"))
            {
                s.InitializeAtRootElement();
                s.StreamMode = FA.Write;

                foreach (var obj in objs)
                {
                    using (s.EnterCursorBookmark("Object"))
                    {
                        s.WriteAttribute("dbid", obj.DbId);
                        s.WriteAttribute("name", obj.Name);
                        s.WriteAttributeOptOnTrue("is", obj.UnusedIs, Predicates.IsNotNone);
                        s.WriteAttributeOptOnTrue("id", obj.UnusedId, Predicates.IsNotNone);
                    }
                }

                string output_path = System.IO.Path.Combine(TestContext.TestResultsDirectory, "ObjectDBIDs.xml");
                Console.WriteLine("Saving to: {0}", output_path);
                s.Document.Save(output_path);
            }
        }
        public DbBuilderSerializerInterface(PhxEngine phx)
        {
            Contract.Requires(phx != null);

            mDatabase = phx.Database;
            TriggerDb = phx.TriggerDb;
        }
        public BTriggerScriptSerializer(PhxEngine phx, Engine.BScenario scnr = null)
        {
            Contract.Requires(phx != null);

            mDatabase = phx.Database;
            TriggerDb = phx.TriggerDb;
            Scenario  = scnr;
        }
Ejemplo n.º 5
0
        public static PhxEngine CreateForHaloWarsAlpha(string gameRoot)
        {
            var e = new PhxEngine();

            e.Build          = PhxEngineBuild.Alpha;
            e.TargetsXbox360 = true;
            e.InitializeEngine(new Engine.GameDirectories(gameRoot));

            return(e);
        }
Ejemplo n.º 6
0
        private void Load(PhxEngine engine)
        {
            bool success;

            success = engine.Preload();
            Assert.IsTrue(success, "Failed to preload");

            success = engine.Load();
            Assert.IsTrue(success, "Failed to load");
        }
        void ParseAbilities(PhxEngine e)
        {
            System.Threading.Tasks.ParallelLoopResult result;

            e.ReadDataFilesAsync(ContentStorage.Game, GameDirectory.AbilityScripts,
                                 BTriggerSystem.GetFileExtSearchPattern(BTriggerScriptType.Ability),
                                 ParseTriggerScript, out result);

            WaitUntilComplete(result);
        }
        void ParseScenarios(PhxEngine e)
        {
            System.Threading.Tasks.ParallelLoopResult result;

            e.ReadDataFilesAsync(ContentStorage.Game, GameDirectory.Scenario,
                                 "*.scn",
                                 ParseScenarioScripts, out result);

            WaitUntilComplete(result);
        }
Ejemplo n.º 9
0
        public static PhxEngine CreateForHaloWars(string gameRoot, string updateRoot
                                                  , bool targets360 = false)
        {
            var e = new PhxEngine();

            e.Build          = PhxEngineBuild.Release;
            e.TargetsXbox360 = targets360;
            e.InitializeEngine(new Engine.GameDirectories(gameRoot, updateRoot));

            return(e);
        }
Ejemplo n.º 10
0
        public void HaloWars_AppLoadTest()
        {
            var    hw          = PhxEngine.CreateForHaloWars(kGameRoot, kUpdateRoot);
            string output_path = System.IO.Path.Combine(TestContext.TestResultsDirectory, "Serina.xml");

            Console.WriteLine("Saving to: {0}", output_path);
            using (var s = new IO.XmlElementStream(output_path, FA.Read))
            {
                s.InitializeAtRootElement();
                s.StreamMode = FA.Read;

                hw.Database.Serialize(s);
            }
        }
Ejemplo n.º 11
0
        public void HaloWars_LoadTest()
        {
            var hw = PhxEngine.CreateForHaloWars(kGameRoot, kUpdateRoot);

            Load(hw);

            Console.WriteLine("English StringTable range stats:");
            var stats = hw.Database.EnglishStringTable.RangeStats;

            foreach (var stat in stats)
            {
                Console.WriteLine(stat.Value);
            }
        }
Ejemplo n.º 12
0
        protected BDatabaseBase(PhxEngine engine, Collections.IProtoEnum game_object_types)
        {
            Engine = engine;

            StringTable = new Dictionary <int, string>();

            GameData    = new BGameData();
            DamageTypes = new Collections.BListAutoId <BDamageType>();
            WeaponTypes = new Collections.BListAutoId <BWeaponType>();
            UserClasses = new Collections.BListAutoId <BUserClass>();
            ObjectTypes = new Collections.BTypeNamesWithCode(game_object_types);
            Abilities   = new Collections.BListAutoId <BAbility>();
            Objects     = new Collections.BListAutoId <BProtoObject>();
            Squads      = new Collections.BListAutoId <BProtoSquad>();
            Powers      = new Collections.BListAutoId <BProtoPower>();
            Techs       = new Collections.BListAutoId <BProtoTech>();
            Civs        = new Collections.BListAutoId <BCiv>();
            Leaders     = new Collections.BListAutoId <BLeader>();

            InitializeDatabaseInterfaces();
        }
 public ProjectEngineLoadedEventArgs(PhxEngine engine)
 {
     Engine = engine;
 }
 public ProjectEngineCreatedEventArgs(PhxEngine engine)
 {
     Engine = engine;
 }
Ejemplo n.º 15
0
 public BDatabase(PhxEngine engine) : base(engine, kGameObjectTypes)
 {
     RepairPowerID = RallyPointPowerID = HookRepairPowerID = UnscOdstDropPowerID =
         Util.kInvalidInt32;
 }
Ejemplo n.º 16
0
        public void HaloWars_LoadAlphaTest()
        {
            var hw = PhxEngine.CreateForHaloWarsAlpha(kGameRootAlpha);

            Load(hw);
        }