Exemplo n.º 1
0
        public ObjectiveList(string fileName, EditObjectivePanel_Delegate ed)
        {
            AutoScroll  = true;
            RowCount    = 0;
            Dock        = DockStyle.Fill;
            ColumnCount = 3;
            ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 10f));
            ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 80f));
            ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 10f));

            _savePoint        = fileName;
            _filterType       = Objective.ObjectiveType.ALL;
            _sortType         = SortType.DEFAULT;
            _aToz             = true;
            _prioritySortType = Objective.Priority.ALL;

            _objectives = FileManager.DeserializeData(_savePoint).Select(d => new ObjectiveViewPanel(d, ed, () => DeleteObjective(d))).ToList();
            _objectives.RemoveAll(p => !p.Displayed.Persist && p.Displayed.DueBy < DateTime.Now);
            _objectives.ForEach(o => {
                if (o.Displayed.Repeat)
                {
                    while (o.Displayed.DueBy < DateTime.Now)
                    {
                        o.Displayed.DueBy += TimeSpan.FromDays(1);
                    }
                }
            });

            _editDelegate = ed;
            UpdateShownObjectives();
        }
Exemplo n.º 2
0
        public static string ConvertType(Objective.ObjectiveType type)
        {
            switch (type)
            {
            case Objective.ObjectiveType.HOMEWORK:
                return("Homework");

            case Objective.ObjectiveType.PROJECT_IDEA:
                return("Project");

            case Objective.ObjectiveType.CLUB:
                return("Club");

            case Objective.ObjectiveType.PERSONAL:
                return("Personal");

            case Objective.ObjectiveType.FREE_TIME:
                return("Free Time");

            case Objective.ObjectiveType.JOB:
                return("Job");

            case Objective.ObjectiveType.NOTE:
                return("Note");

            case Objective.ObjectiveType.REMINDER:
                return("Reminder");

            case Objective.ObjectiveType.OTHER:
                return("Other");

            case Objective.ObjectiveType.ALL:
            default:
                return("???");
            }
        }
Exemplo n.º 3
0
 public void SetFilterTo(Objective.ObjectiveType type)
 {
     _filterType = type;
     UpdateShownObjectives();
 }
Exemplo n.º 4
0
        public void LoadScenario(String level, String scenarioFile)
        {
            //string path = "AssetData/Models/";

            string sceData = "AssetData/Levels/" + level + "/Scenario/" + scenarioFile + ".sce";

            List <string> tex = new List <string>();
            string        mdlName;

            if (File.Exists(sceData))
            {
                XDocument file;
                string    xmlText = File.ReadAllText(sceData);
                file = XDocument.Parse(xmlText);

                //Console.WriteLine(xmlText);

                string scenarioName = file.Root.Attribute("name").Value;

                foreach (XElement e in file.Descendants("objective"))
                {
                    Objective objective = new Objective();

                    Objective.ObjectiveType objectiveType = (Objective.ObjectiveType)Enum.Parse(typeof(Objective.ObjectiveType), e.Attribute("type").Value);

                    string str = e.Attribute("string").Value;

                    Console.WriteLine(objectiveType.ToString());

                    if (objectiveType == Objective.ObjectiveType.Elimination)
                    {
                        foreach (XElement t in e.Descendants("target"))
                        {
                            float x = Int32.Parse(t.Attribute("x").Value);
                            float y = Int32.Parse(t.Attribute("y").Value);
                            float z = Int32.Parse(t.Attribute("z").Value);

                            Type targetType = Type.GetType(t.Attribute("type").Value);

                            objective.SetObjective(str, targetType, x, y, z);
                        }

                        foreach (XElement t in e.Descendants("enemyspawn"))
                        {
                            float x = float.Parse(t.Attribute("x").Value);
                            float y = float.Parse(t.Attribute("y").Value);

                            int amount = Int32.Parse(t.Attribute("amount").Value);

                            //Type targetType = Type.GetType(t.Attribute("type").Value);

                            objective.CreateEnemySpawner(typeof(CPlayerBullet), amount, x, y);
                        }
                    }
                    else if (objectiveType == Objective.ObjectiveType.Reach)
                    {
                        foreach (XElement t in e.Descendants("checkpoint"))
                        {
                            float x = Int32.Parse(t.Attribute("x").Value);
                            float y = Int32.Parse(t.Attribute("y").Value);

                            objective.SetObjective(str, x, y);
                        }

                        foreach (XElement t in e.Descendants("enemyspawn"))
                        {
                            float x = float.Parse(t.Attribute("x").Value);
                            float y = float.Parse(t.Attribute("y").Value);

                            int amount = Int32.Parse(t.Attribute("amount").Value);

                            //Type targetType = Type.GetType(t.Attribute("type").Value);

                            objective.CreateEnemySpawner(typeof(CPlayerBullet), amount, x, y);
                        }
                    }
                    else if (objectiveType == Objective.ObjectiveType.Survival)
                    {
                        foreach (XElement t in e.Descendants("timer"))
                        {
                            int time = Int32.Parse(t.Attribute("time").Value);

                            objective.SetObjective(str, time);
                        }

                        foreach (XElement t in e.Descendants("enemyspawn"))
                        {
                            float x = float.Parse(t.Attribute("x").Value);
                            float y = float.Parse(t.Attribute("y").Value);

                            int amount = Int32.Parse(t.Attribute("amount").Value);

                            //Type targetType = Type.GetType(t.Attribute("type").Value);

                            objective.CreateEnemySpawner(typeof(CPlayerBullet), amount, x, y);
                        }
                    }
                    else if (objectiveType == Objective.ObjectiveType.Event)
                    {
                        foreach (XElement t in e.Descendants("bubble"))
                        {
                            List <string> dialog    = new List <string>();
                            List <string> subtitles = new List <string>();

                            foreach (XElement l in t.Descendants("line"))
                            {
                                dialog.Add(l.Attribute("soundbyte").Value);
                                subtitles.Add(l.Value);
                            }

                            objective.SetObjective(str, dialog, subtitles);
                        }
                    }

                    pObjectiveList.Add(objective);
                }

                foreach (XElement e in file.Descendants("model"))
                {
                    mdlName = e.Attribute("name").Value;
                    string type = e.Attribute("filetype").Value;
                }

                foreach (XElement e in file.Descendants("animation"))
                {
                    string name = e.Attribute("name").Value;

                    tex.Add(name);

                    Console.WriteLine("texture " + name);
                }
            }
            else
            {
                CConsole.Instance.Print("Scenario data for " + sceData + " wasn't found!");
            }
        }