private void ContinueShow(TV tv, TvScript script, int index)
        {
            ScriptPage page = script.Pages[index];

            TemporaryAnimatedSprite BackgroundSprite = new TemporaryAnimatedSprite()
            {
                paused             = true,
                texture            = _spriteSheet,
                sourceRect         = new Rectangle(page.X, page.Y, 42, 28),
                interval           = 9999f,
                animationLength    = 999999,
                totalNumberOfLoops = 999999,
                position           = tv.getScreenPosition(),
                flicker            = false,
                flipped            = false,
                layerDepth         = (float)((tv.boundingBox.Bottom - 1) / 10000.0 + 9.99999974737875E-06),
                alphaFade          = 0f,
                color          = Color.White,
                scale          = tv.getScreenSizeModifier(),
                scaleChange    = 0.0f,
                rotation       = 0.0f,
                rotationChange = 0.0f,
                local          = false
            };

            if (index == script.Pages.Length - 1)
            {
                CustomTVMod.showProgram(BackgroundSprite, script.Pages[index].Text, CustomTVMod.endProgram, BackgroundSprite);
            }
            else
            {
                CustomTVMod.showProgram(BackgroundSprite, script.Pages[index].Text, () => ContinueShow(tv, script, ++index), BackgroundSprite);
            }
        }
        public void DisplayWeather(TV tv, TemporaryAnimatedSprite sprite, Farmer who, string answer)
        {
            TemporaryAnimatedSprite BackgroundSprite = new TemporaryAnimatedSprite("LooseSprites\\Cursors", new Rectangle(497, 305, 42, 28), 9999f, 1, 999999, tv.getScreenPosition(), false, false, (float)((tv.boundingBox.Bottom - 1) / 10000.0 + 9.99999974737875E-06), 0.0f, Color.White, tv.getScreenSizeModifier(), 0.0f, 0.0f, 0.0f, false);
            TemporaryAnimatedSprite WeatherSprite    = DescriptionEngine.GetWeatherOverlay(Conditions, tv);

            string OnScreenText = "";

            if (BackgroundSprite is null)
            {
                Monitor.Log("Background Sprite is null");
            }
            if (WeatherSprite is null)
            {
                Monitor.Log("Weather Sprite is null");
            }

            string MoonPhase = "";
            bool   MoonIsUp  = false;

            if (UseLunarDisturbancesApi)
            {
                MoonPhase = MoonAPI.GetCurrentMoonPhase();
                MoonIsUp  = MoonAPI.IsMoonUp(Game1.timeOfDay);
            }

            double fog = ClimatesOfFerngill.GetClimateForDay(SDate.Now().AddDays(1)).RetrieveOdds(Dice, "fog", SDate.Now().AddDays(1).Day);

            OnScreenText += DescriptionEngine.GenerateTVForecast(Conditions, ClimatesOfFerngill.Dice, fog, MoonPhase, MoonIsUp);

            CustomTVMod.showProgram(BackgroundSprite, OnScreenText, CustomTVMod.endProgram, WeatherSprite);
        }
Exemple #3
0
        public void DisplayWeather(TV tv, TemporaryAnimatedSprite sprite, Farmer who, string answer)
        {
            TemporaryAnimatedSprite BackgroundSprite = new TemporaryAnimatedSprite("LooseSprites\\Cursors", new Rectangle(497, 305, 42, 28), 9999f, 1, 999999, tv.getScreenPosition(), false, false, (float)((tv.boundingBox.Bottom - 1) / 10000.0 + 9.99999974737875E-06), 0.0f, Color.White, tv.getScreenSizeModifier(), 0.0f, 0.0f, 0.0f, false);
            TemporaryAnimatedSprite WeatherSprite    = DescriptionEngine.GetWeatherOverlay(Conditions, tv);

            string OnScreenText = "";

            if (BackgroundSprite is null)
            {
                Monitor.Log("Background Sprite is null");
            }
            if (WeatherSprite is null)
            {
                Monitor.Log("Weather Sprite is null");
            }

            string MoonPhase = "";

            if (UseLunarDisturbancesApi)
            {
                MoonPhase = MoonAPI.GetCurrentMoonPhase();
            }

            OnScreenText += DescriptionEngine.GenerateTVForecast(Conditions, MoonPhase);

            CustomTVMod.showProgram(BackgroundSprite, OnScreenText, CustomTVMod.endProgram, WeatherSprite);
        }
Exemple #4
0
 public TVChannel(string id, string text, Action <TV, TemporaryAnimatedSprite, SFarmer, string> action = null, TemporaryAnimatedSprite sprite = null, Action afterDialogues = null, TemporaryAnimatedSprite overlay = null)
 {
     this.sprite         = sprite;
     this.overlay        = overlay;
     this.text           = text;
     this.id             = id;
     this.action         = (action == null) ? (tv, ta, sf, s) => CustomTVMod.showProgram(this) : action;
     this.afterDialogues = (afterDialogues == null) ? endProgram : afterDialogues;
 }
        private void ShowPresentation()
        {
            string text = DataLoader.i18n.Get(_episodes[GetShowNumber()].Text);

            if (text.Contains("|"))
            {
                if (DataLoader.ModConfig.DisableMeat)
                {
                    text = text.Split('|')[1];
                }
                else
                {
                    text = text.Split('|')[0];
                }
            }
            CustomTVMod.showProgram(_showSprite, text, CustomTVMod.endProgram);
        }
Exemple #6
0
        private void deliverNews(TV tv, TemporaryAnimatedSprite sprite, Farmer who, string answer)
        {
            Texture2D newsScreen = null;

            try  //Try to load news screen from .json file
            {
                newsScreen = Helper.Content.Load<Texture2D>(NewsItems[dailyNews].Texture);
            }
            catch  //If the load failed, just load the default newscaster.
            {
                Monitor.Log("Unable to load newscaster(" + NewsItems[dailyNews].Texture + ") defined in: " + NewsItems[dailyNews].Source, LogLevel.Error);
            }

            TemporaryAnimatedSprite newsSprite = new TemporaryAnimatedSprite(newsScreen, new Rectangle(0, 0, 42, 28), 150f, 2, 999999, tv.getScreenPosition(), false, false, (float)((double)(tv.boundingBox.Bottom - 1) / 10000.0 + 9.99999974737875E-06), 0.0f, Color.White, tv.getScreenSizeModifier(), 0.0f, 0.0f, 0.0f, false);
            string text = NewsItems[dailyNews].HeadlineText;
            CustomTVMod.showProgram(newsSprite, text, CustomTVMod.endProgram);
        }
        private void AddRecipe()
        {
            string[] recipeSplit = _recipes[GetRecipeNumber()].Split('/');
            string   recipeKey   = recipeSplit[0];
            string   recipeName  = recipeSplit[2];
            string   addRecipeText;

            if (!Game1.player.cookingRecipes.ContainsKey(recipeKey))
            {
                addRecipeText = Game1.content.LoadString("Strings\\StringsFromCSFiles:TV.cs.13153", (object)recipeName);
                Game1.player.cookingRecipes.Add(recipeKey, 0);
            }
            else
            {
                addRecipeText = Game1.content.LoadString("Strings\\StringsFromCSFiles:TV.cs.13151", (object)recipeName);
            }
            CustomTVMod.showProgram(_queenSprite, addRecipeText, CustomTVMod.endProgram);
        }
Exemple #8
0
        public void DisplayWeather(TV tv, TemporaryAnimatedSprite sprite, StardewValley.Farmer who, string answer)
        {
            TemporaryAnimatedSprite BackgroundSprite = new TemporaryAnimatedSprite(Game1.mouseCursors, new Rectangle(497, 305, 42, 28), 9999f, 1, 999999, tv.getScreenPosition(), false, false, (float)((double)(tv.boundingBox.Bottom - 1) / 10000.0 + 9.99999974737875E-06), 0.0f, Color.White, tv.getScreenSizeModifier(), 0.0f, 0.0f, 0.0f, false);
            TemporaryAnimatedSprite WeatherSprite    = DescriptionEngine.GetWeatherOverlay(Conditions, tv);

            string OnScreenText = "";

            if (BackgroundSprite is null)
            {
                Monitor.Log("Background Sprite is null");
            }
            if (WeatherSprite is null)
            {
                Monitor.Log("Weather Sprite is null");
            }

            OnScreenText += DescriptionEngine.GenerateTVForecast(Conditions, OurMoon);

            CustomTVMod.showProgram(BackgroundSprite, OnScreenText, CustomTVMod.endProgram, WeatherSprite);
        }
 private void ShowAnnouncement(TV tv, TemporaryAnimatedSprite sprite, StardewValley.Farmer farmer, string answer)
 {
     _showSprite = new TemporaryAnimatedSprite(DataLoader.LooseSpritesName, new Rectangle(0, 0, 42, 28), 150f, 2, 999999, tv.getScreenPosition(), false, false, (float)((double)(tv.boundingBox.Bottom - 1) / 10000.0 + 9.99999974737875E-06), 0.0f, Color.White, tv.getScreenSizeModifier(), 0.0f, 0.0f, 0.0f, false);
     CustomTVMod.showProgram(_showSprite, DataLoader.i18n.Get("TV.LivingWithTheAnimals.Announcement"), ShowPresentation);
 }
        private void ShowRecipePresentation()
        {
            string text = _recipes[GetRecipeNumber()].Split('/')[1];

            CustomTVMod.showProgram(_queenSprite, text, AddRecipe);
        }
 private void ShowQueenAnnouncement(TV tv, TemporaryAnimatedSprite sprite, StardewValley.Farmer farmer, string answer)
 {
     _queenSprite = new TemporaryAnimatedSprite(Game1.mouseCursorsName, new Rectangle(602, 361, 42, 28), 150f, 2, 999999, tv.getScreenPosition(), false, false, (float)((double)(tv.boundingBox.Bottom - 1) / 10000.0 + 9.99999974737875E-06), 0.0f, Color.White, tv.getScreenSizeModifier(), 0.0f, 0.0f, 0.0f, false);
     CustomTVMod.showProgram(_queenSprite, DataLoader.i18n.Get("TV.MeatFriday.Announcement"), ShowRecipePresentation);
 }