/// <summary> /// Initializes a new instance of the <see cref="MissionPassedScreen"/> class. /// </summary> /// <param name="title">The title, the big yellow text.</param> /// <param name="subtitle">The subtitle, the text below the <see cref="Title"/>.</param> /// <param name="completionPercentage">The value that will be displayed as the completion percentage.</param> /// <param name="medal">The medal type displayed next to the completion percentage.</param> public MissionPassedScreen(string title, string subtitle, int completionPercentage, MedalType medal) { Title = title; Subtitle = subtitle; CompletionPercentage = completionPercentage; Medal = medal; Items = new MissionPassedScreenItemsCollection(); InstructionalButtons = new InstructionalButtons(); continueControlInstructionalButton = new InstructionalButton(ContinueControl, "Continue"); InstructionalButtons.Buttons.Add(continueControlInstructionalButton); }
/// <summary> /// Shows this <see cref="MissionPassedScreen"/>. It will be visible until the user presses <see cref="ContinueControl"/>, or the returned <see cref="GameFiber"/> is aborted. /// </summary> /// <returns>The <see cref="GameFiber"/> in which this <see cref="MissionPassedScreen"/> is drawn.</returns> public virtual GameFiber Show() { return(GameFiber.StartNew(() => { InstructionalButtons.Update(); while (true) { GameFiber.Yield(); Draw(); if (Game.IsControlJustPressed(0, ContinueControl)) { Common.PlaySound("SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET"); break; } } OnContinueHit(); }, "RAGENativeUI - MissionPassedScreen Fiber")); }
protected virtual void Draw() { SizeF res = UIMenu.GetScreenResolutionMantainRatio(); int middle = (int)(res.Width / 2); Sprite.Draw("mpentry", "mp_modenotselected_gradient", new Point(0, 10), new Size((int)res.Width, 450 + (Items.Count * 40)), 0.0f, Color.FromArgb(200, 255, 255, 255)); ResText.Draw(Title, new Point(middle, 100), 2.5f, Color.FromArgb(255, 199, 168, 87), Common.EFont.Pricedown, true); ResText.Draw(Subtitle, new Point(middle, 230), 0.5f, Color.White, Common.EFont.ChaletLondon, true); ResRectangle.Draw(new Point(middle - 300, 290), new Size(600, 2), Color.White); for (int i = 0; i < Items.Count; i++) { MissionPassedScreenItem item = Items[i]; ResText.Draw(item.Label, new Point(middle - 230, 300 + (40 * i)), 0.35f, Color.White, Common.EFont.ChaletLondon, false); ResText.Draw(item.Status, new Point(item.Tickbox == MissionPassedScreenItem.TickboxState.None ? middle + 265 : middle + 230, 300 + (40 * i)), 0.35f, Color.White, Common.EFont.ChaletLondon, ResText.Alignment.Right, false, false, Size.Empty); if (item.Tickbox == MissionPassedScreenItem.TickboxState.None) { continue; } string spriteName; if (item.Tickbox == MissionPassedScreenItem.TickboxState.Tick) { spriteName = "shop_box_tick"; } else if (item.Tickbox == MissionPassedScreenItem.TickboxState.Cross) { spriteName = "shop_box_cross"; } else { spriteName = "shop_box_blank"; } Sprite.Draw("commonmenu", spriteName, new Point(middle + 230, 290 + (40 * i)), new Size(48, 48), 0.0f, Color.White); } ResRectangle.Draw(new Point(middle - 300, 300 + (40 * Items.Count)), new Size(600, 2), Color.White); ResText.Draw("Completion", new Point(middle - 150, 320 + (40 * Items.Count)), 0.4f, Color.White, Common.EFont.ChaletLondon, false); ResText.Draw(CompletionPercentage + "%", new Point(middle + 150, 320 + (40 * Items.Count)), 0.4f, Color.White, Common.EFont.ChaletLondon, ResText.Alignment.Right, false, false, Size.Empty); string medalSprite; if (Medal == MedalType.Silver) { medalSprite = "silvermedal"; } else if (Medal == MedalType.Gold) { medalSprite = "goldmedal"; } else { medalSprite = "bronzemedal"; } Sprite.Draw("mpmissionend", medalSprite, new Point(middle + 150, 320 + (40 * Items.Count)), new Size(32, 32), 0.0f, Color.White); InstructionalButtons.Draw(); }