/
Landilf
/
2413_Ryumin_CourseWork
Обзор
Документация
Войти
/
Landilf
/
2413_Ryumin_CourseWork
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
CourseWork/GUI/Views/HelpView.axaml.cs
65 строк
2 KB
Landilf
add project
27 янв 2026, 13:57
27 янв 2026, 13:57
753b3e7
Код
Авторство
О чём код?
using Avalonia; using Avalonia.Controls; using Avalonia.Media; using System.Globalization; using GameCore; using GameCore.Resources; namespace GUI.Views; public partial class HelpView : UserControl { public HelpView() { InitializeComponent(); } public override void Render(DrawingContext parContext) { base.Render(parContext); parContext.DrawRectangle(new SolidColorBrush(Color.Parse(GameConfig.COLOR_MAP_EMPTY)), null, Bounds); double centerX = Bounds.Width / 2; var brush = new SolidColorBrush(Color.Parse("#D93025")); var title = CreateText(Strings.HelpTitle, 40, FontWeight.Bold, brush); parContext.DrawText(title, new Point(centerX - title.Width / 2, 50)); string[] lines = [ Strings.HelpGoalTitle, Strings.HelpGoalText, "", Strings.HelpControlsTitle, Strings.HelpControlsMove, Strings.HelpControlsPause, Strings.HelpControlsSelect, "", Strings.HelpRulesTitle, Strings.HelpRules1, Strings.HelpRules2, Strings.HelpRules3, Strings.HelpRules4, "", Strings.HelpBonusesTitle, Strings.HelpBonusesSpeed, Strings.HelpBonusesInvulnerable ]; double currentY = 150; foreach (string elLine in lines) { var text = CreateText(elLine, 20, elLine.EndsWith(':') ? FontWeight.Bold : FontWeight.Normal, brush); parContext.DrawText(text, new Point(centerX - 300, currentY)); currentY += 30; } var backBtn = CreateText(Strings.PromptPressEnter, 24, FontWeight.Bold, brush); parContext.DrawText(backBtn, new Point(centerX - backBtn.Width / 2, Bounds.Height - 100)); } private FormattedText CreateText(string parText, double parSize, FontWeight parWeight, IBrush parBrush) { return new FormattedText(parText, CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface("Arial", FontStyle.Normal, parWeight), parSize, parBrush); } }