Example #1
0
        void BuildCategory()
        {
            Image[,] image = new Image[10, 3];
            string[] names = { "Ability",    "Adversity", "Aging", "Attitude",    "Courage",    "Commitment",
                               "Creativity", "Education", "Faith", "Family",      "Friendship", "God",         "Goverment","Health",   "Humor",   "Kindness",
                               "Leadership", "Love",      "Money", "Opportunity", "Patience",   "Perseverance","Peace",  "Politics", "Quality",
                               "Service",    "Success",   "Time",  "Wisdom",      "Work" };
            Label[,] labels = new Label[10, 3];
            TapGestureRecognizer[,] recognizers = new TapGestureRecognizer[10, 3];
            for (int i = 0; i < 3; i++)
            {
                CategorySection.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                });
            }
            for (int i = 0; i < 10; i++)
            {
                CategorySection.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(1, GridUnitType.Star)
                });
            }
            int pos = 0;

            for (int row = 0; row < 10; row++)
            {
                for (int coloumn = 0; coloumn < 3; coloumn++)
                {
                    image[row, coloumn] = new Image {
                        Source          = ImageSource.FromResource("TokBlitzBeta.GameAssets.Button.BlackButton.png"),
                        BackgroundColor = Color.Transparent,
                    };
                    labels[row, coloumn] = new Label {
                        Text = names[pos], FontFamily = "Face Off M54.ttf#Face Off M54", TextColor = Color.White, BackgroundColor = Color.Transparent, VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center
                    };
                    int i = pos;
                    recognizers[row, coloumn]         = new TapGestureRecognizer();
                    recognizers[row, coloumn].Tapped += (sender, e) => {
                        BGMusics.Clicking_Sound().Play();

                        CategoryLoad.LoadCategoryBy(names[i]);
                        CategoryName.Text = names[i];
                        TotalToks.Text    = "Total Toks: " + CategoryLoad.SetTotalToks();
                        ToksLeft.Text     = "Toks Left: " + CategoryLoad.SetToksLeft();
                        RankSetter(names[i]);
                        CategorySection.IsVisible         = false;
                        CategorySectionSelected.IsVisible = true;
                    };
                    labels[row, coloumn].GestureRecognizers.Add(recognizers[row, coloumn]);
                    image[row, coloumn].GestureRecognizers.Add(recognizers[row, coloumn]);
                    CategorySection.Children.Add(image[row, coloumn], coloumn, row);
                    CategorySection.Children.Add(labels[row, coloumn], coloumn, row);
                    pos++;
                }
            }
        }
Example #2
0
        void RankSetter(string category)
        {
            if (Application.Current.Properties.ContainsKey(category.ToLower()))
            {
                Application.Current.Properties[category.ToLower()] = string.Empty;
            }
            else
            {
                Application.Current.Properties.Add(category.ToLower(), string.Empty);
            }
            Application.Current.SavePropertiesAsync();
            string CheckCategory = Application.Current.Properties[category.ToLower()].ToString();

            if (string.IsNullOrEmpty(CheckCategory))
            {
                if (CategoryLoad.SetWhatPart() == "PART 1")
                {
                    S1.IsVisible  = false;
                    S2.IsVisible  = true;
                    S3.IsVisible  = false;
                    TheTitle.Text = "AIR MAJOR";
                }
                if (CategoryLoad.SetWhatPart() == "PART 2")
                {
                    S1.IsVisible  = true;
                    S2.IsVisible  = false;
                    S3.IsVisible  = true;
                    TheTitle.Text = "MASTER AIR MAJOR";
                }
                if (CategoryLoad.SetWhatPart() == "PART 3")
                {
                    S1.IsVisible  = true;
                    S2.IsVisible  = true;
                    S3.IsVisible  = true;
                    TheTitle.Text = "SENIOR AIR MAJOR";
                    Application.Current.Properties.Add(category, CategoryLoad.SetWhatPart());
                }
            }
            else
            {
                S1.IsVisible  = true;
                S2.IsVisible  = true;
                S3.IsVisible  = true;
                TheTitle.Text = "SENIOR AIR MAJOR";
            }
            Application.Current.SavePropertiesAsync();
        }
Example #3
0
        public async void Play_Clicked(object sender, EventArgs eventArgs)
        {
            TapCounter2++;
            if (TapCounter2 == 1)
            {
                BGMusics.Clicking_Sound().Play();
                BGMusics.Menu_BGM().Stop();
                BGMusics.InGame_BGM().Play();

                SaveOrLoad.ALoadedGame(false);
                CategoryLoad.SaveThisNow(CategoryName.Text);
                LoadingBit.IsVisible = true;
                Fetch.IsRunning      = true;
                BGMusics.Loading_Sound().Play();



                LoadingBit.IsVisible = true;
                Fetch.IsRunning      = true;

                var navPage = new NavigationPage(new Blank1());
                await Task.Delay(200);

                await navPage.FadeTo(0, 250);

                await Task.Delay(200);

                await navPage.FadeTo(1, 250);

                Application.Current.MainPage = navPage;

                /*
                 *
                 *     for (int k = 0; k < 5; k++)
                 * {
                 * await DisplayAlert("Result", CategoryLoad.LoadSelectedToks()[k].ToString(), "OK");
                 * }
                 * await DisplayAlert("Result", CategoryLoad.LoadSelectedToks()[0].ToString(), "OK");
                 * await DisplayAlert("Result", Selection.ThisIsThePhrase(), "OK");
                 *
                 *
                 *
                 */
            }
        }