Пример #1
0
 public static void Init(UIHost host)
 {
     uiHost = host;
     storys = new Dictionary <string, Story>();
     foreach (string dialogXmlFile in ProjectFiles.GetFiles("story"))
     {
         XElement xmlRoot = Tools.LoadXml(Application.dataPath + dialogXmlFile);
         foreach (var storyNode in xmlRoot.Elements("story"))
         {
             Story story = new Story();
             story.Name = Tools.GetXmlAttribute(storyNode, "name");
             //actions
             foreach (var actionNode in storyNode.Elements("action"))
             {
                 story.Actions.Add(Action.Parse(actionNode));
             }
             //results
             foreach (var resultNode in storyNode.Elements("result"))
             {
                 story.Results.Add(Result.Parse(resultNode));
             }
             storys.Add(story.Name, story);
         }
     }
 }
Пример #2
0
        public static void Init(UIHost host)
        {
            uiHost = host;
            tasks.Clear();
            foreach (var taskXmlFile in ProjectFiles.GetFiles("task"))
            {
                XElement xmlRoot = Tools.LoadXml(Application.dataPath + taskXmlFile);
                foreach (var taskNode in xmlRoot.Elements("task"))
                {
                    Task task = new Task();
                    task.key   = Tools.GetXmlAttribute(taskNode, "key");
                    task.desc  = Tools.GetXmlAttribute(taskNode, "desc");
                    task.type  = Tools.GetXmlAttribute(taskNode, "type");
                    task.value = Tools.GetXmlAttribute(taskNode, "value");
                    if (taskNode.Attribute("repeat") != null)
                    {
                        task.repeat = Tools.GetXmlAttribute(taskNode, "repeat") == "once" ? false : true;
                    }
                    else
                    {
                        task.repeat = true;
                    }

                    tasks.Add(task.key, task);
                }
            }
        }
 static public void Init()
 {
     foreach (var resourceXmlFile in ProjectFiles.GetFiles("resources"))
     {
         XElement xmlRoot = Tools.LoadXml(Application.dataPath + resourceXmlFile);
         foreach (XElement t in xmlRoot.Elements())
         {
             ResourceMap.Add(Tools.GetXmlAttribute(t, "key"), Tools.GetXmlAttribute(t, "value"));
         }
     }
 }
Пример #4
0
 public static void Init()
 {
     //角色
     foreach (var roleXmlFile in ProjectFiles.GetFiles("role"))
     {
         XElement xmlRoot = Tools.LoadXml(Application.dataPath + roleXmlFile);
         foreach (XElement node in xmlRoot.Element("roles").Elements("role"))
         {
             Role role = Role.Parse(node);
             Roles[role.Key] = role;
         }
     }
 }
Пример #5
0
 public static void Init()
 {
     Skills.Clear();
     //角色
     foreach (var roleXmlFile in ProjectFiles.GetFiles("skill"))
     {
         XElement xmlRoot = Tools.LoadXml(Application.dataPath + roleXmlFile);
         //Debug.Log("hey");
         foreach (XElement node in xmlRoot.Element("skills").Elements("skill"))
         {
             //Debug.Log("here");
             Skill skill = Skill.Parse(node);
             Skills[skill.key] = skill;
         }
     }
 }
Пример #6
0
        static public void Init()
        {
            foreach (var eventXmlFile in ProjectFiles.GetFiles("map"))
            {
                XElement xmlRoot  = Tools.LoadXml(Application.dataPath + eventXmlFile);
                XElement mapsRoot = Tools.GetXmlElement(xmlRoot, "maps");

                foreach (var map in Tools.GetXmlElements(mapsRoot, "map"))
                {
                    BigMap bigMap = new BigMap();
                    bigMap.Name = Tools.GetXmlAttribute(map, "name");
                    if (map.Attribute("desc") != null)
                    {
                        bigMap.desc = Tools.GetXmlAttribute(map, "desc");
                    }

                    bigMap.Background = Tools.GetImage(ResourceManager.Get(Tools.GetXmlAttribute(map, "pic")));
                    if (map.Element("musics") != null)
                    {
                        foreach (var music in map.Element("musics").Elements("music"))
                        {
                            bigMap.Musics.Add(Tools.GetXmlAttribute(music, "name"));
                        }
                    }
                    foreach (XElement t in map.Elements("maprole"))
                    {
                        string  roleKey = Tools.GetXmlAttribute(t, "roleKey");
                        MapRole mapRole = new MapRole();
                        mapRole.roleKey = roleKey;
                        if (t.Attribute("pic") != null)
                        {
                            mapRole.pic = Tools.GetXmlAttribute(t, "pic");
                        }
                        else
                        {
                            mapRole.pic = null;
                        }
                        if (t.Attribute("description") != null)
                        {
                            mapRole.description = Tools.GetXmlAttribute(t, "description");
                        }
                        if (t.Attribute("hide") != null)
                        {
                            if (Tools.GetXmlAttributeInt(t, "hide") == 0)
                            {
                                mapRole.hide = false;
                            }
                        }
                        bigMap.roleList.Add(mapRole);

                        List <Event> events = new List <Event>();
                        events.Clear();
                        foreach (XElement eventX in t.Elements("event"))
                        {
                            events.Add(Event.Parse(eventX));
                        }

                        bigMap.eventsList.Add(roleKey, events);
                    }
                    bigMaps.Add(bigMap);
                }
            }
        }