コード例 #1
0
        public MusicMenu(List <string> songs, actionOnChoosingListOption chooseAction, bool isJukebox = false, string default_selection = null) : base(0, 0, 0, 0, showUpperRightCloseButton: true)
        {
            // Filter songs using base game logic
            ChooseFromListMenu.FilterJukeboxTracks(songs);

            this.songs        = songs;
            this.chooseAction = chooseAction;

            Game1.playSound("bigSelect");
            this.PaginateSongs();
            base.width  = Game1.uiViewport.Width / 2 < maxSongWidth ? Game1.uiViewport.Width / 4 + maxSongWidth : Game1.uiViewport.Width / 2;
            base.height = 576;

            if (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ko || LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.fr)
            {
                base.height += 64;
            }
            Vector2 topLeft = Utility.getTopLeftPositionForCenteringOnScreen(base.width, base.height);

            base.xPositionOnScreen = (int)topLeft.X;
            base.yPositionOnScreen = (int)topLeft.Y + 32;

            // Create the buttons used for teleporting and renaming
            this.songButtons = new List <ClickableComponent>();

            for (int i = 0; i < songsPerPage; i++)
            {
                this.songButtons.Add(new ClickableComponent(new Rectangle(base.xPositionOnScreen + 16, base.yPositionOnScreen + 16 + i * ((base.height - 32) / songsPerPage), base.width - 32, (base.height - 32) / songsPerPage + 4), string.Concat(i))
                {
                    myID            = i,
                    downNeighborID  = -7777,
                    upNeighborID    = ((i > 0) ? (i - 1) : (-1)),
                    rightNeighborID = i + 103,
                    leftNeighborID  = -7777,
                    fullyImmutable  = true
                });
            }

            base.upperRightCloseButton = new ClickableTextureComponent(new Rectangle(base.xPositionOnScreen + base.width - 20, base.yPositionOnScreen - 8, 48, 48), Game1.mouseCursors, new Rectangle(337, 494, 12, 12), 4f);
            this.backButton            = new ClickableTextureComponent(new Rectangle(base.xPositionOnScreen - 64, base.yPositionOnScreen + base.height - 48, 48, 44), Game1.mouseCursors, new Rectangle(352, 495, 12, 11), 4f)
            {
                myID            = region_backButton,
                rightNeighborID = -7777
            };
            this.forwardButton = new ClickableTextureComponent(new Rectangle(base.xPositionOnScreen + base.width + 64 - 48, base.yPositionOnScreen + base.height - 48, 48, 44), Game1.mouseCursors, new Rectangle(365, 495, 12, 11), 4f)
            {
                myID = region_forwardButton
            };

            if (Game1.options.SnappyMenus)
            {
                base.populateClickableComponentList();
                this.snapToDefaultClickableComponent();
            }
        }
コード例 #2
0
 public ChooseFromListMenu(List <string> options, actionOnChoosingListOption chooseAction, bool isJukebox = false, string default_selection = null)
     : base(Game1.uiViewport.Width / 2 - 320, Game1.uiViewport.Height - 64 - 192, 640, 192)
 {
     this.chooseAction = chooseAction;
     backButton        = new ClickableTextureComponent(new Rectangle(xPositionOnScreen - 128 - 4, yPositionOnScreen + 85, 48, 44), Game1.mouseCursors, new Rectangle(352, 495, 12, 11), 4f)
     {
         myID            = 101,
         rightNeighborID = 102
     };
     forwardButton = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + 640 + 16 + 64, yPositionOnScreen + 85, 48, 44), Game1.mouseCursors, new Rectangle(365, 495, 12, 11), 4f)
     {
         myID            = 102,
         leftNeighborID  = 101,
         rightNeighborID = 103
     };
     okButton = new ClickableTextureComponent("OK", new Rectangle(xPositionOnScreen + width + 128 + 8, yPositionOnScreen + 192 - 128, 64, 64), null, null, Game1.mouseCursors, new Rectangle(175, 379, 16, 15), 4f)
     {
         myID            = 103,
         leftNeighborID  = 102,
         rightNeighborID = 104
     };
     cancelButton = new ClickableTextureComponent("OK", new Rectangle(xPositionOnScreen + width + 192 + 12, yPositionOnScreen + 192 - 128, 64, 64), null, null, Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 47), 1f)
     {
         myID           = 104,
         leftNeighborID = 103
     };
     Game1.playSound("bigSelect");
     this.isJukebox = isJukebox;
     if (isJukebox)
     {
         FilterJukeboxTracks(options);
     }
     this.options = options;
     if (default_selection != null)
     {
         int default_index = options.IndexOf(default_selection);
         if (default_index >= 0)
         {
             index = default_index;
         }
     }
     if (Game1.options.SnappyMenus)
     {
         populateClickableComponentList();
         snapToDefaultClickableComponent();
     }
 }
コード例 #3
0
        public ChooseFromListMenu(List <string> options, actionOnChoosingListOption chooseAction, bool isJukebox = false, string default_selection = null)
            : base(Game1.viewport.Width / 2 - 320, Game1.viewport.Height - 64 - 192, 640, 192)
        {
            this.chooseAction = chooseAction;
            backButton        = new ClickableTextureComponent(new Rectangle(xPositionOnScreen - 128 - 4, yPositionOnScreen + 85, 48, 44), Game1.mouseCursors, new Rectangle(352, 495, 12, 11), 4f)
            {
                myID            = 101,
                rightNeighborID = 102
            };
            forwardButton = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + 640 + 16 + 64, yPositionOnScreen + 85, 48, 44), Game1.mouseCursors, new Rectangle(365, 495, 12, 11), 4f)
            {
                myID            = 102,
                leftNeighborID  = 101,
                rightNeighborID = 103
            };
            okButton = new ClickableTextureComponent("OK", new Rectangle(xPositionOnScreen + width + 128 + 8, yPositionOnScreen + 192 - 128, 64, 64), null, null, Game1.mouseCursors, new Rectangle(175, 379, 16, 15), 4f)
            {
                myID            = 103,
                leftNeighborID  = 102,
                rightNeighborID = 104
            };
            cancelButton = new ClickableTextureComponent("OK", new Rectangle(xPositionOnScreen + width + 192 + 12, yPositionOnScreen + 192 - 128, 64, 64), null, null, Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 47), 1f)
            {
                myID           = 104,
                leftNeighborID = 103
            };
            Game1.playSound("bigSelect");
            this.isJukebox = isJukebox;
            if (isJukebox)
            {
                for (int i = options.Count - 1; i >= 0; i--)
                {
                    if (options[i].ToLower().Contains("ambient") || options[i].ToLower().Contains("bigdrums") || options[i].ToLower().Contains("clubloop") || options[i].ToLower().Contains("ambience"))
                    {
                        options.RemoveAt(i);
                    }
                    else
                    {
                        switch (options[i])
                        {
                        case "ocean":
                            options.RemoveAt(i);
                            break;

                        case "communityCenter":
                            options.RemoveAt(i);
                            break;

                        case "nightTime":
                            options.RemoveAt(i);
                            break;

                        case "title_day":
                            options.RemoveAt(i);
                            options.Add("MainTheme");
                            break;

                        case "coin":
                            options.RemoveAt(i);
                            break;

                        case "buglevelloop":
                            options.RemoveAt(i);
                            break;

                        case "jojaOfficeSoundscape":
                            options.RemoveAt(i);
                            break;
                        }
                    }
                }
            }
            this.options = options;
            if (default_selection != null)
            {
                int default_index = options.IndexOf(default_selection);
                if (default_index >= 0)
                {
                    index = default_index;
                }
            }
            if (Game1.options.SnappyMenus)
            {
                populateClickableComponentList();
                snapToDefaultClickableComponent();
            }
        }