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"];
        }
コード例 #2
0
        public ButtonPresser(Button button, Button decoy) : base(SpielHighscores.GetInstance().spiele[SpielHighscores.BUTTONPRESSER], new KopfrechnenController(), () => new Rechenaufgabe())
        {
            this.button            = button;
            this.decoy             = decoy;
            button.PointerEntered += ButtonEntered;
            button.Click          += async(sender, e) => await OnButtonPressedAsync();

            decoy.Click += async(sender, e) => await OnDecoyPressedAsync();

            decoy.PointerExited += async(sender, e) => await SetNewButtonPositionsAsync();

            button.Content = MinButtonPesses - ButtonPresses + "";
            decoy.Content  = "!!!NO!!!";
        }
コード例 #3
0
        /* Spiel starten */
        private void StarteSpiel()
        {
            if (Liste.SelectedIndex == -1)
            {
                return;
            }

            int tilesize = 2;

            if (tb1.IsChecked.Value)
            {
                tilesize = 3;
            }
            else if (tb2.IsChecked.Value)
            {
                tilesize = 4;
            }
            else if (tb3.IsChecked.Value)
            {
                tilesize = 5;
            }

            Spiel spiel = null;

            if (tb1.IsChecked.Value)
            {
                spiel = SpielHighscores.GetInstance().spiele[SpielHighscores.SCHIEBEPUZZLE_LEICHT];
            }
            else if (tb2.IsChecked.Value)
            {
                spiel = SpielHighscores.GetInstance().spiele[SpielHighscores.SCHIEBEPUZZLE_NORMAL];
            }
            else if (tb3.IsChecked.Value)
            {
                spiel = SpielHighscores.GetInstance().spiele[SpielHighscores.SCHIEBEPUZZLE_SCHWER];
            }

            StarteSpielBtn.IsEnabled = false;
            WaitRing.IsActive        = true;

            progress.Visibility = Visibility.Visible;

            puzzle = new SchiebepuzzleController(spiel, tilesize, dateien[(Border)Liste.SelectedItem], tbQuadratisch.IsChecked.Value, ActionStarteSpiel);
        }
 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;
 }
コード例 #5
0
        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);
            }
        }
コード例 #6
0
        public SpieleHub()
        {
            this.InitializeComponent();
            App.currentPage = this;

            volumeOn.Visibility       = Sounddesign.CURRENT_AMBIENT == null ? Visibility.Collapsed : Visibility.Visible;
            volumeOff.Visibility      = Sounddesign.CURRENT_AMBIENT == null ? Visibility.Visible : Visibility.Collapsed;
            Sounddesign.OverrideNext  = Sounddesign.WOOSH;
            Sounddesign.OverrideNextN = 2;

            SpielHighscores sp = SpielHighscores.GetInstance();

            AddStats(SchiebePuzzle0Left, SchiebePuzzle0Right, sp.spiele[0]);
            AddStats(SchiebePuzzle1Left, SchiebePuzzle1Right, sp.spiele[1]);
            AddStats(SchiebePuzzle2Left, SchiebePuzzle2Right, sp.spiele[2]);
            AddStats(WortGzahlLeft, WortGzahlRight, sp.spiele[3]);
            AddStats(KopfrechnenLeft, KopfrechnenRight, sp.spiele[4]);
            AddStats(WechselGeldLeft, WechselGeldRight, sp.spiele[5]);
            AddStats(BuchstabenSalatLeft, BuchstabenSalatRight, sp.spiele[6]);
            AddStats(MemorizeLeft, MemorizeRight, sp.spiele[7]);
            AddStats(ConcentrateLeft, ConcentrateRight, sp.spiele[8]);
        }
コード例 #7
0
        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;
        }
コード例 #8
0
        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);
        }
コード例 #9
0
        private void LoginButton_Click(object sender, RoutedEventArgs e)
        {
            Sounddesign.PlaySoundAsync(Sounddesign.BUTTON_PUSH1);

            if (App.OFFLINE_MODE)
            {
                Nutzer.Getinstance();
                this.Frame.Navigate(typeof(SpieleHub));
                return;
            }


            // Prüfe Eingaben
            if (nickname.Text.Length < 3)
            {
                FehlerAusgabe.Text = "Nickname zu kurz. Min. 3 Zeichen";
                return;
            }
            if (pwd.Password.Length < 6)
            {
                FehlerAusgabe.Text = "Passwort zu kurz. Min. 6 Zeichen";
                return;
            }

            if (!IsLogin && !pwdConfirm.Password.Equals(pwd.Password))
            {
                FehlerAusgabe.Text = "Passwörter stimmen nicht überein";
                return;
            }

            if (logingIn)
            {
                return;
            }
            logingIn = true;

            WaitRing.IsActive = true;

            loginButton.IsEnabled   = false;
            ToggleAuswahl.IsEnabled = false;
            nickname.IsEnabled      = false;
            pwd.IsEnabled           = false;
            pwdConfirm.IsEnabled    = false;
            credits.IsEnabled       = false;

            //Einloggen
            Request <Nutzer> request = null;
            string           name    = nickname.Text;
            string           pass    = pwd.Password;
            BackgroundWorker bw      = new BackgroundWorker();

            bw.DoWork += (s, e1) =>
            {
                request = Nutzer.Einloggen((IsLogin ? App.FUNCTION_LOGIN : App.FUNCTION_REGISTER), name, pass).GetAwaiter().GetResult();
                if (request != null && request.Success)
                {
                    SpielHighscores.HoleHighscoresAsync().GetAwaiter();
                }
            };
            bw.RunWorkerCompleted += (s, e1) => Login(request);
            bw.RunWorkerAsync();
        }
 public FarbeGleichWortController()
 {
     this.InitializeComponent();
     spiellogik = new SpielLogik(SpielHighscores.GetInstance().spiele[SpielHighscores.WORT_GLEICH_FARBE], this, () => new FarbeAufgabe());
     ph         = new PointerEventHandler(Go);
 }