/
romashov.z
/
PPAGame
Обзор
Документация
Войти
/
romashov.z
/
PPAGame
Код
Запросы
1
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
gameUI-clean
PPAGameUI/Views/MainMenuView.axaml
200 строк
11 KB
Artemiy Ivanov
fix: bugs
02 июн 2026, 14:59
02 июн 2026, 14:59
787ca82
Код
Авторство
О чём код?
<UserControl xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:vm="using:PPAGameUI.ViewModels" x:Class="PPAGameUI.Views.MainMenuView" x:DataType="vm:MainMenuViewModel"> <Grid RowDefinitions="Auto,*" Margin="60,40"> <!-- Заголовок --> <StackPanel Grid.Row="0" HorizontalAlignment="Center" Margin="0,0,0,48"> <TextBlock Text="⚔️ PPAGame" FontSize="52" FontWeight="Bold" Foreground="#CDD6F4" HorizontalAlignment="Center" /> <TextBlock Text="Средневековая битва" FontSize="18" Foreground="#6C7086" HorizontalAlignment="Center" Margin="0,8,0,0" /> </StackPanel> <Grid Grid.Row="1" ColumnDefinitions="300,*"> <!-- Главные кнопки + сохранения --> <StackPanel Grid.Column="0" Spacing="12"> <Button Content="⚔️ Новая игра" Command="{Binding NewGameCommand}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" Height="52" FontSize="17" FontWeight="SemiBold" Background="#A6E3A1" Foreground="#1E1E2E" CornerRadius="10" /> <Button Content="🚪 Выход" Command="{Binding ExitCommand}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" Height="52" FontSize="17" Background="#313244" Foreground="#F38BA8" CornerRadius="10" /> <!-- Список сохранений --> <TextBlock Text="Сохранённые игры:" Foreground="#6C7086" FontSize="13" Margin="0,16,0,4" IsVisible="{Binding HasSaves}" /> <ScrollViewer MaxHeight="300" IsVisible="{Binding HasSaves}"> <ItemsControl ItemsSource="{Binding Saves}"> <ItemsControl.ItemTemplate> <DataTemplate DataType="{x:Type vm:SaveEntryViewModel}"> <Grid ColumnDefinitions="*,Auto,Auto" Margin="0,3,0,0"> <!-- Загрузить --> <Button Grid.Column="0" Content="{Binding DisplayText}" Command="{Binding $parent[UserControl].((vm:MainMenuViewModel)DataContext).LoadGameCommand}" CommandParameter="{Binding}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Left" Padding="10,8" FontSize="12" Background="#313244" Foreground="#CDD6F4" CornerRadius="6,0,0,6" /> <!-- Просмотр лога --> <Button Grid.Column="1" Content="📋" Command="{Binding $parent[UserControl].((vm:MainMenuViewModel)DataContext).SelectSaveCommand}" CommandParameter="{Binding}" Width="36" Background="#1E3A5F" Foreground="#89B4FA" CornerRadius="0" ToolTip.Tip="Показать лог боя" /> <!-- Удалить --> <Button Grid.Column="2" Content="🗑" Command="{Binding $parent[UserControl].((vm:MainMenuViewModel)DataContext).DeleteSaveCommand}" CommandParameter="{Binding}" Width="36" Background="#45475A" Foreground="#F38BA8" CornerRadius="0,6,6,0" /> </Grid> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </ScrollViewer> </StackPanel> <!-- Правая панель --> <Grid Grid.Column="1" Margin="24,0,0,0"> <!-- Справка по юнитам — видна когда лог не открыт --> <Border Background="#313244" CornerRadius="12" Padding="24" VerticalAlignment="Top" IsVisible="{Binding ShowUnitRef}"> <StackPanel Spacing="10"> <TextBlock Text="Справочник юнитов" FontSize="16" FontWeight="Bold" Foreground="#CDD6F4" Margin="0,0,0,6" /> <Grid ColumnDefinitions="Auto,*" RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto"> <TextBlock Grid.Row="0" Grid.Column="0" Text="⚔️ HeavyUnit " Foreground="#F9E2AF" FontSize="13"/> <TextBlock Grid.Row="0" Grid.Column="1" Text="HP:150 Урон:20 Щит:80 Цена:230" Foreground="#6C7086" FontSize="13"/> <TextBlock Grid.Row="1" Grid.Column="0" Text="🗡️ LiteUnit " Foreground="#F9E2AF" FontSize="13"/> <TextBlock Grid.Row="1" Grid.Column="1" Text="HP:80 Урон:40 Щит:20 Цена:250" Foreground="#6C7086" FontSize="13"/> <TextBlock Grid.Row="2" Grid.Column="0" Text="🏹 ArcherUnit " Foreground="#F9E2AF" FontSize="13"/> <TextBlock Grid.Row="2" Grid.Column="1" Text="HP:90 Урон:15 Щит:10 Цена:~100+" Foreground="#6C7086" FontSize="13"/> <TextBlock Grid.Row="3" Grid.Column="0" Text="💚 HealerUnit " Foreground="#F9E2AF" FontSize="13"/> <TextBlock Grid.Row="3" Grid.Column="1" Text="HP:70 Урон:10 Щит:30 Цена:~120+" Foreground="#6C7086" FontSize="13"/> <TextBlock Grid.Row="4" Grid.Column="0" Text="🔮 WizardUnit " Foreground="#F9E2AF" FontSize="13"/> <TextBlock Grid.Row="4" Grid.Column="1" Text="HP:60 Урон:8 Щит:20 Цена:~105+" Foreground="#6C7086" FontSize="13"/> <TextBlock Grid.Row="5" Grid.Column="0" Text="🏰 ГуляйГород " Foreground="#F9E2AF" FontSize="13"/> <TextBlock Grid.Row="5" Grid.Column="1" Text="HP:300 Урон:0 Щит:150 Цена:200" Foreground="#6C7086" FontSize="13"/> </Grid> <Rectangle Height="1" Fill="#45475A" Margin="0,8" /> <TextBlock Foreground="#6C7086" FontSize="12" TextWrapping="Wrap"> <Run Text="Режимы наблюдателей:" FontWeight="SemiBold" Foreground="#CDD6F4" /> <Run Text=" Полный — урон в файл + гибель в журнале. " /> <Run Text="Уведомления — только гибель в журнале. " /> <Run Text="Без — чистая игра." /> </TextBlock> </StackPanel> </Border> <!-- Лог боя выбранного сохранения — виден когда нажали 📋 --> <Border Background="#313244" CornerRadius="12" Padding="20" IsVisible="{Binding HasPreviewLog}"> <StackPanel> <!-- Шапка с названием и кнопкой закрытия --> <Grid ColumnDefinitions="*,Auto" Margin="0,0,0,10"> <StackPanel Grid.Column="0"> <TextBlock Text="📋 Лог боя" FontSize="16" FontWeight="Bold" Foreground="#CDD6F4" /> <TextBlock Text="{Binding PreviewTitle}" FontSize="11" Foreground="#6C7086" TextWrapping="Wrap" Margin="0,3,0,0" /> </StackPanel> <Button Grid.Column="1" Content="✕" Command="{Binding SelectSaveCommand}" CommandParameter="{x:Null}" Background="#45475A" Foreground="#CDD6F4" CornerRadius="6" Padding="8,4" VerticalAlignment="Top" ToolTip.Tip="Закрыть" /> </Grid> <Rectangle Height="1" Fill="#45475A" Margin="0,0,0,10" /> <ScrollViewer MaxHeight="480"> <ItemsControl ItemsSource="{Binding PreviewLog}"> <ItemsControl.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding}" FontSize="11" Foreground="#CDD6F4" TextWrapping="Wrap" Margin="0,2" /> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </ScrollViewer> </StackPanel> </Border> </Grid> </Grid> </Grid> </UserControl>