Ejemplo n.º 1
0
        public ShopDefinition GetShopDefinition(int chapterId, ShopType shopType)
        {
            int key = ShopDefinition.DefinitionKey(chapterId, shopType);

            if (this.shopDefinitions.ContainsKey(key))
            {
                return(this.shopDefinitions[key]);
            }
            return(null);
        }
Ejemplo n.º 2
0
        private void LoadShopDefinitions()
        {
            shopDefinitions = new Dictionary <int, ShopDefinition>();
            ResourceDataFile fileReader = new ResourceDataFile(@"Data/Shop");

            ShopDefinition def = null;

            while ((def = ShopDefinition.ReadFromFile(fileReader)) != null)
            {
                shopDefinitions[def.Key] = def;
            }
        }
Ejemplo n.º 3
0
        public static ShopDefinition ReadFromFile(ResourceDataFile reader)
        {
            ShopDefinition def = new ShopDefinition();

            def.ChapterId = reader.ReadInt();
            if (def.ChapterId == -1)
            {
                return(null);
            }

            def.Type = (ShopType)reader.ReadInt();

            int count = reader.ReadInt();

            for (int i = 0; i < count; i++)
            {
                int itemId = reader.ReadInt();
                def.Items.Add(itemId);
            }

            return(def);
        }