/// <summary> /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnGameEnded(object sender, GameEndedEventArgs e) { Screen.IsPaused = true; var screen = new MultiplayerScreen(OnlineManager.CurrentGame, true); Screen.Exit(() => new ResultScreen(Screen, GetScoreboardUsers(), screen)); }
/// <summary> /// </summary> public SelectScreen(MultiplayerScreen screen = null) { MultiplayerScreen = screen; // Go to the import screen if we've imported a map not on the select screen if (MapsetImporter.Queue.Count > 0 || QuaverSettingsDatabaseCache.OutdatedMaps.Count != 0 || MapDatabaseCache.MapsToUpdate.Count != 0) { Exit(() => new ImportingScreen()); return; } // Grab the mapsets available to the user according to their previous search term. AvailableMapsets = MapsetHelper.SearchMapsets(MapManager.Mapsets, PreviousSearchTerm); // If no mapsets were found, just default to all of them. if (AvailableMapsets.Count == 0) { AvailableMapsets = MapManager.Mapsets; } AvailableMapsets = MapsetHelper.OrderMapsetsByConfigValue(AvailableMapsets); Logger.Debug($"There are currently: {AvailableMapsets.Count} available mapsets to play in select.", LogType.Runtime); if (OnlineManager.CurrentGame == null) { DiscordHelper.Presence.Details = "Selecting a song"; DiscordHelper.Presence.State = "In the menus"; DiscordRpc.UpdatePresence(ref DiscordHelper.Presence); } else { OnlineManager.Client?.SetGameCurrentlySelectingMap(true); } ConfigManager.AutoLoadOsuBeatmaps.ValueChanged += OnAutoLoadOsuBeatmapsChanged; ConfigManager.DisplayFailedLocalScores.ValueChanged += OnDisplayFailedScoresChanged; var game = GameBase.Game as QuaverGame; var cursor = game?.GlobalUserInterface.Cursor; cursor.Alpha = 1; // Let spectators know that we're selecting a new song if (OnlineManager.IsBeingSpectated) { OnlineManager.Client?.SendReplaySpectatorFrames(SpectatorClientStatus.SelectingSong, -1, new List <ReplayFrame>()); } View = new SelectScreenView(this); }
public ChatBox(UDim2 position, UDim2 size, GUITheme theme, MultiplayerScreen screen) : base(position, size, theme) { this.screen = screen; items = new List <ChatItem>(); Image = null; font = AssetManager.LoadFont("arial-bold-11"); textField = new GUITextField(new UDim2(0, 0, 1f, -15), new UDim2(1f, 0, 0, 30), theme) { Parent = this }; textField.OnEnterPressed += TextField_OnEnterPressed; }
public ScreenManager(MainGame game, GraphicsDeviceManager graphics) { this.graphics = graphics; gameScreen = new GameScreen(game); menuScreen = new MenuScreen(game); settingScreen = new SettingScreen(game); multiplayerScreen = new MultiplayerScreen(game); loginScreen = new LoginScreen(game); lobbyScreen = new LobbyScreen(game); CurrentScreen = loginScreen; ChangeRes(CurrentScreen.ScreenWidth, CurrentScreen.ScreenHeight, CurrentScreen.IsFullScreen); game.IsMouseVisible = true; }
/// <summary> /// </summary> /// <param name="gameplay"></param> /// <param name="multiplayerScores"></param> /// <param name="multiplayerScreen"></param> public ResultScreen(GameplayScreen gameplay, List <ScoreboardUser> multiplayerScores = null, MultiplayerScreen multiplayerScreen = null) { Gameplay = gameplay; ResultsType = ResultScreenType.Gameplay; ScoreProcessor = Gameplay.Ruleset.ScoreProcessor; MultiplayerScores = multiplayerScores; MultiplayerScreen = multiplayerScreen; InitializeIfGameplayType(); ChangeDiscordPresence(); if (MultiplayerScores != null) { Logger.Important($"Multiplayer Player Game Finished!", LogType.Network); MultiplayerScores.ForEach(x => { var modsString = "None"; try { modsString = ModHelper.GetModsString(x.Processor.Mods); } catch (Exception) { // ignored } Logger.Important($"{(x.UsernameRaw)}: {x.Processor.Score}, {x.Processor.Accuracy}, " + $"{x.Processor.TotalJudgementCount}, {x.RatingProcessor.CalculateRating(x.Processor)} | " + $"{modsString}", LogType.Network); }); } View = new ResultScreenView(this); CacheMultiplayerScoreContainers(); }
/// <summary> /// Exits the screen back to the main menu /// </summary> public void ExitToMenu() { if (IsFetchingOnlineReplay) { return; } if (OnlineManager.CurrentGame != null) { var view = View as ResultScreenView; if (view?.SelectedMultiplayerUser?.Value != null) { view.SelectedMultiplayerUser.Value = null; return; } Exit(() => MultiplayerScreen ?? new MultiplayerScreen(OnlineManager.CurrentGame)); MultiplayerScreen.SetRichPresence(); return; } Exit(() => new SelectScreen()); }
/// <summary> /// </summary> public ImportingScreen(MultiplayerScreen multiplayerScreen = null) { MultiplayerScreen = multiplayerScreen; PreviouslySelectedMap = MapManager.Selected.Value; View = new ImportingScreenView(this); }
public override void Update(GameTime gameTime) { EllapsedTime += gameTime.ElapsedGameTime.TotalSeconds; if (EllapsedTime >= 10) { int OldNumberOfGameScreen = ListGameScreen.Count; MultiplayerScreen Autoplay = new MultiplayerScreen(); Autoplay.Load(); Constants.ShowAnimation = false; DeathmatchMap NewMap = Autoplay.LoadAutoplay(); NewMap.ListGameScreen = ListGameScreen; NewMap.Load(); NewMap.Init(); NewMap.TogglePreview(true); //Remove any GameScreen created by the map so they don't show up immediately. List <GameScreen> ListGameScreenCreatedByMap = new List <GameScreen>(ListGameScreen.Count - OldNumberOfGameScreen); for (int S = ListGameScreen.Count - 1 - OldNumberOfGameScreen; S >= 0; --S) { ListGameScreenCreatedByMap.Add(ListGameScreen[S]); ListGameScreen.RemoveAt(S); } RemoveAllScreens(); ListGameScreen.Insert(0, NewMap); NewMap.Update(gameTime); for (int S = 0; S < ListGameScreenCreatedByMap.Count; ++S) { ListGameScreen.Insert(0, ListGameScreenCreatedByMap[S]); ListGameScreenCreatedByMap[S].Update(gameTime); } ListGameScreenCreatedByMap.Clear(); } if (InputHelper.InputUpPressed()) { EllapsedTime = 0; SelectedChoice--; sndSelection.Play(); if (SelectedChoice == -1) { SelectedChoice = 4; } } else if (InputHelper.InputDownPressed()) { EllapsedTime = 0; SelectedChoice++; sndSelection.Play(); if (SelectedChoice == 5) { SelectedChoice = 0; } } else if (InputHelper.InputConfirmPressed()) { switch ((MenuChoices)SelectedChoice) { case MenuChoices.NewGame: sndIntroSong.Stop(); sndConfirm.Play(); /* * * int OldNumberOfGameScreen = ListGameScreen.Count; * StreamReader BR = new StreamReader("Content/Map path.ini"); * DeathmatchMap NewMap = new DeathmatchMap(BR.ReadLine(), 0, new Dictionary<string, List<Core.Units.Squad>>()); * BR.Close(); * NewMap.ListGameScreen = ListGameScreen; * NewMap.PlayerRoster = new Roster(); * NewMap.PlayerRoster.LoadRoster(); * NewMap.Load(); * NewMap.Init(); * NewMap.TogglePreview(true); * * //Remove any GameScreen created by the map so they don't show up immediately. * List<GameScreen> ListGameScreenCreatedByMap = new List<GameScreen>(ListGameScreen.Count - OldNumberOfGameScreen); * for (int S = ListGameScreen.Count - 1 - OldNumberOfGameScreen; S >= 0; --S) * { * ListGameScreenCreatedByMap.Add(ListGameScreen[S]); * ListGameScreen.RemoveAt(S); * } * * RemoveAllScreens(); * ListGameScreen.Insert(0, NewMap); * NewMap.Update(gameTime); * * for (int S = 0; S < ListGameScreenCreatedByMap.Count; ++S) * { * ListGameScreen.Insert(0, ListGameScreenCreatedByMap[S]); * ListGameScreenCreatedByMap[S].Update(gameTime); * } * * ListGameScreenCreatedByMap.Clear();*/ PushScreen(new GameSelection()); break; case MenuChoices.QuickLoad: if (File.Exists("User Data/Saves/TempSave.sav")) { sndIntroSong.Stop(); sndConfirm.Play(); BattleMap QuickLoadMap = BattleMap.LoadTemporaryMap(ListGameScreen); QuickLoadMap.TogglePreview(true); ListGameScreen.Insert(0, QuickLoadMap); } else { sndDeny.Play(); } break; case MenuChoices.Encyclopedia: sndDeny.Play(); break; case MenuChoices.Option: PushScreen(new OptionMenu()); sndConfirm.Play(); break; case MenuChoices.LoadGame: if (File.Exists("User Data/Saves/SRWE Save.bin")) { sndIntroSong.Stop(); sndConfirm.Play(); Roster PlayerRoster = new Roster(); PlayerRoster.LoadRoster(); Dictionary <string, Unit> DicUnitType = Unit.LoadAllUnits(); Dictionary <string, BaseSkillRequirement> DicRequirement = BaseSkillRequirement.LoadAllRequirements(); Dictionary <string, BaseEffect> DicEffect = BaseEffect.LoadAllEffects(); Dictionary <string, AutomaticSkillTargetType> DicAutomaticSkillTarget = AutomaticSkillTargetType.LoadAllTargetTypes(); Dictionary <string, ManualSkillTarget> DicManualSkillTarget = ManualSkillTarget.LoadAllTargetTypes(); DataScreen.LoadProgression(PlayerRoster, DicUnitType, DicRequirement, DicEffect, DicAutomaticSkillTarget, DicManualSkillTarget); PushScreen(new NewIntermissionScreen(PlayerRoster)); } else { sndDeny.Play(); } break; } } }
public override void Update(GameTime gameTime) { EllapsedTime += gameTime.ElapsedGameTime.TotalSeconds; if (EllapsedTime >= 10) { RemoveScreen(this); MultiplayerScreen Autoplay = new MultiplayerScreen(); Autoplay.Load(); Constants.ShowAnimation = false; PushScreen(Autoplay.LoadAutoplay()); } if (InputHelper.InputUpPressed()) { EllapsedTime = 0; SelectedChoice--; sndSelection.Play(); if (SelectedChoice == -1) { SelectedChoice = 4; } } else if (InputHelper.InputDownPressed()) { EllapsedTime = 0; SelectedChoice++; sndSelection.Play(); if (SelectedChoice == 5) { SelectedChoice = 0; } } else if (InputHelper.InputConfirmPressed()) { switch ((MenuChoices)SelectedChoice) { case MenuChoices.NewGame: sndIntroSong.Stop(); sndConfirm.Play(); /*StreamReader BR = new StreamReader("Content/Map path.ini"); * PushScreen(new DeathmatchMap(BR.ReadLine(), 0, new System.Collections.Generic.List<Core.Units.Squad>())); * BR.Close();*/ PushScreen(new GameSelection()); break; case MenuChoices.QuickLoad: if (File.Exists("TempSave.sav")) { sndIntroSong.Stop(); sndConfirm.Play(); BattleMap QuickLoadMap = BattleMap.LoadTemporaryMap(); QuickLoadMap.ListGameScreen = ListGameScreen; ListGameScreen.Insert(0, QuickLoadMap); } else { sndDeny.Play(); } break; case MenuChoices.Encyclopedia: sndDeny.Play(); break; case MenuChoices.Option: PushScreen(new OptionMenu()); sndConfirm.Play(); break; case MenuChoices.LoadGame: if (File.Exists("SRWE Save.bin")) { sndIntroSong.Stop(); sndConfirm.Play(); PushScreen(new IntermissionScreen()); } else { sndDeny.Play(); } break; } } }
/// <summary> /// </summary> public MultiplayerMap(MultiplayerScreen screen, MultiplayerGame game) : base(new ScalableVector2(682, 86), new ScalableVector2(682, 86)) { Screen = screen; Game = game; Size = new ScalableVector2(650, 86); Image = UserInterface.MapPanel; DownloadButton = new ImageButton(UserInterface.BlankBox, OnDownloadButtonClicked) { Parent = this, Alignment = Alignment.MidCenter, Size = new ScalableVector2(Width - 4, Height - 4), Alpha = 0 }; Background = new Sprite { Parent = this, Size = new ScalableVector2(Height * 1.70f, Height - 4), Alignment = Alignment.MidLeft, X = 2, Image = MapManager.Selected.Value == BackgroundHelper.Map && MapManager.Selected.Value.Md5Checksum == Game.MapMd5 ? BackgroundHelper.RawTexture: UserInterface.MenuBackground, Alpha = MapManager.Selected.Value == BackgroundHelper.Map && MapManager.Selected.Value.Md5Checksum == Game.MapMd5 ? 1 : 0 }; AddContainedDrawable(Background); var diffName = GetDifficultyName(); ArtistTitle = new SpriteTextBitmap(FontsBitmap.GothamRegular, game.Map.Replace($"[{diffName}]", "")) { Parent = this, X = Background.X + Background.Width + 16, Y = 12, FontSize = 16 }; AddContainedDrawable(ArtistTitle); Mode = new SpriteTextBitmap(FontsBitmap.GothamRegular, "[" + ModeHelper.ToShortHand((GameMode)game.GameMode) + "]") { Parent = this, X = ArtistTitle.X, Y = ArtistTitle.Y + ArtistTitle.Height + 8, FontSize = 14 }; AddContainedDrawable(Mode); DifficultyRating = new SpriteTextBitmap(FontsBitmap.GothamRegular, $"{game.DifficultyRating:0.00}") { Parent = this, X = Mode.X + Mode.Width + 8, Y = Mode.Y, FontSize = 14, Tint = ColorHelper.DifficultyToColor((float)game.DifficultyRating) }; AddContainedDrawable(DifficultyRating); DifficultyName = new SpriteTextBitmap(FontsBitmap.GothamRegular, " - \"" + diffName + "\"") { Parent = this, X = DifficultyRating.X + DifficultyRating.Width + 2, Y = Mode.Y, FontSize = 14, }; AddContainedDrawable(DifficultyName); Creator = new SpriteTextBitmap(FontsBitmap.GothamRegular, "Mods: None") { Parent = this, X = Mode.X, Y = DifficultyRating.Y + DifficultyRating.Height + 8, FontSize = DifficultyRating.FontSize }; AddContainedDrawable(Creator); BackgroundHelper.Loaded += OnBackgroundLoaded; OnlineManager.Client.OnGameMapChanged += OnGameMapChanged; OnlineManager.Client.OnChangedModifiers += OnChangedModifiers; OnlineManager.Client.OnGameHostSelectingMap += OnGameHostSelectingMap; ModManager.ModsChanged += OnModsChanged; BackgroundHelper.Load(MapManager.Selected.Value); UpdateContent(); }
public CTFGamemode(MultiplayerScreen screen) : base(screen, GamemodeType.CTF) { }
public TDMGamemode(MultiplayerScreen screen) : base(screen, GamemodeType.TDM) { }
public LobyMessageScript(MultiplayerScreen Loby, string Text) : base("Message", Loby) { this.Text = Text; }
public LobyMessageScript(MultiplayerScreen Loby) : this(Loby, null) { }
protected LobyScript(string Name, MultiplayerScreen Loby) : base(Name) { this.Loby = Loby; }