Browse Source

Merge branch 'newBranchAudioK'

ArrayKat2 4 months ago
parent
commit
3bfd8efd24

BIN
HelloItQuantum/Assets/LabyrinthAudio/voice1.mp3


BIN
HelloItQuantum/Assets/LabyrinthAudio/voice2.mp3


+ 29 - 14
HelloItQuantum/ViewModels/LabyrinthViewModel.cs

@@ -4,6 +4,7 @@ using System.IO;
 using System.Media;
 using Avalonia;
 using Avalonia.Controls;
+using Avalonia.Controls.Shapes;
 using Avalonia.Media;
 using ExCSS;
 using HelloItQuantum.Function;
@@ -14,11 +15,11 @@ namespace HelloItQuantum.ViewModels
 {
     public class LabyrinthViewModel : MainWindowViewModel
     {
-
+        List<string> listContent = new List<string>();
         bool isVisibleContextWindow = true;
         string textInSP = "Æèë-áûë ðîáîò Ðàêåòà. Îí õîòåë ïîìî÷ü ïðîôåññîðó íà ñòàíöèè, íî ìåæäó íèìè áûë ëàáèðèíò èç îðàíæåâûõ è êðàñíûõ êëåòîê. Ðàêåòà ìîã èäòè òîëüêî ïî îðàíæåâûì, èçáåãàÿ êðàñíûõ. Ïîìîãè Ðàêåòå äîáðàòüñÿ äî ñòàíöèè ïðîôåññîðà.";
         string textInBTN = "Äàëåå";
-
+        string pathAudio = $"LabyrinthAudio\\voice_start.wav";
 
         StackPanel listCommandForRobots = new StackPanel();
         public StackPanel ListCommandForRobots { get => listCommandForRobots; set => SetProperty(ref listCommandForRobots, value); }
@@ -26,18 +27,29 @@ namespace HelloItQuantum.ViewModels
         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 GoNext() {
-            TextInSP = "Çäîðîâî! Ðàêåòà îêàçàëñÿ íà èññëåäîâàòåëüñêîé ñòàíöèè è ïîìîã ïðîôåññîðó ïî÷èíèòü ëàáîðàòîðèþ. Ìèññèÿ âûïîëíåíà!";
+        /// <summary>
+        /// Ôóíêöèÿ çàïóñêà àóäèî
+        /// </summary>
+        public void PlayTask()
+        {
+            SoundPlayer snd = new SoundPlayer(pathAudio);
+            snd.Play();
+        }
+        public void GoNext()
+        {
             IsVisibleContextWindow = false;
         }
-
+        /// <summary>
+        /// Âåðíóòüñÿ â ãëàâíîå ìåíþ
+        /// </summary>
         public void GoBack()
         {
             PageSwitch.View = new PlaySectionView();
         }
-
+        /// <summary>
+        /// Äîáàâëåíèå ñïèñêà êîìàíä ïðè íàæàòèè íà êíîïêó
+        /// </summary>
+        /// <param name="comand">ïåðåäàâàåìàÿ êîìàíäà (âëåâî, âïðàâî, âíèç, ââåðõ)</param>
         public void AddButton(string comand)
         {
 			ListCommandForRobots.HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Center;
@@ -54,13 +66,17 @@ namespace HelloItQuantum.ViewModels
 			border.Margin = new Thickness(5);
 			ListCommandForRobots.Children.Add(border);
             listContent.Add(tb.Text);
-
         }
-        
+        /// <summary>
+        /// Î÷èùåíèå ñïèñêà êîìàíä äëÿ ðîáîòà
+        /// </summary>
         public void DeleteCommand() {
             ListCommandForRobots.Children.Clear();
             listContent.Clear();
         }
+        /// <summary>
+        /// Ïðîâåðêà ïðàâèëüíîñòè ñïèñêà êîìàíä
+        /// </summary>
         public void CheckCommand()
         {
             //ListCommandForRobots.Children.Clear();
@@ -112,6 +128,7 @@ namespace HelloItQuantum.ViewModels
             if (googCommands)
             {
                 WorkWithFile.UpdateValueGameProgress(2, 100, CurrentUser);
+                pathAudio = $"LabyrinthAudio\\voice_win.wav";
                 TextInSP = "Çäîðîâî! Ðàêåòà îêàçàëñÿ íà èññëåäîâàòåëüñêîé ñòàíöèè è ïîìîã ïðîôåññîðó ïî÷èíèòü ëàáîðàòîðèþ. Ìèññèÿ âûïîëíåíà!";
                 IsVisibleContextWindow = true;
                 TextInBTN = "Çàêðûòü";
@@ -119,15 +136,13 @@ namespace HelloItQuantum.ViewModels
             else {
                
                 TextInSP = "Ê ñîæàëåíèþ, Ðàêåòà çàáëóäèëñÿ è íå äîáðàëñÿ äî èññëåäîâàòåëüñêîé ñòàíöèè. Íå îò÷àèâàéñÿ! Ïîïðîáóé çàíîâî!";
+                pathAudio = $"LabyrinthAudio\\voice_loss.wav";
                 IsVisibleContextWindow = true;
                 TextInBTN = "Çàêðûòü";
             }
         }
+        
 
     }
 
-    public class NameComand {
-        public string name { get; set; }
-    }
-
 }

+ 6 - 6
HelloItQuantum/Views/LabyrinthView.axaml

@@ -57,25 +57,25 @@
 					Margin="0,25,0,30">
 					<StackPanel Orientation="Vertical" >
 						<StackPanel Orientation="Horizontal" VerticalAlignment="Top" >
-							<Button  Width="40" CornerRadius="10000" Padding="1" Margin="0,0,5,0">
+							<Button Command="{Binding LabyrinthVM.AddButton}" CommandParameter="left" Width="40" CornerRadius="10000" Padding="1" Margin="0,0,5,0">
 								<Image Source="/Assets/ImgLabyrinth/img_left.png"/>
 							</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">
+							<Button Command="{Binding LabyrinthVM.AddButton}" CommandParameter="right" Width="40" CornerRadius="10000" Padding="1" Margin="0,0,5,0">
 								<Image Source="/Assets/ImgLabyrinth/img_right.png"/>
 							</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">
+							<Button Command="{Binding LabyrinthVM.AddButton}" CommandParameter="up" Width="40" CornerRadius="10000" Padding="1" Margin="0,0,5,0">
 								<Image Source="/Assets/ImgLabyrinth/img_up.png"/>
 							</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">
+							<Button Command="{Binding LabyrinthVM.AddButton}" CommandParameter="down" Width="40" CornerRadius="10000" Padding="1" Margin="0,0,5,0">
 								<Image Source="/Assets/ImgLabyrinth/img_down.png"/>
 							</Button>
 							<Button Command="{Binding LabyrinthVM.AddButton}" CommandParameter="down" Width="150" FontSize="24" Background="#F26527">go down</Button>
@@ -182,14 +182,14 @@
 					<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">
+						<Button Height="50" Command="{Binding LabyrinthVM.PlayTask}" 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">
+									  CornerRadius="20" Height="40" Width="200">
 								<TextBlock Text="{Binding LabyrinthVM.TextInBTN}" TextAlignment="Center" FontSize="24" Foreground="#FFFFFF" />
 							</Button>
 						</Border>