Exemplo n.º 1
0
        public void userPlusHabit(int hNumber)
        {
            Habit h = user.habits[hNumber];

            user.habits[hNumber].count += 1;
            user.exp += h.expForHabit(user.lvl);
            Console.WriteLine("Habit: " + user.habits[hNumber].name + "'s couter: " + user.habits[hNumber].count);
        }
Exemplo n.º 2
0
        public void userMinusHabit(int hNumber)
        {
            Habit h = user.habits[hNumber];

            user.habits[hNumber].count -= 1;
            user.health -= h.minusHp(user.lvl);
            Console.WriteLine("Habit: " + user.habits[hNumber].name + "'s couter: " + user.habits[hNumber].count);
            Console.WriteLine("-" + h.minusHp(user.lvl).ToString() + " HP");
        }
Exemplo n.º 3
0
        public void loadUser()
        {
            User user      = new User("");
            bool foundUser = false;

            Console.WriteLine("Your name?");
            string name = Console.ReadLine();

            for (int i = 0; i < users.Count; i++)
            {
                if (users[i].name == name)
                {
                    foundUser   = true;
                    user.name   = name;
                    user.exp    = users[i].exp;
                    user.lvl    = users[i].lvl;
                    user.health = users[i].health;
                    break;
                }
            }

            if (foundUser == false)
            {
                Console.WriteLine("Error");
            }
            else
            {
                string       line;
                StreamReader srHabits  = new StreamReader(name + "_Habits.txt");
                StreamReader srToDos   = new StreamReader(name + "_ToDos.txt");
                StreamReader srDailies = new StreamReader(name + "_Dailies.txt");
                while ((line = srHabits.ReadLine()) != null)
                {
                    Habit    h = new Habit("", 0, 0, 0, 0);
                    string[] s = line.Split('@');
                    h.name       = s[0];
                    h.minPlus    = Convert.ToInt16(s[1]);
                    h.count      = Convert.ToInt16(s[2]);
                    h.difficulty = Convert.ToInt16(s[3]);
                    h.time       = Convert.ToInt16(s[4]);
                    user.habits.Add(h);
                }
                while ((line = srToDos.ReadLine()) != null)
                {
                    ToDo     td = new ToDo("", 0, 0);
                    string[] s  = line.Split('@');
                    td.name       = s[0];
                    td.difficulty = Convert.ToInt16(s[1]);
                    td.time       = Convert.ToInt16(s[2]);
                }
                srHabits.Close();
                srDailies.Close();
                srToDos.Close();
                Board board = new Board(user);
            }
        }
Exemplo n.º 4
0
        public void habitOpera(int hNumber)
        {
            Habit h = user.habits[hNumber];

            Console.WriteLine("This habit:");
            Console.WriteLine("Name: " + h.name);
            Console.WriteLine(" Difficulty (0-10): " + h.difficulty);
            Console.WriteLine("Time (0-10): " + h.time);
            Console.WriteLine("Streak: " + h.count);
        }
Exemplo n.º 5
0
        public void readHDT()
        {
            StreamReader srUsers = new StreamReader("Users.txt");
            string       line;
            bool         foundUser = false;

            while ((line = srUsers.ReadLine()) != null)
            {
                string[] s = line.Split('@');
                if (s[0] == name)
                {
                    name      = s[0];
                    exp       = Convert.ToInt16(s[1]);
                    lvl       = Convert.ToInt16(s[2]);
                    health    = Convert.ToDouble(s[3]);
                    foundUser = true;
                    break;
                }
            }
            if (foundUser == false)
            {
                Console.WriteLine("Error");
            }
            else
            {
                StreamReader srHabits  = new StreamReader(name + "_Habits.txt");
                StreamReader srToDos   = new StreamReader(name + "_ToDos.txt");
                StreamReader srDailies = new StreamReader(name + "_Dailies.txt");
                while ((line = srHabits.ReadLine()) != null)
                {
                    Habit    h = new Habit("", 0, 0, 0, 0);
                    string[] s = line.Split('@');
                    h.name       = s[0];
                    h.minPlus    = Convert.ToInt16(s[1]);
                    h.count      = Convert.ToInt16(s[2]);
                    h.difficulty = Convert.ToInt16(s[3]);
                    h.time       = Convert.ToInt16(s[4]);
                    habits.Add(h);
                }
                while ((line = srToDos.ReadLine()) != null)
                {
                    ToDo     td = new ToDo("", 0, 0);
                    string[] s  = line.Split('@');
                    td.name       = s[0];
                    td.difficulty = Convert.ToInt16(s[1]);
                    td.time       = Convert.ToInt16(s[2]);
                }
                srHabits.Close();
                srDailies.Close();
                srToDos.Close();
            }
        }