Пример #1
0
 public static bool createQuestionDialogue(string question, ref Response[] answerChoices)
 {
     if (question == Game1.content.LoadString("Strings\\StringsFromCSFiles:TV.cs.13120"))
     {
         List <Response> answerChoicesList = new List <Response>(answerChoices);
         TvController.GetChannelsWithEpisodeToday().ForEach(c =>
         {
             answerChoicesList.Insert(answerChoicesList.Count - 1, new Response(c.GetName, c.GetDisplayName));
         });
         answerChoices = answerChoicesList.ToArray();
     }
     return(true);
 }
Пример #2
0
        /// <summary>
        /// Changed from a patch to a private method to avoid conflict with PyTK
        /// </summary>
        private static void selectChannel(TV __instance, Farmer who, string answer)
        {
            Channel channel = TvController.GetChannel(answer);

            if (channel != null)
            {
                DataLoader.Helper.Reflection.GetField <int>(__instance, "currentChannel").SetValue(-1);
                DataLoader.Helper.Reflection.GetField <TemporaryAnimatedSprite>(__instance, "screen").SetValue(
                    new TemporaryAnimatedSprite(channel.GetScreenTextureName, channel.GetScreenSourceRectangle, 150f, 2, 999999, __instance.getScreenPosition(), flicker: false, flipped: false, (float)(__instance.boundingBox.Value.Bottom - 1) / 10000f + 1E-05f, 0f, Color.White, __instance.getScreenSizeModifier(), 0f, 0f, 0f)
                    );
                Game1.multipleDialogues(channel.GetEpisodesText());
                Game1.afterDialogues = __instance.turnOffTV;
            }
        }
Пример #3
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);
        }