Ejemplo n.º 1
0
        public void CreateSave(GamerInfo gamer)
        {
            string     path = Environment.CurrentDirectory + "\\Saves" + $"\\{gamer.Name}.txt";
            FileStream fs   = File.Create(path);

            fs.Close();
            File.AppendAllText(path, $"{gamer.Name} {gamer.Scores} {(int)MenuOptionsData.TableColor} {(int)MenuOptionsData.CursorColor} {(int)MenuOptionsData.WordColor} {(int)MenuOptionsData.TrueWordColor} {(int)MenuOptionsData.TableHeight} {(int)MenuOptionsData.TableWidth}");
        }
Ejemplo n.º 2
0
        public GamerInfo GetOneSave(string path)
        {
            string file = File.ReadAllText(path);

            string[] save = file.Split(' ');
            MenuOptionsData.TableColor    = int.Parse(save[2]);
            MenuOptionsData.CursorColor   = int.Parse(save[3]);
            MenuOptionsData.WordColor     = int.Parse(save[4]);
            MenuOptionsData.TrueWordColor = int.Parse(save[5]);
            MenuOptionsData.TableHeight   = int.Parse(save[6]);
            MenuOptionsData.TableWidth    = int.Parse(save[7]);
            GamerInfo gamer = new GamerInfo(save[0], int.Parse(save[1]), new char[0, 0]);

            return(gamer);
        }
Ejemplo n.º 3
0
        public void WriteRecord(GamerInfo gamer)
        {
            int k = 0;

            if (CheckInRecords(gamer.Name, gamer.Scores, Records, ref k) == 1)
            {
                Records[k] = $"{Records[k].Split(" ")[0]} {gamer.Name} - {gamer.Scores} ";

                BubbleSort(Records);
            }
            else if (CheckInRecords(gamer.Name, gamer.Scores, Records, ref k) == 0)
            {
                BubbleSort(Records);
            }
            else if (gamer.Scores > int.Parse(Records[9].Split(" ")[3]))
            {
                Records[9] = $"{Records[9].Split(" ")[0]} {gamer.Name} - {gamer.Scores} ";
                BubbleSort(Records);
            }
            File.WriteAllLines(Environment.CurrentDirectory + "\\Records.txt", Records);
        }
Ejemplo n.º 4
0
 public NewGame(GamerInfo gamer)
 {
     Gamer        = gamer;
     ScoresForLvl = GameTable.Words.Count;
 }