public static OccupationDefinition ReadFromFile(ResourceDataFile reader)
        {
            OccupationDefinition def = new OccupationDefinition();

            def.OccupationId = reader.ReadInt();

            int count = reader.ReadInt();

            def.AttackItemCategories = new List <int>();
            for (int i = 0; i < count; i++)
            {
                int category = reader.ReadInt();
                def.AttackItemCategories.Add(category);
            }

            count = reader.ReadInt();
            def.DefendItemCategories = new List <int>();
            for (int i = 0; i < count; i++)
            {
                int category = reader.ReadInt();
                def.DefendItemCategories.Add(category);
            }

            def.MagicDefendRate = reader.ReadInt();

            return(def);
        }
Exemple #2
0
        private void LoadOccupationDefinitions()
        {
            occupationDefinitions = new Dictionary <int, OccupationDefinition>();
            ResourceDataFile fileReader = new ResourceDataFile(@"Data/Occupation");
            int count = fileReader.ReadInt();

            for (int i = 0; i < count; i++)
            {
                OccupationDefinition def = OccupationDefinition.ReadFromFile(fileReader);
                occupationDefinitions[def.OccupationId] = def;
            }
        }