private void Start(ISpielController sp) { this.spiellogik = sp.SpielLogik(); Undo.Visibility = sp.Undoable() ? Visibility.Visible : Visibility.Collapsed; PrevOb.Visibility = NextOb.Visibility = sp.DurchgaengeMin() > 1 ? Visibility.Visible : Visibility.Collapsed; SpielFeld.Child = (UserControl)spiellogik.spController; BotAppBar.Content = spiellogik.Appbarcontent; globalBest.Text = "WR: " + Counter.GetFormatedCount(spiellogik.Spiel.globaleBestzeit); best.Text = "PR: " + Counter.GetFormatedCount(spiellogik.Spiel.bestzeit); if (spiellogik.GameEnded) { Timer(count, best, globalBest, spiellogik.SpielOld); GameEndAsync(); return; } spiellogik.counter.OnIncrement += async() => await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => Timer(count, best, globalBest, spiellogik.Spiel)); spiellogik.OnGameEnd += GameEndAsync; spiellogik.Start(); }
public ConcentrateController() { this.InitializeComponent(); spiellogik = new SpielLogik(SpielHighscores.GetInstance().spiele[SpielHighscores.CONCENTRATE], this, () => new ConcentrateAufgabe()); for (int i = 0; i < buttons.Length; i++) { buttons[i] = new Button(); buttons[i].Style = (Style) new ResourceDictionary { Source = new Uri("ms-appx:///Pages/ResourceDictionaries/MainButton.xaml") }["MainButtonStyle"]; buttons[i].FontSize = (Double)App.ResourceDict["NormalFont"]; int zahl = i; buttons[i].Click += (sender, e) => Go(zahl); Border border = new Border { CornerRadius = new CornerRadius(15), Margin = new Thickness(0, 15, 0, 15), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Child = buttons[i] }; Container.Children.Add(border); } right = new ColorButton(ColorButton.GREEN); wrong = new ColorButton(ColorButton.RED); right.FontSize = (Double)App.ResourceDict["NormalFont"]; wrong.FontSize = (Double)App.ResourceDict["NormalFont"]; }
public KopfrechnenController() { this.InitializeComponent(); spiellogik = new SpielLogik(SpielHighscores.GetInstance().spiele[SpielHighscores.KOPFRECHNEN], this, () => new Rechenaufgabe()); right = new ColorButton(ColorButton.GREEN) { FontSize = Eingabe.FontSize, Height = Eingabe.Height, Width = Eingabe.Width }; wrong = new ColorButton(ColorButton.RED) { FontSize = Eingabe.FontSize, Height = Eingabe.Height, Width = Eingabe.Width }; RightContainer.Child = right; WrongContainer.Child = wrong; }
protected override void OnNavigatedTo(NavigationEventArgs e) { spielLogik = e.Parameter as SpielLogik; if (spielLogik == null) { return; } SpieleHub.AddStats(NewScoreLeft, NewScoreRight, spielLogik.Spiel); SpieleHub.AddStats(OldScoreLeft, OldScoreRight, spielLogik.SpielOld); if (spielLogik.SpielOld.globaleBestzeit > spielLogik.Spiel.globaleBestzeit || spielLogik.SpielOld.globaleBestzeit == 0) { WorldRecordPopUpAsync(500); } else if (spielLogik.SpielOld.bestzeit > spielLogik.Spiel.bestzeit || spielLogik.SpielOld.bestzeit == 0) { RecordPopUpAsync(500); } }
public WechselGeldController() { this.InitializeComponent(); spiellogik = new SpielLogik(SpielHighscores.GetInstance().spiele[SpielHighscores.WECHSELGELD], this, () => new WechselgeldAufgabe()); Coins[] coins = (Coins[])Enum.GetValues(typeof(Coins)); for (int i = 0; i < eingaben.Length; i++) { eingaben[i] = new WechselGeldEingabe(coins[i]); if (i <= 7) { Reihe1.Children.Add(eingaben[i]); } else { Reihe2.Children.Add(eingaben[i]); } eingaben[i].Margin = new Thickness(10, 10, 10, 10); } }
public MemorizeController() { this.InitializeComponent(); spiellogik = new SpielLogik(SpielHighscores.GetInstance().spiele[SpielHighscores.MEMORIZE], this, () => new MemorizeAufgabe()); for (int i = 0; i < buttons.Length; i++) { SpielFeld.RowDefinitions.Add(new RowDefinition()); SpielFeld.ColumnDefinitions.Add(new ColumnDefinition()); buttons[i] = new Button(); buttons[i].Style = (Style) new ResourceDictionary { Source = new Uri("ms-appx:///Pages/ResourceDictionaries/MainButton.xaml") }["MainButtonStyle"]; buttons[i].FontSize = font; int zahl = i; buttons[i].Click += (sender, e) => Go(buttons[zahl], zahl); buttons[i].Height = buttons[i].Width = height; btnContainer[i] = new Border { CornerRadius = new CornerRadius(15), Margin = new Thickness(15, 15, 15, 15), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Child = buttons[i] }; SpielFeld.Children.Add(btnContainer[i]); right[i] = new ColorButton(ColorButton.GREEN); right[i].Content = i + 1 + ""; right[i].FontSize = buttons[0].FontSize; right[i].Height = right[i].Width = height; } wrong = new ColorButton(ColorButton.RED); wrong.FontSize = buttons[0].FontSize; wrong.Height = wrong.Width = height; }
public static Popup GetPopUp(SpielLogik spiel, Action onClick) { Popup popup = new Popup(); popup.VerticalAlignment = VerticalAlignment.Center; popup.HorizontalAlignment = HorizontalAlignment.Center; popup.Opacity = 1; Border border = new Border(); border.CornerRadius = new CornerRadius(50); border.Padding = new Thickness(50, 50, 50, 50); border.BorderThickness = (Thickness)App.ResourceDict["PopupBoderThickness"]; border.Background = (ImageBrush)App.ResourceDict["PopupBackground"]; border.BorderBrush = (SolidColorBrush)App.ResourceDict["PopupBorderColor"]; border.Name = "PopUpBorderInfo"; StackPanel stack = new StackPanel(); stack.Children.Add(NtextBlock("Herlichen Glückwunsch")); stack.Children.Add(NtextBlock("Du hast das Spiel beendet")); StackPanel stack2 = new StackPanel(); stack2.HorizontalAlignment = HorizontalAlignment.Left; stack2.Margin = new Thickness(0, 20, 0, 20); stack2.Children.Add(NtextBlock("Ergebnis")); stack2.Children.Add(NtextBlock("Zeitstrafen")); stack2.Children.Add(NtextBlock("ZeitstrafenSumme")); stack2.Children.Add(NtextBlock("Endergebnis")); StackPanel stack3 = new StackPanel(); stack3.HorizontalAlignment = HorizontalAlignment.Right; stack3.Margin = new Thickness(0, 20, 0, 20); stack3.Children.Add(NtextBlock(spiel.counter.GetFormatedCount())); stack3.Children.Add(NtextBlock(spiel.TimePenalties + " Mal")); stack3.Children.Add(NtextBlock(Counter.GetFormatedCount(spiel.TimePenaltiesTotal))); stack3.Children.Add(NtextBlock(Counter.GetFormatedCount(spiel.Ergebnis))); StackPanel stack4 = new StackPanel(); stack4.Orientation = Orientation.Horizontal; stack4.Children.Add(stack2); stack4.Children.Add(stack3); Border border2 = new Border(); border2.HorizontalAlignment = HorizontalAlignment.Center; border2.CornerRadius = new CornerRadius(15); border2.Margin = new Thickness(0, 20, 0, 20); border2.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xF0, 0xF8, 0xFF)); Button button = new Button(); button.Style = (Style) new ResourceDictionary { Source = new Uri("ms-appx:///Pages/ResourceDictionaries/MainButton.xaml") }["MainButtonStyle"]; button.Foreground = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x78, 0xD7)); button.Click += (sender, e) => onClick.Invoke(); button.FontSize = 40; button.Content = "Weiter zu den Highscores"; popup.Child = border; border.Child = stack; stack.Children.Add(stack4); stack.Children.Add(border2); border2.Child = button; return(popup); }
public SchiebepuzzleController(Spiel spiel, int tiles, StorageFile file, bool schneideQuadratisch, Action onFinished) { this.InitializeComponent(); spiellogik = new SpielLogik(spiel, this, () => new Schiebepuzzle(tiles, file, schneideQuadratisch, onFinished)); }
public BuchstabenController() { this.InitializeComponent(); spiellogik = new SpielLogik(SpielHighscores.GetInstance().spiele[SpielHighscores.BUCHSTABENSALAT], this, () => new BuchstabenAufgabe()); for (int i = 0; i < vorgabeContainer.Length; i++) { vorgabeContainer[i] = GetBorder(); eingabeContainer[i] = GetBorder(); vorgabeStack.Children.Add(vorgabeContainer[i]); eingabeStack.Children.Add(eingabeContainer[i]); buttons[i] = new ColorButton(ColorButton.BLAU) { Content = i, Height = height, Width = width, FontSize = font }; buttons[i].PointerEntered += (sender, e) => Entered(sender as Button); map.Add(buttons[i], vorgabeContainer[i]); vorgabeContainer[i].Child = buttons[i]; right[i] = new ColorButton(ColorButton.GREEN) { Content = i, Height = height, Width = width, FontSize = font }; wrong[i] = new ColorButton(ColorButton.RED) { Content = i, Height = height, Width = width, FontSize = font }; } moveOverlay = new ColorButton(ColorButton.ORANGE) { Height = height, Width = width, FontSize = font, HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top, ManipulationMode = ManipulationModes.All, Visibility = Visibility.Collapsed, RenderTransform = new CompositeTransform { CenterX = 0.5, CenterY = 0.5 } }; moveOverlay.PointerExited += (sender, e) => Exited(); moveOverlay.ManipulationDelta += Objekt_ManipulationDelta; moveOverlay.ManipulationStarted += Objekt_ManipulationStarted; moveOverlay.ManipulationCompleted += Objekt_ManipulationCompleted; baseGrid.Children.Add(moveOverlay); }
public FarbeGleichWortController() { this.InitializeComponent(); spiellogik = new SpielLogik(SpielHighscores.GetInstance().spiele[SpielHighscores.WORT_GLEICH_FARBE], this, () => new FarbeAufgabe()); ph = new PointerEventHandler(Go); }