/// <inheritdoc /> /// <summary> /// </summary> /// <param name="dialog"></param> /// <param name="container"></param> /// <param name="item"></param> /// <param name="index"></param> public MenuDialogItem(MenuDialog dialog, PoolableScrollContainer <IMenuDialogOption> container, IMenuDialogOption item, int index) : base(container, item, index) { Size = new ScalableVector2(Container.Width, HEIGHT); Alpha = 0; Button = new MenuDialogItemButton(Container, (o, e) => { Item.ClickAction(); DialogManager.Dismiss(dialog); }) { Parent = this, Size = Size, Alpha = 0 }; Name = new SpriteTextBitmap(FontsBitmap.GothamRegular, Item.Name) { Parent = this, Alignment = Alignment.MidLeft, X = 15, FontSize = 14, Tint = Item.Color }; }
/// <inheritdoc /> /// <summary> /// </summary> /// <param name="user"></param> /// <param name="container"></param> public ResultMultiplayerScoreboardUserButton(ScoreboardUser user, PoolableScrollContainer <ScoreboardUser> container) : base(UserInterface.BlankBox) { Container = container; Alpha = 0; Clicked += (o, e) => { var game = (QuaverGame)GameBase.Game; var results = (ResultScreen)game.CurrentScreen; var view = (ResultScreenView)results.View; view.SelectedMultiplayerUser.Value = user; }; }
/// <summary> /// </summary> /// <param name="container"></param> /// <param name="item"></param> /// <param name="index"></param> public MultiplayerSettingsItem(PoolableScrollContainer <IMultiplayerSettingsItem> container, IMultiplayerSettingsItem item, int index) : base(container, item, index) { Size = new ScalableVector2(Container.Width, HEIGHT); X = 0; Alpha = 1; Button = new MultiplayerSettingsItemButton(Container, (o, e) => { // Only allow host to change settings if (OnlineManager.CurrentGame.HostId != OnlineManager.Self.OnlineUser.Id) { return; } if (OnlineManager.CurrentGame.InProgress) { NotificationManager.Show(NotificationLevel.Error, "Wait until the match has finished before changing settings!"); return; } var dialog = Item.CreateDialog?.Invoke(); if (dialog != null) { DialogManager.Show(dialog); } }) { Parent = this, Size = Size, Alpha = 0, Tint = Colors.MainAccent, UsePreviousSpriteBatchOptions = true }; Name = new SpriteTextBitmap(FontsBitmap.GothamRegular, item.Name) { Parent = this, Alignment = Alignment.MidLeft, UsePreviousSpriteBatchOptions = true, FontSize = 16, X = 22 }; item.Value.Parent = this; item.Value.UsePreviousSpriteBatchOptions = true; item.Value.Alignment = Alignment.MidRight; item.Value.X = -Name.X - 4; }
/// <inheritdoc /> /// <summary> /// </summary> /// <param name="container"></param> /// <param name="item"></param> /// <param name="index"></param> public DrawableJudgementWindows(PoolableScrollContainer <JudgementWindows> container, JudgementWindows item, int index) : base(container, item, index) { Size = new ScalableVector2(Container.Width, HEIGHT); Alpha = 0; Button = new ImageButton(UserInterface.BlankBox, (sender, args) => JudgementWindowsDatabaseCache.Selected.Value = item) { Parent = this, Size = Size, Tint = BackgroundColor }; Name = new SpriteTextBitmap(FontsBitmap.GothamRegular, item.Name) { Parent = this, Alignment = Alignment.MidLeft, X = 18, FontSize = 18 }; }
/// <inheritdoc /> /// <summary> /// </summary> /// <param name="container"></param> /// <param name="item"></param> /// <param name="index"></param> public DrawableMultiplayerGame(PoolableScrollContainer <MultiplayerGame> container, MultiplayerGame item, int index) : base(container, item, index) { Alpha = 0f; Size = new ScalableVector2(container.Width, HEIGHT); Background = new DrawableMultiplayerGameButton(container as LobbyMatchScrollContainer, this) { Parent = this }; CreateMapBanner(); CreateGameTitle(); CreateGameType(); CreateDifficultyRating(); CreateMapTitle(); CreatePlayerCount(); CreatePasswordLock(); X = -Width; MoveToX(0, Easing.OutQuint, 600); }
/// <inheritdoc /> /// <summary> /// </summary> /// <param name="container"></param> /// <param name="clickAction"></param> public MultiplayerSettingsItemButton(PoolableScrollContainer <IMultiplayerSettingsItem> container, EventHandler clickAction) : base(UserInterface.BlankBox, clickAction) { Container = container; }
/// <inheritdoc /> /// <summary> /// </summary> /// <param name="container"></param> /// <param name="item"></param> /// <param name="index"></param> public DrawableMultiplayerPlayer(PoolableScrollContainer <OnlineUser> container, OnlineUser item, int index) : base(container, item, index) { Alpha = 0f; Tint = Color.White; Size = new ScalableVector2(container.Width, HEIGHT); Button = new DrawableMultiplayerPlayerButton(this) { Parent = this, UsePreviousSpriteBatchOptions = true }; Ready = new Sprite { Parent = Button, Alignment = Alignment.MidLeft, X = 16, Image = FontAwesome.Get(FontAwesomeIcon.fa_check_mark), Size = new ScalableVector2(18, 18), Alpha = OnlineManager.CurrentGame.PlayersReady.Contains(Item.Id) ? 1 : 0.35f, Tint = Color.LimeGreen, UsePreviousSpriteBatchOptions = true }; Avatar = new Sprite { Parent = Button, Size = new ScalableVector2(36, 36), X = Ready.X + Ready.Width + 16, Alignment = Alignment.MidLeft, Alpha = 0, UsePreviousSpriteBatchOptions = true }; Avatar.AddBorder(GetPlayerColor(), 2); Flag = new Sprite() { Parent = Button, Alignment = Alignment.MidLeft, X = Avatar.X + Avatar.Width + 16, Image = item.CountryFlag == null?Flags.Get("XX") : Flags.Get(item.CountryFlag), Size = new ScalableVector2(26, 26), UsePreviousSpriteBatchOptions = true }; Username = new SpriteTextBitmap(FontsBitmap.GothamRegular, string.IsNullOrEmpty(item.Username) ? $"Loading..." : item.Username) { Parent = Flag, Alignment = Alignment.MidLeft, X = Flag.Width + 6, FontSize = 16, UsePreviousSpriteBatchOptions = true }; HostCrown = new Sprite { Parent = Username, Alignment = Alignment.MidLeft, X = Username.Width + 12, Y = 1, Size = new ScalableVector2(16, 16), Image = FontAwesome.Get(FontAwesomeIcon.fa_vintage_key_outline), SpriteEffect = SpriteEffects.FlipHorizontally, Tint = Color.Gold, UsePreviousSpriteBatchOptions = true }; NoMapIcon = new Sprite() { Parent = Button, Alignment = Alignment.MidLeft, X = Ready.X, Size = Ready.Size, Tint = Color.Red, Visible = OnlineManager.CurrentGame.PlayersWithoutMap.Contains(Item.Id), Image = FontAwesome.Get(FontAwesomeIcon.fa_times), UsePreviousSpriteBatchOptions = true }; Wins = new SpriteTextBitmap(FontsBitmap.GothamRegular, "0 Wins") { Parent = this, Alignment = Alignment.MidRight, X = -16, FontSize = 16, Tint = Colors.SecondaryAccent, Y = -2, UsePreviousSpriteBatchOptions = true }; Mods = new SpriteTextBitmap(FontsBitmap.GothamRegular, "") { Parent = this, Alignment = Alignment.MidLeft, X = Avatar.X + Avatar.Width + 16, FontSize = 14, Y = 8, UsePreviousSpriteBatchOptions = true, Tint = Colors.MainAccent }; Referee = new SpriteTextBitmap(FontsBitmap.GothamRegular, "Referee") { Parent = this, Alignment = Alignment.MidRight, X = -16, FontSize = 16, Y = -2, UsePreviousSpriteBatchOptions = true }; OnlineManager.Client.OnUserInfoReceived += OnUserInfoReceived; OnlineManager.Client.OnGameHostChanged += OnGameHostChanged; OnlineManager.Client.OnGameMapChanged += OnGameMapChanged; OnlineManager.Client.OnGamePlayerNoMap += OnGamePlayerNoMap; OnlineManager.Client.OnGamePlayerHasMap += OnGamePlayerHasMap; OnlineManager.Client.OnPlayerReady += OnGamePlayerReady; OnlineManager.Client.OnPlayerNotReady += OnGamePlayerNotReady; OnlineManager.Client.OnUserStats += OnUserStats; OnlineManager.Client.OnGamePlayerWinCount += OnGamePlayerWinCount; OnlineManager.Client.OnGameTeamWinCount += OnGameTeamWinCount; OnlineManager.Client.OnPlayerChangedModifiers += OnPlayerChangedModifiers; OnlineManager.Client.OnChangedModifiers += OnGameChangedModifiers; OnlineManager.Client.OnGameSetReferee += OnGameSetReferee; SteamManager.SteamUserAvatarLoaded += OnSteamAvatarLoaded; if (!OnlineManager.OnlineUsers[item.Id].HasUserInfo) { OnlineManager.Client.RequestUserInfo(new List <int> { item.Id }); } else { if (SteamManager.UserAvatars.ContainsKey((ulong)Item.SteamId)) { Avatar.Image = SteamManager.UserAvatars[(ulong)Item.SteamId]; Avatar.Alpha = 1; } } // Request user stats if necessary if (OnlineManager.OnlineUsers[item.Id].Stats.Count == 0) { OnlineManager.Client.RequestUserStats(new List <int> { item.Id }); } }
/// <inheritdoc /> /// <summary> /// </summary> /// <param name="container"></param> /// <param name="item"></param> /// <param name="index"></param> /// <param name="header"></param> public ResultMultiplayerScoreboardUser(PoolableScrollContainer <ScoreboardUser> container, ScoreboardUser item, int index, ResultMultiplayerScoreboardTableHeader header) : base(container, item, index) { Header = header; Size = new ScalableVector2(container.Width, HEIGHT); Alpha = 0.85f; Button = new ResultMultiplayerScoreboardUserButton(Item, container) { Parent = this, Size = Size, UsePreviousSpriteBatchOptions = true }; // ReSharper disable once ObjectCreationAsStatement var rank = new SpriteTextBitmap(FontsBitmap.GothamRegular, $"{item.Rank}.") { Parent = this, Alignment = Alignment.MidLeft, X = 20, FontSize = 16, Tint = Item.Type == ScoreboardUserType.Self ? Colors.SecondaryAccent : Color.White, UsePreviousSpriteBatchOptions = true }; var avatar = new Sprite { Parent = this, Alignment = Alignment.MidLeft, Size = new ScalableVector2(32, 32), X = 56, Image = item.Avatar.Image, UsePreviousSpriteBatchOptions = true }; avatar.AddBorder(Color.White, 2); var username = new SpriteTextBitmap(FontsBitmap.GothamRegular, item.UsernameRaw) { Parent = this, Alignment = Alignment.MidLeft, X = avatar.X + avatar.Width + 16, FontSize = 16, Tint = Item.Type == ScoreboardUserType.Self ? Colors.SecondaryAccent : Color.White, UsePreviousSpriteBatchOptions = true }; if (item.Processor == null) { return; } CreateData(new Dictionary <string, string> { { "Rating", item.CalculateRating().ToString("00.00") }, { "Grade", "" }, { "Accuracy", StringHelper.AccuracyToString(item.Processor.Accuracy) }, { "Max Combo", item.Processor.MaxCombo + "x" }, { "Marv", item.Processor.CurrentJudgements[Judgement.Marv].ToString() }, { "Perf", item.Processor.CurrentJudgements[Judgement.Perf].ToString() }, { "Great", item.Processor.CurrentJudgements[Judgement.Great].ToString() }, { "Good", item.Processor.CurrentJudgements[Judgement.Good].ToString() }, { "Okay", item.Processor.CurrentJudgements[Judgement.Okay].ToString() }, { "Miss", item.Processor.CurrentJudgements[Judgement.Miss].ToString() }, { "Mods", item.Processor.Mods <= 0 ? "None" : ModHelper.GetModsString(ModHelper.GetModsFromRate(ModHelper.GetRateFromMods(item.Processor.Mods))) } }); // ReSharper disable once ObjectCreationAsStatement new Sprite { Parent = this, Alignment = Alignment.BotLeft, Size = new ScalableVector2(Width, 1), Alpha = 0.3f }; }
/// <inheritdoc /> /// <summary> /// </summary> /// <param name="container"></param> /// <param name="clickAction"></param> public MenuDialogItemButton(PoolableScrollContainer <IMenuDialogOption> container, EventHandler clickAction = null) : base(UserInterface.BlankBox, clickAction) { Container = container; }