Esempio n. 1
0
        public ChooseFromListMenu(List <string> options, ChooseFromListMenu.actionOnChoosingListOption chooseAction, bool isJukebox = false)
            : base(Game1.viewport.Width / 2 - 320, Game1.viewport.Height - Game1.tileSize - 192, 640, 192, false)
        {
            this.chooseAction = chooseAction;
            ClickableTextureComponent textureComponent1 = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen - Game1.tileSize * 2 - Game1.pixelZoom, this.yPositionOnScreen + Game1.tileSize * 4 / 3, 12 * Game1.pixelZoom, 11 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(352, 495, 12, 11), (float)Game1.pixelZoom, false);
            int num1 = 101;

            textureComponent1.myID = num1;
            int num2 = 102;

            textureComponent1.rightNeighborID = num2;
            this.backButton = textureComponent1;
            ClickableTextureComponent textureComponent2 = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + 640 + Game1.pixelZoom * 4 + Game1.tileSize, this.yPositionOnScreen + Game1.tileSize * 4 / 3, 12 * Game1.pixelZoom, 11 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(365, 495, 12, 11), (float)Game1.pixelZoom, false);
            int num3 = 102;

            textureComponent2.myID = num3;
            int num4 = 101;

            textureComponent2.leftNeighborID = num4;
            int num5 = 103;

            textureComponent2.rightNeighborID = num5;
            this.forwardButton = textureComponent2;
            ClickableTextureComponent textureComponent3 = new ClickableTextureComponent("OK", new Rectangle(this.xPositionOnScreen + this.width + Game1.tileSize * 2 + Game1.pixelZoom * 2, this.yPositionOnScreen + 192 - Game1.tileSize * 2, Game1.tileSize, Game1.tileSize), (string)null, (string)null, Game1.mouseCursors, new Rectangle(175, 379, 16, 15), (float)Game1.pixelZoom, false);
            int num6 = 103;

            textureComponent3.myID = num6;
            int num7 = 102;

            textureComponent3.leftNeighborID = num7;
            int num8 = 104;

            textureComponent3.rightNeighborID = num8;
            this.okButton = textureComponent3;
            ClickableTextureComponent textureComponent4 = new ClickableTextureComponent("OK", new Rectangle(this.xPositionOnScreen + this.width + Game1.tileSize * 3 + Game1.pixelZoom * 3, this.yPositionOnScreen + 192 - Game1.tileSize * 2, Game1.tileSize, Game1.tileSize), (string)null, (string)null, Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 47, -1, -1), 1f, false);
            int num9 = 104;

            textureComponent4.myID = num9;
            int num10 = 103;

            textureComponent4.leftNeighborID = num10;
            this.cancelButton = textureComponent4;
            Game1.playSound("bigSelect");
            this.isJukebox = isJukebox;
            if (isJukebox)
            {
                for (int index = options.Count - 1; index >= 0; --index)
                {
                    if (options[index].ToLower().Contains("ambient") || options[index].ToLower().Contains("bigdrums") || options[index].ToLower().Contains("clubloop"))
                    {
                        options.RemoveAt(index);
                    }
                    else
                    {
                        string option = options[index];
                        // ISSUE: reference to a compiler-generated method
                        uint stringHash = \u003CPrivateImplementationDetails\u003E.ComputeStringHash(option);
                        if (stringHash <= 1611928003U)
                        {
                            if ((int)stringHash != 575982768)
                            {
                                if ((int)stringHash != 1176080900)
                                {
                                    if ((int)stringHash == 1611928003 && option == "buglevelloop")
                                    {
                                        options.RemoveAt(index);
                                    }
                                }
                                else if (option == "jojaOfficeSoundscape")
                                {
                                    options.RemoveAt(index);
                                }
                            }
                            else if (option == "title_day")
                            {
                                options.RemoveAt(index);
                                options.Add("MainTheme");
                            }
                        }
                        else if (stringHash <= 3528263180U)
                        {
                            if ((int)stringHash != -962254472)
                            {
                                if ((int)stringHash == -766704116 && option == "coin")
                                {
                                    options.RemoveAt(index);
                                }
                            }
                            else if (option == "nightTime")
                            {
                                options.RemoveAt(index);
                            }
                        }
                        else if ((int)stringHash != -730834543)
                        {
                            if ((int)stringHash == -475385117 && option == "communityCenter")
                            {
                                options.RemoveAt(index);
                            }
                        }
                        else if (option == "ocean")
                        {
                            options.RemoveAt(index);
                        }
                    }
                }
            }
            this.options = options;
            if (!Game1.options.SnappyMenus)
            {
                return;
            }
            this.populateClickableComponentList();
            this.snapToDefaultClickableComponent();
        }
Esempio n. 2
0
        /*
         * Private methods
         */

        /// <summary>
        /// Raised after a game menu is opened, closed, or replaced.
        /// </summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event data.</param>
        private void OnMenuChanged(object sender, MenuChangedEventArgs e)
        {
            // get config values here to reflect potential changes via GenericModConfigMenu
            ShowInternalId    = Config.ShowInternalId;
            ShowAmbientTracks = Config.ShowAmbientTracks;
            //ShowUnheardTracks = Config.ShowUnheardTracks;
            //ShowAlternateSorts = Config.ShowAlternateSorts;

            // replace ChooseFromListMenu (only used for jukeboxes as of 1.4) with BetterJukeboxMenu
            if (e.NewMenu is ChooseFromListMenu &&
                Helper.Reflection.GetField <bool>(e.NewMenu, "isJukebox").GetValue() == true)
            {
                ChooseFromListMenu.actionOnChoosingListOption action =
                    Helper.Reflection.GetField <ChooseFromListMenu.actionOnChoosingListOption>(e.NewMenu, "chooseAction").GetValue();

                e.NewMenu.exitThisMenuNoSound(); // is this neccessary? is there a better way?

                // create default list of songs to play - apparently this is how CA hard-copied the list
                List <string> list = Game1.player.songsHeard.Distinct <string>().ToList <string>();

                //if (ShowUnheardTracks)
                //{
                //    AddAllTracks(list);
                //}

                // from ChooseFromListMenu constructor
                if (!ShowAmbientTracks)
                {
                    RemoveAmbience(list);
                }
                //else  // rain noises heavily based on actual weather and player location, no effect if not raining
                //{
                //    if (list.IndexOf("rain") == -1)
                //        list.Add("rain");
                //}
                list.Remove("title_day"); // this one gets removed for A Good Reason, apparently

                // this is the one change that isn't true to how the game does it, because it makes me angy >:L
                int MTIndex = list.IndexOf("MainTheme");
                if (MTIndex.Equals(0))
                {
                }
                else
                {
                    if (MTIndex.Equals(-1))
                    {
                    }
                    else
                    {
                        list.RemoveAt(MTIndex);
                    }
                    list.Insert(0, "MainTheme");
                }

                // speculative fix for Nexus page bug report
                list.Remove("resetVariable");

                // create and activate the menu
                Game1.activeClickableMenu = new BetterJukeboxMenu(
                    list,
                    new BetterJukeboxMenu.actionOnChoosingListOption(action),
                    Helper.Content.Load <Texture2D>(
                        "assets/BetterJukeboxGraphics.png",
                        ContentSource.ModFolder
                        ),
                    key => Helper.Translation.Get(key),
                    Monitor,
                    Game1.player.currentLocation.miniJukeboxTrack.Value,
                    ShowInternalId
                    );
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Raised after a game menu is opened, closed, or replaced.
        /// </summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event data.</param>
        private void OnMenuChanged(object sender, MenuChangedEventArgs e)
        {
            // replace ChooseFromListMenu (only used for jukeboxes as of 1.4) with BetterJukeboxMenu
            if (Config.ShowMenu &&
                e.NewMenu is ChooseFromListMenu &&
                Helper.Reflection.GetField <bool>(e.NewMenu, "isJukebox").GetValue() == true)
            {
                ChooseFromListMenu.actionOnChoosingListOption action =
                    Helper.Reflection.GetField <ChooseFromListMenu.actionOnChoosingListOption>(e.NewMenu, "chooseAction").GetValue();

                e.NewMenu.exitThisMenuNoSound(); // is this neccessary? is there a better way?

                // create default list of songs to play - apparently this is how CA hard-copied the list
                List <string> list = Game1.player.songsHeard.Distinct().ToList();

                // add unheard tracks
                if (Config.ShowUnheardTracks && !Config.PermanentUnheard)
                {
                    BetterJukeboxHelper.AddUnheardTracks(
                        list,
                        Config.UnheardSoundtrack,
                        Config.UnheardNamed,
                        Config.UnheardRandom,
                        Config.UnheardMisc,
                        Config.UnheardDupes,
                        Config.UnheardMusical
                        );
                }

                // remove specific tracks
                BetterJukeboxHelper.FilterTracksFromList(list, Config.AmbientTracks, Config.Blacklist, Config.Whitelist);

                list.Remove("title_day"); // this one gets removed for A Good Reason, apparently

                // this is the one change that isn't true to how the game does it, because it makes me angy >:L
                int MTIndex = list.IndexOf("MainTheme");
                // if permanent: not -1
                // if not permanent: -1
                // if in either blacklist: -1
                // impossible to tell directly, can't put into filtertracks because need to check both
                bool isMTPermanentBlacklisted = new FilterListConfig(Config.PermanentBlacklist).content.Contains("MainTheme");
                bool isMTRegularBlacklisted   = new FilterListConfig(Config.Blacklist).content.Contains("MainTheme");

                if (!isMTPermanentBlacklisted &&
                    !isMTRegularBlacklisted &&
                    !MTIndex.Equals(0))
                {
                    if (MTIndex.Equals(-1))
                    {
                    }
                    else
                    {
                        list.RemoveAt(MTIndex);
                    }
                    list.Insert(0, "MainTheme");
                }

                // speculative fix for Nexus page bug report
                list.Remove("resetVariable");


                // create and activate the menu
                Game1.activeClickableMenu = new BetterJukeboxMenu(
                    list,
                    new BetterJukeboxMenu.actionOnChoosingListOption(action),
                    Helper.Content.Load <Texture2D>(
                        "assets/BetterJukeboxGraphics.png",
                        ContentSource.ModFolder
                        ),
                    key => Helper.Translation.Get(key),
                    Monitor,
                    Config,
                    Game1.player.currentLocation.miniJukeboxTrack.Value
                    );
            }
        }
 // Token: 0x06000DDB RID: 3547 RVA: 0x0011B700 File Offset: 0x00119900
 public ChooseFromListMenu(List <string> options, ChooseFromListMenu.actionOnChoosingListOption chooseAction, bool isJukebox = false) : base(Game1.viewport.Width / 2 - 320, Game1.viewport.Height - Game1.tileSize - 192, 640, 192, false)
 {
     this.chooseAction  = chooseAction;
     this.backButton    = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen - Game1.tileSize * 2 - Game1.pixelZoom, this.yPositionOnScreen + Game1.tileSize * 4 / 3, 12 * Game1.pixelZoom, 11 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(352, 495, 12, 11), (float)Game1.pixelZoom, false);
     this.forwardButton = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + 640 + Game1.pixelZoom * 4 + Game1.tileSize, this.yPositionOnScreen + Game1.tileSize * 4 / 3, 12 * Game1.pixelZoom, 11 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(365, 495, 12, 11), (float)Game1.pixelZoom, false);
     this.okButton      = new ClickableTextureComponent("OK", new Rectangle(this.xPositionOnScreen + this.width + Game1.tileSize * 2 + Game1.pixelZoom * 2, this.yPositionOnScreen + 192 - Game1.tileSize * 2, Game1.tileSize, Game1.tileSize), null, null, Game1.mouseCursors, new Rectangle(175, 379, 16, 15), (float)Game1.pixelZoom, false);
     this.cancelButton  = new ClickableTextureComponent("OK", new Rectangle(this.xPositionOnScreen + this.width + Game1.tileSize * 3 + Game1.pixelZoom * 3, this.yPositionOnScreen + 192 - Game1.tileSize * 2, Game1.tileSize, Game1.tileSize), null, null, Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 47, -1, -1), 1f, false);
     Game1.playSound("bigSelect");
     this.isJukebox = isJukebox;
     if (isJukebox)
     {
         for (int i = options.Count - 1; i >= 0; i--)
         {
             if (options[i].ToLower().Contains("ambient"))
             {
                 options.RemoveAt(i);
             }
             else
             {
                 string text = options[i];
                 uint   num  = < PrivateImplementationDetails >.ComputeStringHash(text);
                 if (num <= 1611928003u)
                 {
                     if (num != 575982768u)
                     {
                         if (num != 1176080900u)
                         {
                             if (num == 1611928003u)
                             {
                                 if (text == "buglevelloop")
                                 {
                                     options.RemoveAt(i);
                                 }
                             }
                         }
                         else if (text == "jojaOfficeSoundscape")
                         {
                             options.RemoveAt(i);
                         }
                     }
                     else if (text == "title_day")
                     {
                         options.RemoveAt(i);
                         options.Add("MainTheme");
                     }
                 }
                 else if (num <= 3528263180u)
                 {
                     if (num != 3332712824u)
                     {
                         if (num == 3528263180u)
                         {
                             if (text == "coin")
                             {
                                 options.RemoveAt(i);
                             }
                         }
                     }
                     else if (text == "nightTime")
                     {
                         options.RemoveAt(i);
                     }
                 }
                 else if (num != 3564132753u)
                 {
                     if (num == 3819582179u)
                     {
                         if (text == "communityCenter")
                         {
                             options.RemoveAt(i);
                         }
                     }
                 }
                 else if (text == "ocean")
                 {
                     options.RemoveAt(i);
                 }
             }
         }
     }
     this.options = options;
 }