コード例 #1
0
ファイル: Activity.cs プロジェクト: du-phan/ProjetGenieLog2
 public Activity(ActType myType, Day day, TimeSlot timeSlot, Location location, List<Astronaut> astrList, String Desc)
 {
     this.myType = myType;
     this.day = day;
     this.timeSlot = timeSlot;
     this.location = location;
     this.astrList = astrList;
     this.Desc = Desc;
 }
コード例 #2
0
ファイル: Mission.cs プロジェクト: du-phan/ProjetGenieLog2
 public Day checkDayList(Day d)
 {
     foreach (Day day in dayList)
     {
         if (day.getnDay() == d.getnDay())
         {
             return day;
         }
     }
     return null;
 }
コード例 #3
0
        public static void importPlan(XDocument doc, List<ActType> actTypeList, Mission mission)
        {
            foreach (XElement activity in doc.Descendants("Activity"))
            {
                int idType = Int32.Parse(activity.Parent.Parent.Attribute("ID").Value);
                ActType actType = actTypeList[idType - 1];

                int d = Int32.Parse(activity.Element("Day").Element("nDay").Value);
                Day day = new Day(d);
                Day checkDay = mission.checkDayList(day);
                if (checkDay == null)
                {
                    mission.addDay(day);
                }
                else
                {
                    day = checkDay;
                }

                int timeslotBegin = Int32.Parse(activity.Element("timeSlot").Element("start").Value);
                int timeslotEnd = Int32.Parse(activity.Element("timeSlot").Element("end").Value);
                TimeSlot timeSlot = new TimeSlot(timeslotBegin, timeslotEnd);

                string locName = activity.Element("Location").Element("Name").Value;
                int x = Int32.Parse(activity.Descendants("X").FirstOrDefault().Value);
                int y = Int32.Parse(activity.Descendants("Y").FirstOrDefault().Value);
                Location location = new Location(locName, new Position(x, y));
                Location checkLocation = mission.checkLocationList(location);
                if (checkLocation == null)
                {
                    mission.addLocation(location);
                }
                else
                {
                    location = checkLocation;
                }

                List<Astronaut> astrList = new List<Astronaut>();
                foreach (XElement astronaut in activity.Descendants("Astronaut"))
                {
                    string astroName = astronaut.Element("Name").Value;
                    Astronaut member = new Astronaut(astroName);
                    Astronaut checkMember = mission.checkAstronaut(member);
                    if (checkMember == null)
                    {
                        mission.addAstronaut(member);
                    }
                    else
                    {
                        member = checkMember;
                    }
                    astrList.Add(member);
                }

                string Desc = activity.Element("Desc").Value;

                Activity act = new Activity(actType, day, timeSlot, location, astrList, Desc);
                act.update();

            }
        }
コード例 #4
0
ファイル: Mission.cs プロジェクト: du-phan/ProjetGenieLog2
 public void addDay(Day day)
 {
     this.dayList.Add(day);
 }
コード例 #5
0
ファイル: Activity.cs プロジェクト: du-phan/ProjetGenieLog2
 public void setDay(Day day)
 {
     if (this.day.getnDay() > DateTimeExtension.marsToday)
     {
         this.day = day;
     }
 }