예제 #1
0
        public async void L4Tapped(object sender, EventArgs e)
        {
            TapCounter1++;
            if (TapCounter1 == 1)
            {
                BGMusics.Clicking_Sound().Play();
                BGMusics.Menu_BGM().Stop();
                BGMusics.InGame_BGM().Play();
                Flow.StarSetter(4);
                Flow.IsGameInCategory(false);
                LoadingBit.IsVisible = true;
                Fetch.IsRunning      = true;
                BGMusics.Loading_Sound().Play();
                LocalSelection.ConvertQuotesAndSayings();
                LoadingBit.IsVisible = true;
                Fetch.IsRunning      = true;
                L4.IsEnabled         = false;
                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;
            }
        }
예제 #2
0
        void LoadGames()
        {
            int slotsAvailbale = 3;

            Image[]  SlotHolder = new Image[slotsAvailbale];
            Label[]  SlotName   = new Label[slotsAvailbale];
            string[] text       = new string[slotsAvailbale];
            string[] setting    = new string[slotsAvailbale];
            string[] theValues  = new string[slotsAvailbale];
            int[]    star       = new int[slotsAvailbale];
            TapGestureRecognizer[] recognizer = new TapGestureRecognizer[slotsAvailbale];
            for (int i = 0; i < slotsAvailbale; i++)
            {
                SaveSlots.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(1, GridUnitType.Star)
                });
            }

            for (int i = 0; i < slotsAvailbale; i++)
            {
                SaveOrLoad.LoadGameInSelectedSlot("SD" + (i + 1));
                if (string.IsNullOrEmpty(SaveOrLoad.SetLoadedDataValues()))
                {
                    text[i] = "Saved Game " + (i + 1);
                }
                else
                {
                    if (SaveOrLoad.SetLoadedGameType() == "Variety")
                    {
                        switch (SaveOrLoad.SetLoadedSettings())
                        {
                        case "1": setting[i] = "Easy"; star[i] = 1; break;

                        case "2": setting[i] = "Moderate"; star[i] = 2; break;

                        case "3": setting[i] = "Challenging"; star[i] = 3; break;

                        case "4": setting[i] = "Difficult"; star[i] = 4; break;
                        }
                    }
                    else
                    {
                        setting[i] = SaveOrLoad.SetLoadedSettings();
                    }
                    theValues[i] = SaveOrLoad.SetLoadedDataValues();
                    text[i]      = SaveOrLoad.SetSaveName() + Environment.NewLine + SaveOrLoad.SetLoadedGameType() + Environment.NewLine + setting[i];
                }
                SlotHolder[i] = new Image {
                    Source          = ImageSource.FromResource("TokBlitzBeta.GameAssets.Button.BlackButton.png"),
                    BackgroundColor = Color.Transparent, Aspect = Aspect.AspectFit
                };
                SlotName[i] = new Label {
                    Text = text[i], FontFamily = "Face Off M54.ttf#Face Off M54", FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)), TextColor = Color.White, BackgroundColor = Color.Transparent, VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center
                };
                int mark = i;
                recognizer[i]         = new TapGestureRecognizer();
                recognizer[i].Tapped += async(sender, args) =>
                {
                    BGMusics.Clicking_Sound().Play();
                    if (!string.IsNullOrEmpty(theValues[mark]))
                    {
                        if (!Flow.GameInCategory())
                        {
                            Flow.StarSetter(star[mark]);
                            Flow.IsGameInCategory(false);
                            LocalSelection.ConvertQuotesAndSayings();
                            SaveOrLoad.GetPhrases(theValues[mark].Split('-'));
                            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;
                        }
                        else
                        {
                            Flow.IsGameInCategory(true);
                            LocalSelection.ConvertQuotesAndSayings();
                            SaveOrLoad.GetPhrases(theValues[mark].Split('-'));
                            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;
                        }
                    }
                    else
                    {
                        await DisplayAlert("Warning!", "No Save Game Found", "OK");
                    }
                };
                SlotName[i].GestureRecognizers.Add(recognizer[i]);
                SaveSlots.Children.Add(SlotHolder[i], 0, i);
                SaveSlots.Children.Add(SlotName[i], 0, i);
            }
        }