Pārlūkot izejas kodu

feat: add clue for CreateFriend

Otter 4 mēneši atpakaļ
vecāks
revīzija
f0184faf1c

BIN
HelloItQuantum/Assets/CreateFrendAudio/voice1.wav


BIN
HelloItQuantum/Assets/CreateFrendAudio/voice2.wav


BIN
HelloItQuantum/Assets/CreateFrendAudio/voice3.wav


BIN
HelloItQuantum/Assets/ImgCreateFriend/arrow.png


BIN
HelloItQuantum/Assets/ImgCreateFriend/play_audio.png


+ 8 - 0
HelloItQuantum/HelloItQuantum.csproj

@@ -29,12 +29,14 @@
     <None Remove="Assets\icon_create_friend.svg" />
     <None Remove="Assets\icon_labyrinth.svg" />
     <None Remove="Assets\ImgAuth\фонAuth.svg" />
+    <None Remove="Assets\ImgCreateFriend\arrow.png" />
     <None Remove="Assets\ImgCreateFriend\body.svg" />
     <None Remove="Assets\ImgCreateFriend\delete.svg" />
     <None Remove="Assets\ImgCreateFriend\eye.svg" />
     <None Remove="Assets\ImgCreateFriend\foot1.svg" />
     <None Remove="Assets\ImgCreateFriend\foot2.svg" />
     <None Remove="Assets\ImgCreateFriend\no_shift.svg" />
+    <None Remove="Assets\ImgCreateFriend\play_audio.png" />
     <None Remove="Assets\ImgHomeView\logoIT.png" />
     <None Remove="Assets\img_friend.png" />
     <None Remove="Assets\kvanlogo.png" />
@@ -46,6 +48,12 @@
     <None Remove="Assets\фон.png" />
   </ItemGroup>
 
+  <ItemGroup>
+    <Content Include="Assets\CreateFrendAudio\voice1.wav" />
+    <Content Include="Assets\CreateFrendAudio\voice2.wav" />
+    <Content Include="Assets\CreateFrendAudio\voice3.wav" />
+  </ItemGroup>
+
   <ItemGroup>
     <PackageReference Include="Avalonia" Version="11.0.6" />
     <PackageReference Include="Avalonia.Desktop" Version="11.0.6" />

+ 29 - 0
HelloItQuantum/ViewModels/GameCreateFriendViewModel.cs

@@ -1,5 +1,7 @@
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
+using System.Media;
+using System.Threading.Tasks;
 using Avalonia;
 using Avalonia.Controls;
 using Avalonia.Controls.Shapes;
@@ -32,15 +34,20 @@ namespace HelloItQuantum.ViewModels
 		bool isVisibleHello = false;
 		public bool IsVisibleHello { get => isVisibleHello; set => SetProperty(ref isVisibleHello, value); }
 
+		bool isVisibleClue = true;
+		public bool IsVisibleClue { get => isVisibleClue; set => SetProperty(ref isVisibleClue, value); }
+
 		string btnContent = "ÑÎÇÄÀÒÜ";
 		public string BtnContent { get => btnContent; set => SetProperty(ref btnContent, value); }
 
 		SolidColorBrush btnColor = new SolidColorBrush(Color.Parse("#7CBE41"));
 		public SolidColorBrush BtnColor { get => btnColor; set => SetProperty(ref btnColor, value); }
+
 		#endregion
 
 		public void ClickCreateElement()
 		{
+			IsVisibleClue = false;
 			FriendElement friendElement = new FriendElement();
 			ObservableCollection<Ellipse> lColors = new ObservableCollection<Ellipse>();
 			ObservableCollection<ComboBoxItem> lElements = new ObservableCollection<ComboBoxItem>();
@@ -77,9 +84,11 @@ namespace HelloItQuantum.ViewModels
 				IsVisibleHello = true;
 				BtnContent = "ÇÀÍÎÂÎ";
 				BtnColor = new SolidColorBrush(Color.Parse("#F26527"));
+				PlayTwoAudio();
 			}
 			else if (btnContent == "ÇÀÍÎÂÎ")
 			{
+				IsVisibleClue = true;
 				IsVisibleHello = false;
 				BtnContent = "ÑÎÇÄÀÒÜ";
 				BtnColor = new SolidColorBrush(Color.Parse("#7CBE41"));
@@ -88,6 +97,26 @@ namespace HelloItQuantum.ViewModels
 			}
 		}
 
+		public void PlayTask()
+		{
+			PlayVoice($"CreateFrendAudio/voice1.wav");
+		}
+
+		public async Task PlayTwoAudio()
+		{
+			await PlayVoice($"CreateFrendAudio/voice2.wav");
+			await PlayVoice($"CreateFrendAudio/voice3.wav");
+		}
+
+		public async Task PlayVoice(string path)
+		{
+			using (SoundPlayer snd = new SoundPlayer(path))
+			{
+				snd.Play();
+				await Task.Delay(2000);
+			}
+		}
+
 		public void Delete(int id)
 		{
 			pChildrens.Children.RemoveAt(id);

+ 0 - 2
HelloItQuantum/ViewModels/HotkeysViewModel.cs

@@ -1,7 +1,5 @@
 using HelloItQuantum.Function;
 using HelloItQuantum.Views;
-using System;
-using System.IO;
 using System.Media;
 
 namespace HelloItQuantum.ViewModels

+ 17 - 3
HelloItQuantum/Views/GameCreateFriendView.axaml

@@ -73,9 +73,23 @@
 									</DataTemplate>
 								</ItemsControl.ItemTemplate>
 							</ItemsControl>
-	
-							<Button Grid.Row="1" Content="+" Command="{Binding GameCreateFriendVM.ClickCreateElement}"
-									Background="#E6EFD8" Margin="60 0 20 0" HorizontalAlignment="Stretch"/>
+
+							<StackPanel Grid.Row="1" Margin="60 0 20 0" HorizontalAlignment="Stretch">
+								<Button Content="+" Command="{Binding GameCreateFriendVM.ClickCreateElement}"
+								Background="#E6EFD8" HorizontalAlignment="Stretch"/>
+								<Grid ColumnDefinitions="auto, *" HorizontalAlignment="Stretch" Margin="0 10" IsVisible="{Binding GameCreateFriendVM.IsVisibleClue}">
+									<Image Grid.Column="0" Source="/Assets/ImgCreateFriend/arrow.png" Width="100" Margin="0 10 10 0"/>
+									<Border Grid.Column="1" Background="#E6EFD8" CornerRadius="10" BorderThickness="5" BorderBrush="#F26527" Margin="10 10 0 0" Padding="10">
+										<StackPanel HorizontalAlignment="Stretch">
+											<TextBlock Text="Привет! Давай создадим друга для компьютерной пыли! Нажми на кнопку, чтобы создать элемент. Выбери цвет фигуры, управляй положением глаз и ног."
+											   TextWrapping="Wrap"/>
+											<Button Command="{Binding GameCreateFriendVM.PlayTask}" Margin="0 -20 0 0" CornerRadius="100" HorizontalAlignment="Right" VerticalAlignment="Bottom">
+												<Image Source="/Assets/ImgCreateFriend/play_audio.png" Width="50"/>
+											</Button>				
+										</StackPanel>
+									</Border>						
+								</Grid>
+							</StackPanel>
 						</Grid>
 					</ScrollViewer>