Beispiel #1
0
        public static void CreateSourceSettingsUI(SubMenu parent)
        {
            var beastSaber = parent.AddSubMenu("BeastSaber", "Settings for the BeastSaber feed source.", true);

            CreateBeastSaberSettingsUI(beastSaber, Config.BeastSaber);
            var beatSaver = parent.AddSubMenu("Beat Saver", "Settings for the BeatSaver feed source.", true);

            CreateBeatSaverSettingsUI(beatSaver, Config.BeatSaver);
            var scoreSaber = parent.AddSubMenu("ScoreSaber", "Settings for the ScoreSaber feed source.", true);

            CreateScoreSaberSettingsUI(scoreSaber, Config.ScoreSaber);
        }
Beispiel #2
0
    void Start()
    {
        // プレハブをInstantiate
        var manager = Instantiate(debugUiManagerPrefab, null, false);

        // 描画カメラを指定して手動で開始
        manager.ManualStart(mainCamera);
        sampleWindow = new SampleWindow(manager);
        manager.Add(sampleWindow, 0, 0, AlignX.Right, AlignY.Bottom);

        menu = new Menu(100, 40);
        var subA = new SubMenu("SubA", 100, 40, Direction.Down);

        subA.AddItem("A1", () => Debug.Log("A1"));
        subA.AddItem("A2", () => Debug.Log("A2"));
        var subB = new SubMenu("SubA", 100, 40, Direction.Down);

        subB.AddItem("B1", () => Debug.Log("B1"));
        subB.AddItem("B2", () => Debug.Log("B2"));
        subA.AddSubMenu(subB, Direction.Right);
        menu.AddSubMenu(subA, Direction.Down);
        menu.AddItem("1", () => Debug.Log("1"));
        menu.AddItem("2", () => Debug.Log("2"));
        manager.Add(menu, 0, 0);
    }
Beispiel #3
0
        public static void CreateBeatSyncSettingsUI(SubMenu parent)
        {
            var timeoutInt = parent.AddInt("Download Timeout",
                                           "How long in seconds to wait for Beat Saver to respond to a download request",
                                           5, 60, 1);

            timeoutInt.GetValue += delegate { return(Config.DownloadTimeout); };
            timeoutInt.SetValue += delegate(int value)
            {
                if (Config.DownloadTimeout == value)
                {
                    return;
                }
                Config.DownloadTimeout = value;
                //Config.SetConfigChanged();
            };

            var maxConcurrentDownloads = parent.AddInt("Max Concurrent Downloads",
                                                       "How many song downloads can happen at the same time.",
                                                       1, 10, 1);

            maxConcurrentDownloads.GetValue += delegate { return(Config.MaxConcurrentDownloads); };
            maxConcurrentDownloads.SetValue += delegate(int value)
            {
                if (Config.MaxConcurrentDownloads == value)
                {
                    return;
                }
                Config.MaxConcurrentDownloads = value;
                // Config.ConfigChanged = true;
            };

            var recentPlaylistDays = parent.AddInt("Recent Playlist Days",
                                                   "How long in days songs downloaded by BeatSync are kept in the BeatSync Recent playlist (0 to disable the playlist).",
                                                   0, 60, 1);

            recentPlaylistDays.GetValue += delegate { return(Config.RecentPlaylistDays); };
            recentPlaylistDays.SetValue += delegate(int value)
            {
                if (Config.RecentPlaylistDays == value)
                {
                    return;
                }
                Config.RecentPlaylistDays = value;
                // Config.ConfigChanged = true;
            };

            var allBeatSyncSongs = parent.AddBool("Enable All BeatSync Songs",
                                                  "Maintain a playlist that has all the songs downloaded by BeatSync.");

            allBeatSyncSongs.GetValue += delegate { return(Config.AllBeatSyncSongsPlaylist); };
            allBeatSyncSongs.SetValue += delegate(bool value)
            {
                if (Config.AllBeatSyncSongsPlaylist == value)
                {
                    return;
                }
                Config.AllBeatSyncSongsPlaylist = value;
                // Config.ConfigChanged = true;
            };

            var timeBetweenSyncs = parent.AddSubMenu("Time Between Syncs",
                                                     "Minimum amount of time between BeatSync syncs (Set both to 0 to run BeatSync every time the game is started).", true);
            var hours = timeBetweenSyncs.AddInt("Hours", "Number of hours between BeatSync syncs.", 0, 100, 1);

            hours.GetValue += delegate { return(Config.TimeBetweenSyncs.Hours); };
            hours.SetValue += delegate(int value)
            {
                if (Config.TimeBetweenSyncs.Hours == value)
                {
                    return;
                }
                Config.TimeBetweenSyncs.Hours = value;
                // Config.ConfigChanged = true;
            };

            var minutes = timeBetweenSyncs.AddInt("Minutes", "Number of minutes between BeatSync syncs.", 0, 59, 1);

            minutes.GetValue += delegate { return(Config.TimeBetweenSyncs.Minutes); };
            minutes.SetValue += delegate(int value)
            {
                if (Config.TimeBetweenSyncs.Minutes == value)
                {
                    return;
                }
                Config.TimeBetweenSyncs.Minutes = value;
                // Config.ConfigChanged = true;
            };
        }
Beispiel #4
0
        public static SubMenu CreateFeedSettings(string feedName, string feedSource, FeedConfigBase feedConfig, SubMenu parent, string menuHintText = "")
        {
            if (string.IsNullOrEmpty(menuHintText))
            {
                menuHintText = $"Settings for {feedSource}'s {feedName} feed";
            }
            var feedSubMenu = parent.AddSubMenu(feedName, menuHintText, true);
            var enabled     = feedSubMenu.AddBool("Enable",
                                                  $"Enable the {feedName} feed from {feedSource}.");

            enabled.GetValue += delegate { return(feedConfig.Enabled); };
            enabled.SetValue += delegate(bool value)
            {
                if (feedConfig.Enabled == value)
                {
                    return;
                }
                feedConfig.Enabled = value;
                // Config.ConfigChanged = true;
            };

            var maxSongs = feedSubMenu.AddInt("Max Songs",
                                              "Maximum number of songs to download (0 for all).",
                                              0, 500, 5);

            maxSongs.GetValue += delegate { return(feedConfig.MaxSongs); };
            maxSongs.SetValue += delegate(int value)
            {
                if (feedConfig.MaxSongs == value)
                {
                    return;
                }
                feedConfig.MaxSongs = value;
                // Config.ConfigChanged = true;
            };

            var createPlaylist = feedSubMenu.AddBool("Create Playlist",
                                                     $"Maintain a playlist for this feed.");

            createPlaylist.GetValue += delegate { return(feedConfig.CreatePlaylist); };
            createPlaylist.SetValue += delegate(bool value)
            {
                if (feedConfig.CreatePlaylist == value)
                {
                    return;
                }
                feedConfig.CreatePlaylist = value;
                // Config.ConfigChanged = true;
            };

            string[] textSegmentOptions  = new string[] { "Append", "Replace" };
            var      textSegmentsExample = feedSubMenu.AddTextSegments("Playlist Style", "Select 'Append' to add new songs to playlist, 'Replace' to create a fresh playlist with songs read from the feed this session.", textSegmentOptions);

            textSegmentsExample.GetValue += delegate { return(feedConfig.PlaylistStyle == PlaylistStyle.Append ? 0 : 1); };
            textSegmentsExample.SetValue += delegate(int value)
            {
                PlaylistStyle newStyle = value == 0 ? PlaylistStyle.Append : PlaylistStyle.Replace;
                if (feedConfig.PlaylistStyle == newStyle)
                {
                    return;
                }
                feedConfig.PlaylistStyle = newStyle;
                // Config.ConfigChanged = true;
            };
            return(feedSubMenu);
        }