Esempio n. 1
0
        public List<Team> LoadTeams()
        {
            List<Team> result = new List<Team>();

            XmlSerializer xs = new XmlSerializer(typeof(TeamDataCollection));
            TeamDataCollection tc;

            try
            {
                using (StreamReader sr = new StreamReader(ConfigurationManager.AppSettings["XmlTeamsData"]))
                {
                    tc = xs.Deserialize(sr) as TeamDataCollection;
                }

                Team red = new Team(tc.RedTeam.Name, TeamId.Red,
                                    Environment.CurrentDirectory + "\\" + tc.RedTeam.AvatarPath,
                                    tc.RedTeam.BackgroundPath,
                                    tc.RedTeam.GameBoardPath,
                                    tc.RedTeam.Path.Select(o => new Point(o[0], o[1])).ToList());
                result.Add(red);

                Team green = new Team(tc.GreenTeam.Name, TeamId.Green,
                                    Environment.CurrentDirectory + "\\" + tc.GreenTeam.AvatarPath,
                                    tc.GreenTeam.BackgroundPath,
                                    tc.GreenTeam.GameBoardPath,
                                    tc.GreenTeam.Path.Select(o => new Point(o[0], o[1])).ToList());
                result.Add(green);

                Team yellow = new Team(tc.YellowTeam.Name, TeamId.Yellow,
                                    Environment.CurrentDirectory + "\\" + tc.YellowTeam.AvatarPath,
                                    tc.YellowTeam.BackgroundPath,
                                    tc.YellowTeam.GameBoardPath,
                                    tc.YellowTeam.Path.Select(o => new Point(o[0], o[1])).ToList());
                result.Add(yellow);

                Team blue = new Team(tc.BlueTeam.Name, TeamId.Blue,
                                    Environment.CurrentDirectory + "\\" + tc.BlueTeam.AvatarPath,
                                    tc.BlueTeam.BackgroundPath,
                                    tc.BlueTeam.GameBoardPath,
                                    tc.BlueTeam.Path.Select(o => new Point(o[0], o[1])).ToList());
                result.Add(blue);
            }
            catch (Exception e) { }

            return result;
        }
Esempio n. 2
0
        public void TeamMoveBackward(Team team)
        {
            if (team == null)
                return;

            team.CurrentPositionIndex--;
        }
Esempio n. 3
0
        public void TeamMoveForward(Team team)
        {
            if (team == null)
                return;

            team.CurrentPositionIndex++;
        }