Exemplo n.º 1
0
            // Unserialize MissionRule
            private static void UnserializeMissionRules(XElement elementMissionGrammar)
            {
                List <Mission.MissionGroup> groups = new List <Mission.MissionGroup>();
                XElement elementMissionGraph       = elementMissionGrammar.Element("MissionRules");

                foreach (var elementGroup in elementMissionGraph.Elements("RuleGroup"))
                {
                    Mission.MissionGroup group = new MissionGrammarSystem.MissionGroup();
                    group.Name        = elementGroup.Element("Name").Value;
                    group.Description = elementGroup.Element("Description").Value;
                    group.Rules       = new List <Mission.MissionRule>();
                    foreach (var elementRule in elementGroup.Elements("Rule"))
                    {
                        Mission.MissionRule rule = new Mission.MissionRule();
                        rule.Name             = elementRule.Element("Name").Value;
                        rule.Description      = elementRule.Element("Description").Value;
                        rule.SourceRule       = UnserializeMissionGraph(elementRule.Element("SourceRule"));
                        rule.ReplacementRule  = UnserializeMissionGraph(elementRule.Element("ReplacementRule"));
                        rule.Enable           = bool.Parse(elementRule.Element("Enable").Value);
                        rule.Valid            = bool.Parse(elementRule.Element("Valid").Value);
                        rule.Weight           = int.Parse(elementRule.Element("Weight").Value);
                        rule.QuantityLimitMin = int.Parse(elementRule.Element("QuantityLimitMin").Value);
                        rule.QuantityLimitMax = int.Parse(elementRule.Element("QuantityLimitMax").Value);

                        group.Rules.Add(rule);
                    }
                    groups.Add(group);
                }
                Mission.MissionGrammar.Groups = groups;
            }
Exemplo n.º 2
0
 // Remove the specified mission group.
 public static void RemoveGroup(MissionGroup group)
 {
     _groups.Remove(group);
     return;
 }
Exemplo n.º 3
0
 // Add a mission group from another group.
 public static void AddGroup(MissionGroup group)
 {
     _groups.Add(group);
     return;
 }