Ejemplo n.º 1
0
        private void InitGameData()
        {
            var gameData = ConfigurationManager.AppSettings[$"{SignKey}Data"];
            var datas    = gameData.Split('|');

            foreach (var data in datas)
            {
                var data2Nums   = data.Split('-');
                var cookingData = new CookingData(data2Nums[0].Split(','), data2Nums[1].Split(':'), data2Nums[2], _speedButtonItem, _foodButtonItems);
                _cookingDatas.Add(cookingData);
            }
        }
Ejemplo n.º 2
0
        public DataLoader(IModHelper helper)
        {
            Helper    = helper;
            ModConfig = helper.ReadConfig <ModConfig>();
            i18n      = Helper.Translation;

            LooseSpritesName = Helper.Content.GetActualAssetKey("common/LooseSprites.png", ContentSource.ModFolder);
            LooseSprites     = Helper.Content.Load <Texture2D>("common/LooseSprites.png");

            // load tools
            ToolsSprites = Helper.Content.Load <Texture2D>("tools/Tools.png");
            ToolsLoader  = new ToolsLoader(ToolsSprites, Helper.Content.Load <Texture2D>("tools/MenuTiles.png"), Helper.Content.Load <Texture2D>("common/CustomLetterBG.png"));
            ToolsLoader.LoadMail();

            // load recipes
            if (!ModConfig.DisableMeat)
            {
                RecipeLoader = new RecipesLoader();
                RecipeLoader.LoadMails();
            }

            // load animal data
            AnimalBuildingData = DataLoader.Helper.Data.ReadJsonFile <AnimalBuildingData>("data\\animalBuilding.json") ?? new AnimalBuildingData();
            DataLoader.Helper.Data.WriteJsonFile("data\\animalBuilding.json", AnimalBuildingData);
            AnimalData = DataLoader.Helper.Data.ReadJsonFile <AnimalData>("data\\animals.json") ?? new AnimalData();
            DataLoader.Helper.Data.WriteJsonFile("data\\animals.json", AnimalData);

            // look cooking data
            CookingData = Helper.Data.ReadJsonFile <CookingData>("data\\cooking.json") ?? new CookingData();
            if (CookingData.Meatloaf.Recipe == null)
            {
                CookingData.CloneRecipeAndAmount(new CookingData());
            }
            Helper.Data.WriteJsonFile("data\\cooking.json", CookingData);

            // load TV channel
            LivingWithTheAnimalsChannel = new LivingWithTheAnimalsChannel();

            // add editors (must happen *after* data is initialised above, since SMAPI may reload affected assets immediately)
            var editors = Helper.Content.AssetEditors;

            //editors.Add(new EventsLoader());
            editors.Add(ToolsLoader);
            if (!ModConfig.DisableMeat)
            {
                editors.Add(this);
                editors.Add(RecipeLoader);
            }
        }
Ejemplo n.º 3
0
        public DataLoader(IModHelper helper)
        {
            Helper    = helper;
            ModConfig = helper.ReadConfig <ModConfig>();
            i18n      = Helper.Translation;

            LooseSpritesName = Helper.Content.GetActualAssetKey("common/LooseSprites.png", ContentSource.ModFolder);
            LooseSprites     = Helper.Content.Load <Texture2D>("common/LooseSprites.png");

            var editors = Helper.Content.AssetEditors;

            //editors.Add(new EventsLoader());

            if (!ModConfig.DisableMeat)
            {
                editors.Add(this);
            }

            ToolsSprites = Helper.Content.Load <Texture2D>("tools/Tools.png");
            ToolsLoader  = new ToolsLoader(ToolsSprites, Helper.Content.Load <Texture2D>("tools/MenuTiles.png"), Helper.Content.Load <Texture2D>("common/CustomLetterBG.png"));
            editors.Add(ToolsLoader);
            ToolsLoader.LoadMail();

            if (!ModConfig.DisableMeat)
            {
                RecipeLoader = new RecipesLoader();
                editors.Add(RecipeLoader);
                RecipeLoader.LoadMails();
            }

            AnimalBuildingData = DataLoader.Helper.Data.ReadJsonFile <AnimalBuildingData>("data\\animalBuilding.json") ?? new AnimalBuildingData();
            DataLoader.Helper.Data.WriteJsonFile("data\\animalBuilding.json", AnimalBuildingData);

            AnimalData = DataLoader.Helper.Data.ReadJsonFile <AnimalData>("data\\animals.json") ?? new AnimalData();
            DataLoader.Helper.Data.WriteJsonFile("data\\animals.json", AnimalData);

            CookingData = Helper.Data.ReadJsonFile <CookingData>("data\\cooking.json") ?? new CookingData();
            if (CookingData.Meatloaf.Recipe == null)
            {
                CookingData.CloneRecipeAndAmount(new CookingData());
            }
            Helper.Data.WriteJsonFile("data\\cooking.json", CookingData);

            LivingWithTheAnimalsChannel = new LivingWithTheAnimalsChannel();
        }
Ejemplo n.º 4
0
        public DataLoader(IModHelper helper, IManifest manifest)
        {
            Helper    = helper;
            ModConfig = helper.ReadConfig <ModConfig>();
            i18n      = Helper.Translation;
            DgaApi    = DataLoader.Helper.ModRegistry.GetApi <IDynamicGameAssetsApi>("spacechase0.DynamicGameAssets");

            LooseSpritesName = Helper.Content.GetActualAssetKey("common/LooseSprites.png", ContentSource.ModFolder);
            LooseSprites     = Helper.Content.Load <Texture2D>("common/LooseSprites.png");

            // load tools
            ToolsSprites = Helper.Content.Load <Texture2D>("tools/Tools.png");
            ToolsLoader  = new ToolsLoader(ToolsSprites, Helper.Content.Load <Texture2D>("tools/MenuTiles.png"), Helper.Content.Load <Texture2D>("common/CustomLetterBG.png"));
            ToolsLoader.LoadMail();

            // load recipes
            if (!ModConfig.DisableMeat)
            {
                RecipeLoader = new RecipesLoader();
                RecipeLoader.LoadMails();
            }

            //load treats mail
            if (!ModConfig.DisableTreats)
            {
                LoadTreatsMail();
            }

            // load animal data
            AnimalBuildingData = DataLoader.Helper.Data.ReadJsonFile <AnimalBuildingData>("data\\animalBuilding.json") ?? new AnimalBuildingData();
            DataLoader.Helper.Data.WriteJsonFile("data\\animalBuilding.json", AnimalBuildingData);
            AnimalData = DataLoader.Helper.Data.ReadJsonFile <AnimalData>("data\\animals.json") ?? new AnimalData();
            DataLoader.Helper.Data.WriteJsonFile("data\\animals.json", AnimalData);
            AnimalContestData = DataLoader.Helper.Data.ReadJsonFile <AnimalContestData>("data\\animalContest.json") ?? new AnimalContestData();
            DataLoader.Helper.Data.WriteJsonFile("data\\animalContest.json", AnimalContestData);

            // look cooking data
            CookingData = Helper.Data.ReadJsonFile <CookingData>("data\\cooking.json") ?? new CookingData();
            if (CookingData.Meatloaf.Recipe == null)
            {
                CookingData.CloneRecipeAndAmount(new CookingData());
            }
            Helper.Data.WriteJsonFile("data\\cooking.json", CookingData);

            // load Livin' With The Animals channel
            TvController.AddChannel(new LivingWithTheAnimalsChannel());

            // add editors (must happen *after* data is initialised above, since SMAPI may reload affected assets immediately)
            var editors = Helper.Content.AssetEditors;
            var loaders = Helper.Content.AssetLoaders;

            if (!ModConfig.DisableAnimalContest)
            {
                editors.Add(new EventsLoader());
                loaders.Add(this);
            }
            editors.Add(ToolsLoader);
            editors.Add(this);
            if (!ModConfig.DisableMeat)
            {
                editors.Add(RecipeLoader);
            }

            CreateConfigMenu(manifest);
        }