internal virtual void Abort(bool promptForConfirmation) { if (promptForConfirmation) { pDialog dialog = new pDialog("Would you like to cancel the download?", true); dialog.AddOption("Yes, cancel this download.", Color.OrangeRed, delegate { Abort(false); }); dialog.AddOption("No, keep downloading.", Color.YellowGreen, null); GameBase.ShowDialog(dialog); return; } onAbort(); }
private void Display() { pDialog dialog = new pDialog(null, false); dialog.spriteManager.HandleOverlayInput = true; dialog.ButtonOffset = new Vector2(50, 60); ChatEngine.RequestUserStats(new List <User>() { User }, true); bool isSelf = User.Name == GameBase.User.Name; dialog.Closed += delegate { ActiveProfiles.Remove(this); }; if (User.IsOsu && !isSelf) { if (GameBase.Mode != OsuModes.Edit && (GameBase.Mode != OsuModes.Play || !GameBase.TestMode)) { dialog.AddOption(User == StreamingManager.CurrentlySpectating ? LocalisationManager.GetString(OsuString.UserProfile_StopSpectating) : LocalisationManager.GetString(OsuString.UserProfile_StartSpectating), Color.YellowGreen, delegate { if (Lobby.Status != LobbyStatus.NotJoined) { NotificationManager.ShowMessage( LocalisationManager.GetString(OsuString.UserProfile_CantSpectate)); return; } if (GameBase.Mode == OsuModes.Play && !InputManager.ReplayMode) { NotificationManager.ShowMessage( LocalisationManager.GetString(OsuString.UserProfile_CantSpectate)); return; } if (User.Name == ConfigManager.sUsername || User == StreamingManager.CurrentlySpectating) { StreamingManager.StopSpectating(true); } else { StreamingManager.StartSpectating(User); } }); } } dialog.AddOption(LocalisationManager.GetString(OsuString.UserProfile_ViewProfile), new Color(58, 110, 165), delegate { GameBase.ProcessStart(User.Id == 0 ? @"https://osu.ppy.sh/wiki/BanchoBot" : String.Format(Urls.USER_PROFILE, User.Id)); }); if (isSelf) { if (GameBase.Mode == OsuModes.Menu && BanchoClient.AllowUserSwitching) { dialog.AddOption(LocalisationManager.GetString(OsuString.UserProfile_SignOut), Color.Orange, delegate { GameBase.Options.PerformLogout(); if (!GameBase.Options.Expanded) { GameBase.ShowLogin(); } }); } dialog.AddOption(LocalisationManager.GetString(OsuString.UserProfile_ChangeAvatar), Color.Orange, delegate { GameBase.ProcessStart(Urls.USER_SET_AVATAR); }); } else { dialog.AddOption(LocalisationManager.GetString(OsuString.UserProfile_StartChat), Color.MediumPurple, delegate { ChatEngine.StartChat(User); }); if (User.IsOsu) { if (MatchSetup.Match != null) { dialog.AddOption(LocalisationManager.GetString(OsuString.UserProfile_Invitetogame), Color.Yellow, delegate { BanchoClient.SendRequest(new Request(RequestType.Osu_Invite, new bInt(User.Id))); NotificationManager.ShowMessageMassive(string.Format(LocalisationManager.GetString(OsuString.ChatEngine_UserInvited), User.Name)); }); } } dialog.AddOption(User.IsFriend ? LocalisationManager.GetString(OsuString.UserProfile_CancelFriendship) : LocalisationManager.GetString(OsuString.UserProfile_AddFriend), Color.Pink, delegate { ChatEngine.ToggleFriend(User, !User.IsFriend); }); if (ShowExtraOptions && User.Id > 0) { dialog.AddOption(LocalisationManager.GetString(OsuString.UserProfile_ReportUser), Color.Red, delegate { UserReportDialog report = new UserReportDialog(User, ChatEngine.activeChannel); GameBase.ShowDialog(report); }); if (ChatEngine.CheckIgnore(User)) { dialog.AddOption(LocalisationManager.GetString(OsuString.UserProfile_UnignoreUser), Color.Gray, delegate { ChatEngine.UnignoreUser(User); }); } else { dialog.AddOption(LocalisationManager.GetString(OsuString.UserProfile_IgnoreUser), Color.Gray, delegate { ChatEngine.IgnoreUser(User); }); } } } dialog.AddOption(LocalisationManager.GetString(OsuString.General_Close), Color.DarkGray, null); if (DisplayedUser.DrawAt(new Vector2(5, 5), true, 0)) { dialog.spriteManager.Add(DisplayedUser.Sprites); } GameBase.ShowDialog(dialog); /*if (User.Id != 0) * { * GameBase.Scheduler.Add(delegate * { * if (!dialog.IsDisplayed) return; * * if (browser == null) * { * GameBase.OnResolutionChange += GameBase_OnResolutionChange; * browser = new pBrowser(null, Vector2.Zero, new Vector2(220, GameBase.WindowManager.Height - 48 * GameBase.WindowManager.Ratio), 0.911f, Color.White); * browser.Disposable = false; * browser.OnLoaded += delegate * { * browser.FadeIn(500); * browser.MoveToRelative(new Vector2(88, 0), 500, EasingTypes.In); * }; * } * * browser.Transformations.Clear(); * browser.CurrentAlpha = 0; * browser.AlwaysDraw = true; * browser.CurrentPosition = new Vector2(-88, 48); * browser.Load(string.Format(Urls.USER_PROFILE_COMPACT, User.Id)); * * dialog.spriteManager.Add(browser); * }, 1000); * }*/ }
/// <summary> /// Detect and process new files in the songs folder. /// </summary> private static void processSongs() { int newFolderCount = -1; //Process any new files waiting to be imported. if (handleNewFiles() || BeatmapManager.ChangedPackages.Count > 0 || BeatmapManager.ChangedFolders.Count > 0) { //We might need a full refresh even with new files added, if this is signalled. forceFullRefresh = false; } else { //Check if the number of directories in the songs dir has changed. //If it has, then we definitely need to do a full pass over available maps. newFolderCount = Directory.GetDirectories(BeatmapManager.SongsDirectory).Length + Directory.GetFiles(BeatmapManager.SongsDirectory).Length; if (BeatmapManager.FolderFileCount != newFolderCount) { Debug.Print(@"Folder/Filecount changed from {0} to {1}", BeatmapManager.FolderFileCount, newFolderCount); string _status = null; if (BeatmapManager.FolderFileCount == 0) { _status = LocalisationManager.GetString(OsuString.BeatmapImport_TimeToPopulateAnEmptyDatabase); promptOnFullProcess = false; } else if (BeatmapManager.FolderFileCount < newFolderCount) { _status = LocalisationManager.GetString(OsuString.BeatmapImport_DetectedNewMapsAdded); } else { _status = LocalisationManager.GetString(OsuString.BeatmapImport_DetectedMapsRemoved); } if (status != null) { status.SetStatus(_status); } forceFullRefresh = true; } } if (status != null) { BeatmapManager.AssignStatusHandler(status.SetStatus); } //confirm this operation if the user has a lot of maps. if (forceFullRefresh && promptOnFullProcess #if !DEBUG && BeatmapManager.Beatmaps.Count > 1000 #endif ) { bool response = false; GameBase.RunBackgroundThread(delegate { pDialog pd = new pDialog(LocalisationManager.GetString(OsuString.BeatmapImport_FullProcess), false); pd.Closed += delegate { promptOnFullProcess = false; }; pd.AddOption(LocalisationManager.GetString(OsuString.General_Confirm), Color.YellowGreen, delegate { response = true; promptOnFullProcess = false; }); pd.AddOption(LocalisationManager.GetString(OsuString.General_Cancel), Color.OrangeRed, delegate { response = false; promptOnFullProcess = false; }); GameBase.Scheduler.Add(delegate { GameBase.ShowDialog(pd); }); }); while (promptOnFullProcess && GameBase.Mode == OsuModes.BeatmapImport) { Thread.Sleep(50); } if (!response) { GameBase.Scheduler.Add(Exit); BeatmapManager.ClearStatusHandlers(); return; } } BeatmapManager.CheckAndProcess(forceFullRefresh, promptOnFullProcess); BeatmapManager.ClearStatusHandlers(); if (newFolderCount >= 0) { BeatmapManager.FolderFileCount = newFolderCount; } GameBase.Scheduler.Add(Exit); }