소스 검색

Merge branch 'newBranchK'

ArrayKat2 2 달 전
부모
커밋
7b68d4c8fc

BIN
HelloItQuantum/Assets/ImgLabyrinth/Диалоговое_окно.png


BIN
HelloItQuantum/Assets/LabyrinthAudio/voice1.mp3


BIN
HelloItQuantum/Assets/LabyrinthAudio/voice2.mp3


+ 105 - 6
HelloItQuantum/ViewModels/LabyrinthViewModel.cs

@@ -1,24 +1,123 @@
 using System;
 using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Windows.Input;
+using System.IO;
+using System.Media;
+using Avalonia;
 using Avalonia.Controls;
-using DynamicData;
-using ReactiveUI;
+using Avalonia.Media;
+using ExCSS;
+
 
 namespace HelloItQuantum.ViewModels
 {
     public class LabyrinthViewModel : MainWindowViewModel
     {
+
+        bool isVisibleContextWindow = true;
+        string textInSP = "Æèë-áûë ðîáîò Ðàêåòà. Îí õîòåë ïîìî÷ü ïðîôåññîðó íà ñòàíöèè, íî ìåæäó íèìè áûë ëàáèðèíò èç îðàíæåâûõ è êðàñíûõ êëåòîê. Ðàêåòà ìîã èäòè òîëüêî ïî îðàíæåâûì, èçáåãàÿ êðàñíûõ. Ïîìîãè Ðàêåòå äîáðàòüñÿ äî ñòàíöèè ïðîôåññîðà.";
+        string textInBTN = "Äàëåå";
+
+
         StackPanel listCommandForRobots = new StackPanel();
         public StackPanel ListCommandForRobots { get => listCommandForRobots; set => SetProperty(ref listCommandForRobots, value); }
+        public bool IsVisibleContextWindow { get => isVisibleContextWindow; set => SetProperty(ref isVisibleContextWindow, value); }
+        public string TextInSP { get => textInSP; set => SetProperty(ref textInSP, value); }
+        public string TextInBTN { get => textInBTN; set => SetProperty(ref textInBTN, value); }
+
+        List<string> listContent = new List<string>();
 
-        public void AddRight()
+        public void GoNext() {
+            TextInSP = "Çäîðîâî! Ðàêåòà îêàçàëñÿ íà èññëåäîâàòåëüñêîé ñòàíöèè è ïîìîã ïðîôåññîðó ïî÷èíèòü ëàáîðàòîðèþ. Ìèññèÿ âûïîëíåíà!";
+            IsVisibleContextWindow = false;
+        }
+
+        /// <summary>
+        /// Ôóíêöèÿ çàïóñêà àóäèî
+        /// </summary>
+       
+        
+        public void AddButton(string comand)
         {
             TextBox tb = new TextBox();
-            tb.Text = "Ïðèâèâè";
+            tb.Text = "go " + comand;
+            tb.Background = new SolidColorBrush(Avalonia.Media.Color.FromArgb(242, 101, 39, 0));
+            tb.FontSize = 24;
+            tb.Width = 150;
+            tb.CornerRadius = new CornerRadius(10);
+            tb.Margin = new Thickness(5);
             ListCommandForRobots.Children.Add(tb);
+<<<<<<< HEAD
+=======
+            listContent.Add(tb.Text);
+>>>>>>> newBranchK
+        }
+        
+        public void DeleteCommand() {
+            ListCommandForRobots.Children.Clear();
+            listContent.Clear();
         }
+        public void CheckCommand()
+        {
+            //ListCommandForRobots.Children.Clear();
+            var c = ListCommandForRobots.Children;
+            bool googCommands = true;
+            if (listContent.Count < 9)
+            {
+                googCommands = false;
+            }
+            else { 
+                for (int i = 0; i < listContent.Count; i++) {
+                    if (listContent[0] != "go right") {
+                        googCommands = false; break;
+                    }
+                    if (listContent[1] != "go right")
+                    {
+                        googCommands = false; break;
+                    }
+                    if (listContent[2] != "go up")
+                    {
+                        googCommands = false; break;
+                    }
+                    if (listContent[3] != "go up")
+                    {
+                        googCommands = false; break;
+                    }
+                    if (listContent[4] != "go left")
+                    {
+                        googCommands = false; break;
+                    }
+                    if (listContent[5] != "go up")
+                    {
+                        googCommands = false; break;
+                    }
+                    if (listContent[6] != "go up")
+                    {
+                        googCommands = false; break;
+                    }
+                    if (listContent[7] != "go right")
+                    {
+                        googCommands = false; break;
+                    }
+                    if (listContent[8] != "go right")
+                    {
+                        googCommands = false; break;
+                    }
+                }
+            }
+            if (googCommands)
+            {
+                TextInSP = "Çäîðîâî! Ðàêåòà îêàçàëñÿ íà èññëåäîâàòåëüñêîé ñòàíöèè è ïîìîã ïðîôåññîðó ïî÷èíèòü ëàáîðàòîðèþ. Ìèññèÿ âûïîëíåíà!";
+                IsVisibleContextWindow = true;
+                TextInBTN = "Çàêðûòü";
+            }
+            else {
+               
+                TextInSP = "Ê ñîæàëåíèþ, Ðàêåòà çàáëóäèëñÿ è íå äîáðàëñÿ äî èññëåäîâàòåëüñêîé ñòàíöèè. Íå îò÷àèâàéñÿ! Ïîïðîáóé çàíîâî!";
+                IsVisibleContextWindow = true;
+                TextInBTN = "Çàêðûòü";
+            }
+        }
+
     }
 
     public class NameComand {

+ 43 - 10
HelloItQuantum/Views/LabyrinthView.axaml

@@ -19,7 +19,9 @@
 			<Setter Property="CornerRadius" Value="10"/>
 			<Setter Property="HorizontalContentAlignment" Value="Center"/>
 		</Style>
-
+		<Style Selector="TextBox">
+			<Setter Property="FontFamily" Value="{StaticResource BankGothicMediumRUS}" />
+		</Style>
 		<Style Selector="ComboBox">
 			<Setter Property="Background" Value="#E6EFD8"/>
 			<Setter Property="CornerRadius" Value="10"/>
@@ -31,11 +33,13 @@
 	<StackPanel>
 
 
-
-
+		<!---->
+		
 
 		<Grid Height="{Binding $parent[StackPanel].Bounds.Height}" ColumnDefinitions="*,*,2*" RowDefinitions="*">
 
+			<Border  Background="#F26527" CornerRadius="15"
+					Margin="20,25,20,30">
 			<!--Область "кода"-->
 			<Panel Grid.Column="0" Grid.Row="0" >
 					<ScrollViewer>
@@ -45,6 +49,7 @@
 							Margin="10"/>
 					</ScrollViewer>
 			</Panel>
+			</Border>
 			<!--Область кнопок-->
 			<Panel Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Top" Height="450">
 
@@ -55,31 +60,31 @@
 							<Button  Width="40" CornerRadius="10000" Padding="1" Margin="0,0,5,0">
 								<Image Source="/Assets/ImgLabyrinth/img_left.png"/>
 							</Button>
-							<Button  Width="150" FontSize="24" Background="#F26527">go left</Button>
+							<Button Command="{Binding LabyrinthVM.AddButton}" CommandParameter="left" Width="150" FontSize="24" Background="#F26527">go left</Button>
 						</StackPanel>
 						<StackPanel Margin="0,10,0,0" Orientation="Horizontal" VerticalAlignment="Top" >
 							<Button Width="40" CornerRadius="10000" Padding="1" Margin="0,0,5,0">
 								<Image Source="/Assets/ImgLabyrinth/img_right.png"/>
 							</Button>
-							<Button Command="{Binding LabyrinthVM.AddRight}" Width="150" FontSize="24" Background="#F26527">go right</Button>
+							<Button Command="{Binding LabyrinthVM.AddButton}" CommandParameter="right" Width="150" FontSize="24" Background="#F26527">go right</Button>
 						</StackPanel>
 						<StackPanel Margin="0,10,0,0" Orientation="Horizontal" VerticalAlignment="Top" >
 							<Button Width="40" CornerRadius="10000" Padding="1" Margin="0,0,5,0">
 								<Image Source="/Assets/ImgLabyrinth/img_up.png"/>
 							</Button>
-							<Button Width="150" FontSize="24" Background="#F26527">go up</Button>
+							<Button Command="{Binding LabyrinthVM.AddButton}" CommandParameter="up" Width="150" FontSize="24" Background="#F26527">go up</Button>
 						</StackPanel>
 						<StackPanel Margin="0,10,0,0" Orientation="Horizontal" VerticalAlignment="Top" >
 							<Button Width="40" CornerRadius="10000" Padding="1" Margin="0,0,5,0">
 								<Image Source="/Assets/ImgLabyrinth/img_down.png"/>
 							</Button>
-							<Button Width="150" FontSize="24" Background="#F26527">go  down</Button>
+							<Button Command="{Binding LabyrinthVM.AddButton}" CommandParameter="down" Width="150" FontSize="24" Background="#F26527">go down</Button>
 						</StackPanel>
 
 						<!--Кнопка Запустить-->
 						<Border CornerRadius="20" Background="#00A659" BoxShadow="0 5 #006838" Margin="0 20 0 0" HorizontalAlignment="Right" Height="40" Width="200"
 								IsVisible="True">
-							<Button VerticalContentAlignment="Center"
+							<Button Command="{Binding LabyrinthVM.CheckCommand}" VerticalContentAlignment="Center"
 									 CommandParameter="Нет" CornerRadius="20" Height="40" Width="200">
 								<TextBlock Text="Запустить" TextAlignment="Center" FontSize="24" Foreground="#FFFFFF" />
 							</Button>
@@ -87,7 +92,7 @@
 						<!--Кнопка Очистить-->
 						<Border CornerRadius="20" Background="#F26527" BoxShadow="0 5 #803717" Margin="-10 20 0 0" HorizontalAlignment="Right" Height="40" Width="200"
 								IsVisible="True">
-							<Button VerticalContentAlignment="Center"
+							<Button Command="{Binding LabyrinthVM.DeleteCommand}" VerticalContentAlignment="Center"
 									 CommandParameter="Нет" CornerRadius="20" Height="40" Width="200">
 								<TextBlock Text="Очистить" TextAlignment="Center" FontSize="24" Foreground="#FFFFFF" />
 							</Button>
@@ -95,7 +100,7 @@
 						<!--Кнопка Выйти-->
 						<Border CornerRadius="20" Background="#B21E22" BoxShadow="0 5 #470C0D" Margin="-10 20 0 0" HorizontalAlignment="Right" Height="40" Width="200"
 								IsVisible="True">
-							<Button VerticalContentAlignment="Center"
+							<Button Command="{Binding LabyrinthVM.HotkeysVM.GoBack}" VerticalContentAlignment="Center"
 									 CommandParameter="Нет" CornerRadius="20" Height="40" Width="200">
 								<TextBlock Text="Выйти" TextAlignment="Center" FontSize="24" Foreground="#FFFFFF" />
 							</Button>
@@ -170,7 +175,35 @@
 					</StackPanel>
 				</Border>
 			</Panel>
+			<!--Область "поля"-->
+			<Panel  Grid.Row="1" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="300, 100,10,10" Height="200" IsVisible="{Binding LabyrinthVM.IsVisibleContextWindow}">
+				
+				<StackPanel Width="800">
+					<Image Source="/Assets/ImgLabyrinth/Диалоговое_окно.png"  Stretch="Fill" Margin="0,-60,0,0"/>
+					<!--Текст-->
+					<StackPanel>
+						<Button Height="50" Command="" VerticalAlignment="Top" CornerRadius="10000" Padding="1" Margin="50, -230,0,0">
+							<Image Source="/Assets/ImgHotkeys/КнопкаPlay.png"/>
+						</Button>
+						<TextBlock Text="{Binding LabyrinthVM.TextInSP}" TextWrapping="Wrap" Margin="110, -210,15,20" FontSize="22" Foreground="#0534B5"></TextBlock>
+						<Border CornerRadius="20" Background="#00A659" BoxShadow="0 5 #006838" Margin="0 -130 30 0" HorizontalAlignment="Right" Height="40" Width="200"
+								IsVisible="True">
+							<Button Command="{Binding LabyrinthVM.GoNext}" VerticalContentAlignment="Center"
+									 CommandParameter="Нет" CornerRadius="20" Height="40" Width="200">
+								<TextBlock Text="{Binding LabyrinthVM.TextInBTN}" TextAlignment="Center" FontSize="24" Foreground="#FFFFFF" />
+							</Button>
+						</Border>
+					</StackPanel>
+					<!--Кнопка Далее-->
+					
+				</StackPanel>
+				<StackPanel>
+
 
+				</StackPanel>
+				
+				
+			</Panel>
 		</Grid>
 
 		<StackPanel>