Пример #1
0
 public MainMenu(Game g, bool skipIntro)
 {
     game     = g;
     saveMenu = new SaveGameMenu(game, SaveGameMenu.State.Loading);
     CreateSnowflakes();
     IntroScreens = new List <Texture2D>();
     inMenu       = skipIntro;
 }
Пример #2
0
 private static Exception SaveGameMenu_UpdateFinalizer(SaveGameMenu __instance, Exception __exception)
 {
     if (__exception != null)
     {
         SaveGamePatch.Monitor.Log($"Failed during SaveGameMenu.update method :\n{__exception.InnerException ?? __exception}", LogLevel.Error);
         __instance.complete();
         Game1.addHUDMessage(new HUDMessage("An error occurs during save the game.Check the error log for details.", HUDMessage.error_type));
     }
     return(null);
 }
Пример #3
0
        private static bool SaveGameMenu_update_Prefix(SaveGameMenu __instance)
        {
            if (!Config.EnableMod || Config.SaveOnTent || !isTenting)
            {
                return(true);
            }
            Game1.exitActiveMenu();

            return(false);
        }
Пример #4
0
        public override void update(GameTime time)
        {
            base.update(time);

            FieldInfo    f    = typeof(ShippingMenu).GetField("saveGameMenu", BindingFlags.Instance | BindingFlags.NonPublic);
            SaveGameMenu menu = (SaveGameMenu)f.GetValue(this);

            if (menu != null && menu.GetType() != typeof(NewSaveGameMenu))
            {
                f.SetValue(this, new NewSaveGameMenu());
            }
        }
Пример #5
0
        private static bool SaveGameMenu_UpdatePrefix(SaveGameMenu __instance, GameTime time, MethodInfo __originalMethod)
        {
            const string key = nameof(SaveGamePatch.SaveGameMenu_UpdatePrefix);

            if (!PatchHelper.StartIntercept(key))
            {
                return(true);
            }
            try
            {
                __originalMethod.Invoke(__instance, new object[] { time });
            }
            catch (Exception ex)
            {
                SaveGamePatch.Monitor.Log($"Failed during SaveGameMenu.update method :\n{ex.InnerException ?? ex}", LogLevel.Error);
                __instance.complete();
                Game1.addHUDMessage(new HUDMessage("An error occurs during save the game.Check the error log for details.", HUDMessage.error_type));
            }
            finally
            {
                PatchHelper.StopIntercept(key);
            }
            return(false);
        }
Пример #6
0
        public void Update(GameTime gameTime)
        {
            if (inMenu)
            {
                if (game.IsActive)
                {
                    switch (state)
                    {
                    case (State.Main):
                    {
                        if (!game.inTransition)
                        {
                            for (int i = 0; i < Buttons.Length; i++)
                            {
                                Buttons[i].Update(gameTime);
                                if (Buttons[i].Activated())
                                {
                                    switch (i)
                                    {
                                    case (0): { game.NewGame(false); break; }

                                    case (1): { state = State.Load; saveMenu = new SaveGameMenu(game, SaveGameMenu.State.Loading); saveMenu.Load(); break; }

                                    case (2):
                                    {
                                        state = State.Options; options = new OptionsMenu(game);
                                        break;
                                    }

                                    case (3):
                                        game.BeginSceneChange(Game.GameScenes.Credits);
                                        game.Audio.SetMusic("Credits", true);
                                        game.Audio.SetAmbience("silence", 0);
                                        break;

                                    case (4): { game.Exit(); break; }
                                    }
                                }
                            }
                        }
                        break;
                    }

                    case (State.Load):
                    {
                        var drawOffset = new Point(game.GetScreenWidth() / 2 - 300, game.GetScreenHeight() / 2 - 300);
                        saveMenu.Update(gameTime);
                        if (saveMenu.CheckForExit())
                        {
                            state = State.Main;
                        }
                        break;
                    }

                    case (State.Options):
                    {
                        options.Update(gameTime);
                        if (options.CheckForExit())
                        {
                            options = null;
                            state   = State.Main;
                        }
                        break;
                    }
                    }
                }
                Vector2 windDir;
                windDir = new Vector2(1.5f, 4.5f);
                for (int i = 0; i < snowFlakes.Count; i++)
                {
                    snowFlakes[i] = new Vector2(snowFlakes[i].X + (windDir.X - (float)game.randomNumber.NextDouble()), snowFlakes[i].Y + (windDir.Y - (float)game.randomNumber.NextDouble()));
                    if (snowFlakes[i].X > game.GetScreenWidth() || snowFlakes[i].Y > game.GetScreenHeight())
                    {
                        snowFlakes[i] = new Vector2(game.randomNumber.Next(0, game.GetScreenWidth() + 512) - 512, -flakeSize);
                    }
                }
            }
            else
            {
                if (screenStage == 0)
                {
                    screenAlpha -= (float)gameTime.ElapsedGameTime.TotalSeconds * 200;
                    if (screenAlpha <= 0)
                    {
                        screenAlpha = 0;
                        screenStage = 1;
                        screenTimer = 0;
                    }
                }
                if (screenStage == 1)
                {
                    screenTimer += (float)gameTime.ElapsedGameTime.TotalSeconds;
                    if (screenTimer > 2.5f)
                    {
                        screenStage = 2;
                    }
                }
                if (screenStage == 2)
                {
                    screenAlpha += (float)gameTime.ElapsedGameTime.TotalSeconds * 200;
                    if (screenAlpha >= 255)
                    {
                        screenAlpha    = 255;
                        screenStage    = 0;
                        currentScreen += 1;
                        if (currentScreen > IntroScreens.Count - 1)
                        {
                            inMenu = true;
                            game.Audio.SetMusic("MainMenu", false);
                            game.Audio.SetAmbience("AmbWindOutside", 40);
                        }
                    }
                }
            }
        }
Пример #7
0
        public static void update()
        {
            if (Multiplayer.mode == Mode.Singleplayer)
            {
                return;
            }

            if (MultiplayerUtility.latestID > prevLatestId)
            {
                sendFunc(new LatestIdPacket());
            }
            prevLatestId = MultiplayerUtility.latestID;

            //Log.Async("pos:" + Game1.player.position.X + " " + Game1.player.position.Y);
            // Clients sometimes get stuck in the top-right corner and can't move on second day+
            if (Game1.player.currentLocation != null && Game1.player.currentLocation.name == "FarmHouse" &&
                Game1.player.currentLocation == Game1.currentLocation && Game1.player.currentLocation != Game1.getLocationFromName(Game1.player.currentLocation.name))
            {
                Game1.player.currentLocation = Game1.getLocationFromName(Game1.player.currentLocation.name);
                Game1.currentLocation        = Game1.player.currentLocation;
                Game1.currentLocation.resetForPlayerEntry();
            }

            // Really don't understand why it breaks without this
            // But as soon as you get to the second day, it does. Ugh.
            Game1.player.FarmerSprite.setOwner(Game1.player);

            if (Game1.newDay)
            {
                didNewDay            = true;
                Game1.freezeControls = prevFreezeControls = true;
                Game1.player.CanMove = false;
                if (!sentNextDayPacket)
                {
                    ChatMenu.chat.Add(new ChatEntry(null, Game1.player.name + " is in bed."));
                    if (mode == Mode.Host)
                    {
                        server.broadcast(new ChatPacket(255, Game1.player.name + " is in bed."));
                    }
                    else if (mode == Mode.Client)
                    {
                        client.stage = Client.NetStage.Waiting;

                        SaveGame oldLoaded = SaveGame.loaded;
                        var      it        = NewSaveGame.Save(true);
                        while (it.Current < 100)
                        {
                            it.MoveNext();
                            Thread.Sleep(5);
                        }

                        MemoryStream tmp = new MemoryStream();
                        SaveGame.serializer.Serialize(tmp, SaveGame.loaded);
                        sendFunc(new NextDayPacket());
                        sendFunc(new ClientFarmerDataPacket(Encoding.UTF8.GetString(tmp.ToArray())));
                        //SaveGame.loaded = oldLoaded;
                    }
                    sentNextDayPacket = true;
                }

                if (waitingOnOthers() && Game1.fadeToBlackAlpha > 0.625f)
                {
                    Game1.fadeToBlackAlpha = 0.625f;
                }
            }
            else
            {
                sentNextDayPacket = false;
            }

            // We want people to wait for everyone
            //Log.Async("menu:"+Game1.activeClickableMenu);
            if (Game1.activeClickableMenu is SaveGameMenu && Game1.activeClickableMenu.GetType() != typeof(NewSaveGameMenu))
            {
                Game1.activeClickableMenu = new NewSaveGameMenu();
            }
            else if (Game1.activeClickableMenu is ShippingMenu)
            {
                //Log.Async("Savegame:" + Util.GetInstanceField(typeof(ShippingMenu), Game1.activeClickableMenu, "saveGameMenu"));
                SaveGameMenu menu = ( SaveGameMenu )Util.GetInstanceField(typeof(ShippingMenu), Game1.activeClickableMenu, "saveGameMenu");
                if (menu != null && menu.GetType() != typeof(NewSaveGameMenu))
                {
                    Util.SetInstanceField(typeof(ShippingMenu), Game1.activeClickableMenu, "saveGameMenu", new NewSaveGameMenu());
                }
            }

            if (Game1.currentLocation != null && Game1.currentLocation.currentEvent != null)
            {
                Events.fix();
            }
            else
            {
                Events.reset();
            }

            // Causing issues after going a day? Maybe?
            // Plus it only fixes a few of the time pauses

            /*Game1.player.forceTimePass = true;
             * Game1.paused = false;
             * if ( prevFreezeControls != Game1.freezeControls )
             * {
             *  sendFunc( new PauseTimePacket() );
             * }
             * prevFreezeControls = Game1.freezeControls;*/

            if (Multiplayer.mode == Mode.Host && server != null)
            {
                server.update();
                if (server == null)
                {
                    return;
                }

                if (server.clients == null)
                {
                    return;
                }
                foreach (Server.Client client_ in server.clients)
                {
                    if (client_.stage != Server.Client.NetStage.Playing)
                    {
                        continue;
                    }
                    if (client_.farmer == null)
                    {
                        continue;
                    }
                    doUpdatePlayer(client_.farmer);
                }
            }
            else if (Multiplayer.mode == Mode.Client && client != null)
            {
                client.update();
                if (client == null)
                {
                    return;
                }

                if (client.others == null)
                {
                    return;
                }
                foreach (KeyValuePair <byte, Farmer> other in client.others)
                {
                    if (other.Value == null)
                    {
                        continue;
                    }
                    doUpdatePlayer(other.Value);
                }
            }

            if (Game1.gameMode == 6)
            {
                return;                      // Loading?
            }
            // ^ TODO: Check if != 3 works

            if (Multiplayer.mode == Mode.Host && server != null && server.playing ||
                Multiplayer.mode == Mode.Client && client != null && client.stage == Client.NetStage.Playing)
            {
                if (Game1.newDay)
                {
                    return;
                }
                NPCMonitor.startChecks();
                foreach (GameLocation loc in Game1.locations)
                {
                    if (!locations.ContainsKey(loc.name))
                    {
                        locations.Add(loc.name, new LocationCache(loc));
                    }

                    locations[loc.name].miniUpdate();
                    if (Game1.player.currentLocation == loc)
                    {
                        locations[loc.name].update();
                    }

                    if (loc is Farm)
                    {
                        BuildableGameLocation farm = loc as BuildableGameLocation;
                        foreach (Building building in farm.buildings)
                        {
                            if (building.indoors == null)
                            {
                                continue;
                            }

                            if (!locations.ContainsKey(building.nameOfIndoors))
                            {
                                locations.Add(building.nameOfIndoors, new LocationCache(building.indoors));
                            }

                            locations[loc.name].miniUpdate();
                            if (Game1.currentLocation != loc)
                            {
                                locations[building.nameOfIndoors].update();
                            }

                            NPCMonitor.check(building.indoors);
                        }
                    }

                    if (loc.name == "FarmHouse")
                    {
                        //Log.Async("Terrain features count for " + loc.name + " " + loc + ": " + loc.terrainFeatures.Count);
                        //Log.Async("Object count for " + loc.name + " " + loc + ": " + loc.objects.Count);
                    }
                }
                NPCMonitor.endChecks();
            }
        }
Пример #8
0
 void OnClick()
 {
     SaveGameMenu.Activate();
 }
Пример #9
0
 SaveGameMenu()
 {
     saveGameMenu = this;
 }
Пример #10
0
        static bool Prefix(SpriteBatch b, ref ShippingMenu __instance)
        {
            List <int>          categoryTotals  = ModEntry.ModHelper.Reflection.GetField <List <int> >(__instance, "categoryTotals").GetValue();
            List <List <Item> > categoryItems   = ModEntry.ModHelper.Reflection.GetField <List <List <Item> > >(__instance, "categoryItems").GetValue();
            List <MoneyDial>    categoryDials   = ModEntry.ModHelper.Reflection.GetField <List <MoneyDial> >(__instance, "categoryDials").GetValue();
            int          introTimer             = ModEntry.ModHelper.Reflection.GetField <int>(__instance, "introTimer").GetValue();
            int          categoryLabelsWidth    = ModEntry.ModHelper.Reflection.GetField <int>(__instance, "categoryLabelsWidth").GetValue();
            int          plusButtonWidth        = ModEntry.ModHelper.Reflection.GetField <int>(__instance, "plusButtonWidth").GetValue();
            int          itemSlotWidth          = ModEntry.ModHelper.Reflection.GetField <int>(__instance, "itemSlotWidth").GetValue();
            int          itemAndPlusButtonWidth = ModEntry.ModHelper.Reflection.GetField <int>(__instance, "itemAndPlusButtonWidth").GetValue();
            int          totalWidth             = ModEntry.ModHelper.Reflection.GetField <int>(__instance, "totalWidth").GetValue();
            int          centerX                    = ModEntry.ModHelper.Reflection.GetField <int>(__instance, "centerX").GetValue();
            int          centerY                    = ModEntry.ModHelper.Reflection.GetField <int>(__instance, "centerY").GetValue();
            int          outroFadeTimer             = ModEntry.ModHelper.Reflection.GetField <int>(__instance, "outroFadeTimer").GetValue();
            int          outroPauseBeforeDateChange = ModEntry.ModHelper.Reflection.GetField <int>(__instance, "outroPauseBeforeDateChange").GetValue();
            int          finalOutroTimer            = ModEntry.ModHelper.Reflection.GetField <int>(__instance, "finalOutroTimer").GetValue();
            int          smokeTimer                 = ModEntry.ModHelper.Reflection.GetField <int>(__instance, "smokeTimer").GetValue();
            int          dayPlaqueY                 = ModEntry.ModHelper.Reflection.GetField <int>(__instance, "dayPlaqueY").GetValue();
            float        weatherX                   = ModEntry.ModHelper.Reflection.GetField <float>(__instance, "weatherX").GetValue();
            bool         outro        = ModEntry.ModHelper.Reflection.GetField <bool>(__instance, "outro").GetValue();
            bool         newDayPlaque = ModEntry.ModHelper.Reflection.GetField <bool>(__instance, "newDayPlaque").GetValue();
            bool         savedYet     = ModEntry.ModHelper.Reflection.GetField <bool>(__instance, "savedYet").GetValue();
            SaveGameMenu saveGameMenu = ModEntry.ModHelper.Reflection.GetField <SaveGameMenu>(__instance, "saveGameMenu").GetValue();

            if (Game1.wasRainingYesterday)
            {
                b.Draw(Game1.mouseCursors, new Rectangle(0, 0, Game1.viewport.Width, Game1.viewport.Height), new Rectangle?(new Rectangle(639, 858, 1, 184)), Game1.currentSeason.Equals("winter") ? Color.LightSlateGray : Color.SlateGray * (float)(1.0 - (double)introTimer / 3500.0));
                b.Draw(Game1.mouseCursors, new Rectangle(2556, 0, Game1.viewport.Width, Game1.viewport.Height), new Rectangle?(new Rectangle(639, 858, 1, 184)), Game1.currentSeason.Equals("winter") ? Color.LightSlateGray : Color.SlateGray * (float)(1.0 - (double)introTimer / 3500.0));
                int num1 = -244;
                while (num1 < Game1.viewport.Width + 244)
                {
                    b.Draw(Game1.mouseCursors, new Vector2((float)num1 + (float)((double)weatherX / 2.0 % 244.0), 32f), new Rectangle?(new Rectangle(643, 1142, 61, 53)), Color.DarkSlateGray * 1f * (float)(1.0 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f);
                    num1 += 244;
                }
                b.Draw(Game1.mouseCursors, new Vector2(0.0f, (float)(Game1.viewport.Height - 192)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 48)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.25f : new Color(30, 62, 50)) * (float)(0.5 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.FlipHorizontally, 1f);
                b.Draw(Game1.mouseCursors, new Vector2(2556f, (float)(Game1.viewport.Height - 192)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 48)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.25f : new Color(30, 62, 50)) * (float)(0.5 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.FlipHorizontally, 1f);
                b.Draw(Game1.mouseCursors, new Vector2(0.0f, (float)(Game1.viewport.Height - 128)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 32)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.5f : new Color(30, 62, 50)) * (float)(1.0 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f);
                b.Draw(Game1.mouseCursors, new Vector2(2556f, (float)(Game1.viewport.Height - 128)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 32)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.5f : new Color(30, 62, 50)) * (float)(1.0 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f);
                b.Draw(Game1.mouseCursors, new Vector2(160f, (float)(Game1.viewport.Height - 128 + 16 + 8)), new Rectangle?(new Rectangle(653, 880, 10, 10)), Color.White * (float)(1.0 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f);
                int num2 = -244;
                while (num2 < Game1.viewport.Width + 244)
                {
                    b.Draw(Game1.mouseCursors, new Vector2((float)num2 + weatherX % 244f, -32f), new Rectangle?(new Rectangle(643, 1142, 61, 53)), Color.SlateGray * 0.85f * (float)(1.0 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.9f);
                    num2 += 244;
                }
                foreach (TemporaryAnimatedSprite animation in __instance.animations)
                {
                    animation.draw(b, true, 0, 0, 1f);
                }
                int num3 = -244;
                while (num3 < Game1.viewport.Width + 244)
                {
                    b.Draw(Game1.mouseCursors, new Vector2((float)num3 + (float)((double)weatherX * 1.5 % 244.0), (float)sbyte.MinValue), new Rectangle?(new Rectangle(643, 1142, 61, 53)), Color.LightSlateGray * (float)(1.0 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.9f);
                    num3 += 244;
                }
            }
            else
            {
                b.Draw(Game1.mouseCursors, new Rectangle(0, 0, Game1.viewport.Width, Game1.viewport.Height), new Rectangle?(new Rectangle(639, 858, 1, 184)), Color.White * (float)(1.0 - (double)introTimer / 3500.0));
                b.Draw(Game1.mouseCursors, new Rectangle(2556, 0, Game1.viewport.Width, Game1.viewport.Height), new Rectangle?(new Rectangle(639, 858, 1, 184)), Color.White * (float)(1.0 - (double)introTimer / 3500.0));
                b.Draw(Game1.mouseCursors, new Vector2(0.0f, 0.0f), new Rectangle?(new Rectangle(0, 1453, 639, 195)), Color.White * (float)(1.0 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f);
                b.Draw(Game1.mouseCursors, new Vector2(2556f, 0.0f), new Rectangle?(new Rectangle(0, 1453, 639, 195)), Color.White * (float)(1.0 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f);
                if (Game1.dayOfMonth == 28)
                {
                    b.Draw(Game1.mouseCursors, new Vector2((float)(Game1.viewport.Width - 176), 4f), new Rectangle?(new Rectangle(642, 835, 43, 43)), Color.White * (float)(1.0 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f);
                }
                b.Draw(Game1.mouseCursors, new Vector2(0.0f, (float)(Game1.viewport.Height - 192)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 48)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.25f : new Color(0, 20, 40)) * (float)(0.649999976158142 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.FlipHorizontally, 1f);
                b.Draw(Game1.mouseCursors, new Vector2(2556f, (float)(Game1.viewport.Height - 192)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 48)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.25f : new Color(0, 20, 40)) * (float)(0.649999976158142 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.FlipHorizontally, 1f);
                b.Draw(Game1.mouseCursors, new Vector2(0.0f, (float)(Game1.viewport.Height - 128)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 32)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.5f : new Color(0, 32, 20)) * (float)(1.0 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f);
                b.Draw(Game1.mouseCursors, new Vector2(2556f, (float)(Game1.viewport.Height - 128)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 32)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.5f : new Color(0, 32, 20)) * (float)(1.0 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f);
                b.Draw(Game1.mouseCursors, new Vector2(160f, (float)(Game1.viewport.Height - 128 + 16 + 8)), new Rectangle?(new Rectangle(653, 880, 10, 10)), Color.White * (float)(1.0 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f);
            }
            if (!outro && !Game1.wasRainingYesterday)
            {
                foreach (TemporaryAnimatedSprite animation in __instance.animations)
                {
                    animation.draw(b, true, 0, 0, 1f);
                }
            }
            if (__instance.currentPage == -1)
            {
                SpriteText.drawStringWithScrollCenteredAt(b, Utility.getYesterdaysDate(), Game1.viewport.Width / 2, __instance.categories[0].bounds.Y - 128, "", 1f, -1, 0, 0.88f, false);
                int num    = -20;
                int index1 = 0;
                foreach (ClickableTextureComponent category in __instance.categories)
                {
                    if (introTimer < 2500 - index1 * 500)
                    {
                        Vector2 vector2 = category.getVector2() + new Vector2(12f, -8f);
                        if (category.visible)
                        {
                            category.draw(b);
                            b.Draw(Game1.mouseCursors, vector2 + new Vector2(-104f, (float)(num + 4)), new Rectangle?(new Rectangle(293, 360, 24, 24)), Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.88f);
                            categoryItems[index1][0].drawInMenu(b, vector2 + new Vector2(-88f, (float)(num + 16)), 1f, 1f, 0.9f, false);
                        }
                        IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(384, 373, 18, 18), (int)((double)vector2.X + (double)-itemSlotWidth - (double)categoryLabelsWidth - 12.0), (int)((double)vector2.Y + (double)num), categoryLabelsWidth, 104, Color.White, 4f, false);
                        SpriteText.drawString(b, category.hoverText, (int)vector2.X - itemSlotWidth - categoryLabelsWidth + 8, (int)vector2.Y + 4, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1);
                        for (int index2 = 0; index2 < 6; ++index2)
                        {
                            b.Draw(Game1.mouseCursors, vector2 + new Vector2((float)(-itemSlotWidth - 192 - 24 + index2 * 6 * 4), 12f), new Rectangle?(new Rectangle(355, 476, 7, 11)), Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.88f);
                        }
                        categoryDials[index1].draw(b, vector2 + new Vector2((float)(-itemSlotWidth - 192 - 48 + 4), 20f), categoryTotals[index1]);
                        b.Draw(Game1.mouseCursors, vector2 + new Vector2((float)(-itemSlotWidth - 64 - 4), 12f), new Rectangle?(new Rectangle(408, 476, 9, 11)), Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.88f);
                    }
                    ++index1;
                }
                if (introTimer <= 0)
                {
                    __instance.okButton.draw(b);
                }
            }
            else
            {
                IClickableMenu.drawTextureBox(b, 0, 0, Game1.viewport.Width, Game1.viewport.Height, Color.White);
                Vector2 location = new Vector2((float)(__instance.xPositionOnScreen + 32), (float)(__instance.yPositionOnScreen + 32));
                for (int index = __instance.currentTab * 9; index < __instance.currentTab * 9 + 9; ++index)
                {
                    if (categoryItems[__instance.currentPage].Count > index)
                    {
                        categoryItems[__instance.currentPage][index].drawInMenu(b, location, 1f, 1f, 1f, true);
                        if (LocalizedContentManager.CurrentLanguageLatin)
                        {
                            SpriteText.drawString(b, categoryItems[__instance.currentPage][index].DisplayName + (categoryItems[__instance.currentPage][index].Stack > 1 ? " x" + (object)categoryItems[__instance.currentPage][index].Stack : ""), (int)location.X + 64 + 12, (int)location.Y + 12, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1);
                            string s   = ".";
                            int    num = 0;
                            while (num < __instance.width - 96 - SpriteText.getWidthOfString(categoryItems[__instance.currentPage][index].DisplayName + (categoryItems[__instance.currentPage][index].Stack > 1 ? " x" + (object)categoryItems[__instance.currentPage][index].Stack : "") + Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.11020", (object)(getPrice(categoryItems[__instance.currentPage][index]) * categoryItems[__instance.currentPage][index].Stack))))
                            {
                                s   += " .";
                                num += SpriteText.getWidthOfString(" .");
                            }
                            SpriteText.drawString(b, s, (int)location.X + 80 + SpriteText.getWidthOfString(categoryItems[__instance.currentPage][index].DisplayName + (categoryItems[__instance.currentPage][index].Stack > 1 ? " x" + (object)categoryItems[__instance.currentPage][index].Stack : "")), (int)location.Y + 8, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1);
                            SpriteText.drawString(b, Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.11020", (object)(getPrice(categoryItems[__instance.currentPage][index]) * categoryItems[__instance.currentPage][index].Stack)), (int)location.X + __instance.width - 64 - SpriteText.getWidthOfString(Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.11020", (object)(getPrice(categoryItems[__instance.currentPage][index]) * categoryItems[__instance.currentPage][index].Stack))), (int)location.Y + 12, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1);
                        }
                        else
                        {
                            string s1 = categoryItems[__instance.currentPage][index].DisplayName + (categoryItems[__instance.currentPage][index].Stack > 1 ? " x" + (object)categoryItems[__instance.currentPage][index].Stack : ".");
                            string s2 = Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.11020", (object)(getPrice(categoryItems[__instance.currentPage][index]) * categoryItems[__instance.currentPage][index].Stack));
                            int    x  = (int)location.X + __instance.width - 64 - SpriteText.getWidthOfString(Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.11020", (object)((getPrice(categoryItems[__instance.currentPage][index]) * categoryItems[__instance.currentPage][index].Stack))));
                            SpriteText.getWidthOfString(s1 + s2);
                            while (SpriteText.getWidthOfString(s1 + s2) < 1123)
                            {
                                s1 += " .";
                            }
                            if (SpriteText.getWidthOfString(s1 + s2) >= 1155)
                            {
                                s1 = s1.Remove(s1.Length - 1);
                            }
                            SpriteText.drawString(b, s1, (int)location.X + 64 + 12, (int)location.Y + 12, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1);
                            SpriteText.drawString(b, s2, x, (int)location.Y + 12, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1);
                        }
                        location.Y += 68f;
                    }
                }
                __instance.backButton.draw(b);
                if (__instance.showForwardButton())
                {
                    __instance.forwardButton.draw(b);
                }
            }
            if (outro)
            {
                b.Draw(Game1.mouseCursors, new Rectangle(0, 0, Game1.viewport.Width, Game1.viewport.Height), new Rectangle?(new Rectangle(639, 858, 1, 184)), Color.Black * (float)(1.0 - (double)outroFadeTimer / 800.0));
                SpriteText.drawStringWithScrollCenteredAt(b, newDayPlaque ? Utility.getDateString(0) : Utility.getYesterdaysDate(), Game1.viewport.Width / 2, dayPlaqueY, "", 1f, -1, 0, 0.88f, false);
                foreach (TemporaryAnimatedSprite animation in __instance.animations)
                {
                    animation.draw(b, true, 0, 0, 1f);
                }
                if (finalOutroTimer > 0)
                {
                    b.Draw(Game1.staminaRect, new Rectangle(0, 0, Game1.viewport.Width, Game1.viewport.Height), new Rectangle?(new Rectangle(0, 0, 1, 1)), Color.Black * (float)(1.0 - (double)finalOutroTimer / 2000.0));
                }
            }
            if (saveGameMenu != null)
            {
                saveGameMenu.draw(b);
            }
            if (Game1.options.SnappyMenus && (introTimer > 0 || outro))
            {
                return(false);
            }
            __instance.drawMouse(b);
            return(false);
        }
 private void Save()
 {
     FMODUtil.RaiseEvent(SoundsTable.UIClick);
     SaveGameMenu.Initialize();
     InGameEscapeMenu.menu.PopupChild(SaveGameMenu.menu);
 }
Пример #12
0
 private static bool SaveGameMenu_draw_Prefix(SaveGameMenu __instance)
 {
     return(!Config.EnableMod || Config.SaveOnTent || !isTenting);
 }