Ejemplo n.º 1
0
        public NewChallenger()
        {
            InitializeComponent();

            String[] ChallengerArray = { "No Prefference",  "Bayonetta",       "Bowser",          "Captain Falcon", "Chrom",      "Cloud",       "Corrin",      "Daisy",    "Dark Pit",
                                         "Dark Samus",      "Diddy Kong",      "Dr.Mario",        "Duck Hunt",      "Falco",      "Fox",         "Ganondorf",   "Greninja", "Ice Climbers", "Ike",               "Incineroar",
                                         "Inkling",         "Isabelle",        "Jigglypuff",      "Joker",          "Ken",        "King Dedede", "King K.Rool", "Kirby",    "Link",         "Little Mac",        "Lucario",
                                         "Lucas",           "Lucina",          "Luigi",           "Mario",          "Marth",      "Mega Man",    "Meta Knight", "Mewtwo",   "Mii Brawler",  "Mii Swordfighter",  "Mii Gunner",
                                         "Mr.Game & Watch", "Ness",            "Olimar",          "Pac-Man",        "Palutena",   "Peach",       "Pichu",       "Pikachu",  "Piranha Plant","Pit",               "Richter",   "Ridley",
                                         "R.O.B.",          "Robin",           "Pokemon Trainer", "Rosalina",       "Roy",        "Ryu",         "Samus",       "Sheik",    "Shulk",        "Simon",             "Snake",     "Sonic", "Toon Link","Villager",
                                         "Wario",           "Wii Fit Trainer", "Wolf",            "Yoshi",          "Young Link", "Zelda",       "Zero Suit Samus" };

            cmbx_main.DataSource = ChallengerArray;



            sr = new System.IO.StreamReader("SmashTracker.txt");

            while (!sr.EndOfStream)
            {
                string   line     = sr.ReadLine();
                string[] fileLine = line.Split(',');

                Challenger fileItem = new Challenger(fileLine[0], fileLine[1], int.Parse(fileLine[2]), double.Parse(fileLine[3]));

                challengerList.Add(fileItem);
            }
            sr.Close();
        }
Ejemplo n.º 2
0
        public List <Challenger> getItemList()
        {
            List <Challenger> mirror = new List <Challenger>(theList.Count);

            foreach (Challenger i in theList)
            {
                Challenger item = i;
                mirror.Add(item);
            }
            return(mirror);
        }
Ejemplo n.º 3
0
 public bool Add(Challenger challenger)
 {
     if (theList.Contains(challenger))
     {
         return(false);
     }
     else
     {
         this.theList.Add(challenger);
         return(true);
     }
 }
Ejemplo n.º 4
0
        private void Btn_rankings_Click(object sender, EventArgs e)
        {
            sr = new System.IO.StreamReader("SmashTracker.txt");

            while (!sr.EndOfStream)
            {
                string   line     = sr.ReadLine();
                string[] fileLine = line.Split(',');

                Challenger fileItem = new Challenger(fileLine[0], fileLine[1], int.Parse(fileLine[2]), double.Parse(fileLine[3]));

                challengerList.Add(fileItem);
            }
            sr.Close();

            List <Challenger> rankingsList = challengerList.getItemList();

            Rankings rankings = new Rankings(rankingsList);

            rankings.ShowDialog();
        }
Ejemplo n.º 5
0
        private void Btn_add_Click(object sender, EventArgs e)
        {
            string name = txtbx_name.Text;
            string main = cmbx_main.Text;
            int    BP   = 0;
            double KDA  = 0.0;

            Challenger challenger = new Challenger(name, main, BP, KDA);
            //adding it to the List
            bool result = challengerList.Add(challenger);



            if (result == true)
            {
                MessageBox.Show("Added successfully");
            }
            else
            {
                MessageBox.Show("Error adding");
            }

            sw = new System.IO.StreamWriter("SmashTracker.txt");

            List <Challenger> mirror = challengerList.getItemList();

            MessageBox.Show("Saved successfully");

            foreach (Challenger i in mirror)
            {
                sw.WriteLine(i.ToString());
            }

            sw.Close();



            this.Close();
        }