123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Media;
- using Avalonia;
- using Avalonia.Controls;
- using Avalonia.Media;
- using ExCSS;
- using HelloItQuantum.Function;
- using HelloItQuantum.Views;
- 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 GoNext() {
- TextInSP = "Çäîðîâî! Ðàêåòà îêàçàëñÿ íà èññëåäîâàòåëüñêîé ñòàíöèè è ïîìîã ïðîôåññîðó ïî÷èíèòü ëàáîðàòîðèþ. Ìèññèÿ âûïîëíåíà!";
- IsVisibleContextWindow = false;
- }
- public void GoBack()
- {
- PageSwitch.View = new PlaySectionView();
- }
- public void AddButton(string comand)
- {
- ListCommandForRobots.HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Center;
- TextBlock tb = new TextBlock();
- tb.Text = "go " + comand;
- tb.TextAlignment = TextAlignment.Center;
- tb.FontSize = 24;
- tb.Width = 150;
- tb.Margin = new Thickness(10);
- Border border = new Border();
- border.CornerRadius = new CornerRadius(20);
- border.Background = new SolidColorBrush(Avalonia.Media.Color.FromArgb(242, 101, 39, 0));
- border.Child = tb;
- border.Margin = new Thickness(5);
- ListCommandForRobots.Children.Add(border);
- listContent.Add(tb.Text);
- }
-
- 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)
- {
- WorkWithFile.UpdateValueGameProgress(2, 100, CurrentUser);
- TextInSP = "Çäîðîâî! Ðàêåòà îêàçàëñÿ íà èññëåäîâàòåëüñêîé ñòàíöèè è ïîìîã ïðîôåññîðó ïî÷èíèòü ëàáîðàòîðèþ. Ìèññèÿ âûïîëíåíà!";
- IsVisibleContextWindow = true;
- TextInBTN = "Çàêðûòü";
- }
- else {
-
- TextInSP = "Ê ñîæàëåíèþ, Ðàêåòà çàáëóäèëñÿ è íå äîáðàëñÿ äî èññëåäîâàòåëüñêîé ñòàíöèè. Íå îò÷àèâàéñÿ! Ïîïðîáóé çàíîâî!";
- IsVisibleContextWindow = true;
- TextInBTN = "Çàêðûòü";
- }
- }
- }
- public class NameComand {
- public string name { get; set; }
- }
- }
|