Ejemplo n.º 1
0
 public void LoadSaveData(object sender, EventArgs e)
 {
     BGMusics.Clicking_Sound().Play();
     SaveOrLoad.ALoadedGame(true);
     Menus.IsVisible = false;
     Slots.IsVisible = true;
 }
Ejemplo n.º 2
0
 public async void CategoryTapped(object sender, EventArgs e)
 {
     Flow.IsGameInCategory(true);
     BGMusics.Clicking_Sound().Play();
     SaveOrLoad.ALoadedGame(false);
     Menus.IsVisible           = false;
     DifficutyMenu.IsVisible   = false;
     CategorySection.IsVisible = true;
 }
Ejemplo n.º 3
0
        public List <MedOrganization> GenListMedOrg()
        {
            int    i         = 0;
            string NameOrgan = "";
            string Adres     = "";
            string TelNumber = "";

            FileInfo fi = new FileInfo(MedOrgPath);

            if (fi.Exists)
            {
                SaveOrLoad load = new SaveOrLoad();
                MedOrgList = (List <MedOrganization>)load.MedOrgXMLDeSerialize();
            }
            else
            {
                do
                {
                    NameOrgan = ((OrgName)rand.Next(1, 5)).ToString();
                    if (isExist(MedOrgList, NameOrgan))
                    {
                        NameOrgan = ((OrgName)rand.Next(1, 5)).ToString();
                    }
                    else
                    {
                        Adres = ((Streets)rand.Next(1, 8)).ToString();
                        if (isExist(MedOrgList, NameOrgan, Adres))
                        {
                            Adres = ((Streets)rand.Next(1, 8)).ToString();
                        }
                        else
                        {
                            TelNumber = "+7" + (rand.Next(701, 708).ToString()) + (rand.Next(1000000, 9999999).ToString());
                            MedOrganization medOrganization = new MedOrganization(NameOrgan, Adres, TelNumber);
                            medOrganization.Id = rand.Next(100000, 999999);
                            foreach (Patient item in PatientList)
                            {
                                if (NameOrgan == item.MedOrgName)
                                {
                                    medOrganization.PatientList.Add(item);
                                }
                            }

                            MedOrgList.Add(medOrganization);
                            i++;
                        }
                    }
                } while (i < 4);
            }
            //foreach (MedOrganization item in MedOrgList)
            //{
            //    item.MedOrganizationInfo();
            //}

            return(MedOrgList);
        }
Ejemplo n.º 4
0
        // update player info
        private void UpdatePlayerInfo()
        {
            _playerinfo.score = _playerScore;

            if (!File.Exists(_storePath))
            {
                File.Create(_storePath);
            }
            SaveOrLoad.Save(_storePath, _playerinfo);
        }
Ejemplo n.º 5
0
 // Start is called before the first frame update
 void Start()
 {
     if (File.Exists(_storePath))
     {
         _playerinfo = SaveOrLoad.Load <Playerinfo>(_storePath);
         if (_playerinfo != null)
         {
             _gameStatePopUpHighScoreText.text = "Highscore : " + _playerinfo.score.ToString();
         }
     }
 }
Ejemplo n.º 6
0
        public MainPage()
        {
            InitializeComponent();

            LoadMainForm();
            ShoppingSmash();
            SaveOrLoad.ALoadedGame(false);
            Game.DefaultSmash();
            PointSystem.ResetScore();
            if (CrossConnectivity.Current.IsConnected)
            {
                AutomaticLogIn();
            }
            Flow.ResetRound();
            Flow.DidTheGameStart(false);
            BGMusics.Menu_BGM().Play();
        }
Ejemplo n.º 7
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");
                 *
                 *
                 *
                 */
            }
        }
Ejemplo n.º 8
0
        // Start is called before the first frame update
        void Start()
        {
            #region load player info

            _playerinfo = new Playerinfo();
            if (File.Exists(_storePath))
            {
                _playerinfo = SaveOrLoad.Load <Playerinfo>(_storePath);
                if (_playerinfo == null)
                {
                    _playerinfo = new Playerinfo();
                }

                _playerinfo.levelNumber = 1;
            }

            #endregion

            Reset();
            LevelManager.Instance.scoreUpdated += Instance_ScoreUpdate;
            MainCharacter.Instance.gameOver    += GameOver;
        }
Ejemplo n.º 9
0
        public void Variety_Clicked(object sender, EventArgs e)
        {
            TapCounter++;
            BGMusics.Clicking_Sound().Play();
            if (TapCounter == 1)
            {
                Flow.GetPlayerMode(false);
                Flow.IsGameInCategory(false);
                SaveOrLoad.ALoadedGame(false);
                string[] listitems = { "" };
                Flow.GameSelection(1);

                // var data = LocalSelection.ConvertQuotesAndSayings();
                // LocalSelection.QuotesAndSayingsSelected();
                //  LoadingBit.IsVisible = true;
                // Fetch.IsRunning = true;



                Menus.IsVisible         = false;
                DifficutyMenu.IsVisible = true;
            }
        }
Ejemplo n.º 10
0
        public List <Patient> GenListPatients()
        {
            FileInfo fi = new FileInfo(PatientPath);

            if (fi.Exists)
            {
                SaveOrLoad load = new SaveOrLoad();
                PatientList = (List <Patient>)load.PatientXMLDeSerialize();
            }
            else
            {
                for (int i = 0; i < rand.Next(10, 20); i++)
                {
                    string  Familiya  = ((LastName)rand.Next(1, 8)).ToString();
                    string  Imya      = ((Name)rand.Next(1, 8)).ToString();
                    string  Otchestvo = ((Otchestvo)rand.Next(1, 8)).ToString();
                    int     IIN       = rand.Next(100000000, 999999999);
                    string  nameOrg   = ((OrgName)rand.Next(1, 6)).ToString();
                    Patient patient   = new Patient(Familiya, Imya, Otchestvo, IIN, nameOrg);
                    PatientList.Add(patient);
                }
            }
            return(PatientList);
        }
Ejemplo n.º 11
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);
            }
        }
Ejemplo n.º 12
0
        public async void Multiplayer_Tapped(object sender, EventArgs e)
        {
            BGMusics.Clicking_Sound().Play();
            BGMusics.Menu_BGM().Stop();
            BGMusics.InGame_BGM().Play();
            Flow.GetPlayerMode(true);
            SaveOrLoad.ALoadedGame(false);
            if (TapCounter > 1)
            {
                return;
            }
            LoadingBit.IsVisible = true;
            Fetch.IsRunning      = true;
            string CacheEmail    = Application.Current.Properties["UserEmail"].ToString();
            string CachePassword = Application.Current.Properties["UserPassword"].ToString();

            try
            {
                if (string.IsNullOrEmpty(CacheEmail) || string.IsNullOrEmpty(CachePassword))
                {
                    await DisplayAlert("No Account", "Please Log in", "OK");

                    LoadingBit.IsVisible = false;
                    Fetch.IsRunning      = false;
                    return;
                }
                var link = await apiClient.LoginEmailPasswordAsync(CacheEmail, CachePassword);

                var userdata = await apiClient.GetUserAsync(link.User.LocalId);
            }
            catch (Exception ex)
            {
                LoadingBit.IsVisible = false;
                Fetch.IsRunning      = false;
                await DisplayAlert("No Account", "Please Log in", "OK");

                return;
            }
            if (string.IsNullOrEmpty(UserData.GetUserLabel()))
            {
                LoadingBit.IsVisible = false;
                Fetch.IsRunning      = false;
                await DisplayAlert("No Account", "Please Log in", "OK");

                return;
            }

            try
            {
                me.UserName = UserData.GetUserLabel()?.Trim();

                me.UserId = Application.Current.Properties["UserId"].ToString();


                lblMessages.Text = "Getting connection info...";

                SignalRConnectionInfo connectionInfo = await SignalRService.GetSignalRConnectionInfo();

                var url = connectionInfo.Url;
                lblMessages.Text = $"Connecting...";

                connection = new HubConnectionBuilder()
                             .WithUrl(url, options =>
                {
                    options.AccessTokenProvider = () => Task.FromResult(connectionInfo.AccessToken);
                })
                             .Build();

                //connection.Closed += async (error) =>
                //{
                //    //Optional code: only used for retrying to connect
                //    //await Task.Delay(new Random().Next(0, 5) * 1000);
                //    //await connection.StartAsync();
                //};
                #region Connection
                //Waiting for other player
                connection.On <GamePlayer>("waiting", (player) =>
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        if (player.UserId == me.UserId)
                        {
                            Fetch.IsRunning  = true;
                            lblMessages.Text = "Waiting for players...";
                        }
                    });
                });

                //2 player game successfully created (method name MUST be 'newgame'
                connection.On <GameInfo>("newgame", (info) =>
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        gameInfo          = info;
                        var currentPlayer = info.Players.Find(x => x.UserId == me.UserId);
                        if (currentPlayer.PlayerNumber == 1)
                        {
                            isPlayer1 = true;
                            ///      btnStartTimer.IsEnabled = true;
                        }
                        else
                        {
                            isPlayer1 = false;
                            //         btnStartTimer.IsEnabled = false;
                        }

                        MultiPlayerSettings.IsThisPlayer1(isPlayer1);
                        //Fill label with game content
                        //      lblGameContent.Text = $"Room Id: {info.RoomId}{Environment.NewLine}Player 1: {info.Players[0].UserName}{Environment.NewLine}Player 2: {info.Players[1].UserName}{Environment.NewLine}Toks:{Environment.NewLine}";
                        lblMessages.Text = $"Room Id: {info.RoomId}{Environment.NewLine}Player 1: {info.Players[0].UserName}{Environment.NewLine}Player 2: {info.Players[1].UserName}{Environment.NewLine}Toks:{Environment.NewLine}";
                        if (MultiPlayerSettings.YupThisIsPlayer1())
                        {
                            MultiPlayerSettings.OtherPlayersData(info.Players[1].UserName, info.Players[1].UserPhoto);
                        }
                        else
                        {
                            MultiPlayerSettings.OtherPlayersData(info.Players[0].UserName, info.Players[0].UserPhoto);
                        }
                        for (int i = 0; i < info.Toks.Count; ++i)
                        {
                            mainv.OnlineQoutes.Add(new OnlineQoutes()
                            {
                                QouteID      = info.Toks[i].Id,
                                QoutePhrase  = info.Toks[i].PrimaryFieldText,
                                QoutesSource = info.Toks[i].SecondaryFieldText,
                                Category     = info.Toks[i].Category
                            });
                        }
                        MultiPlayerSettings.GetGameInfo(gameInfo);
                        Selection.GetOnlineList(mainv.OnlineQoutes);
                        var navPage = new NavigationPage(new Blank2());
                        Application.Current.MainPage = navPage;
                    });
                });
                #endregion

                BGMusics.Loading_Sound().Play();
                await connection.StartAsync();

                Fetch.IsRunning  = false;
                lblMessages.Text = $"Connected.";
                await SignalRService.MultiplayerSetup(me);

                Btn_Find.IsVisible = true;
            }
            catch (Exception ex)
            {
                //        lblMessages.Text = ex.Message;
                await DisplayAlert("Error", ex.ToString(), "Ok");
            }


            /*
             * var navPage = new NavigationPage(new Multiplayer());
             * await Task.Delay(200);
             * await navPage.FadeTo(0, 250);
             * await Task.Delay(200);
             * await navPage.FadeTo(1, 250);
             * Application.Current.MainPage = navPage;
             *
             */
        }
Ejemplo n.º 13
0
 public void Show(SaveOrLoad saveOrLoad)
 {
     SaveOrLoad = saveOrLoad;
     Show(true);
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Data" /> class.
 /// </summary>
 /// <param name="sol">The type for the event.</param>
 /// <param name="inFileName">The file name to save into.</param>
 public Data(SaveOrLoad sol, string inFileName)
 {
     Type     = sol;
     FileName = inFileName;
 }