Exemple #1
0
        public void Load()
        {
            return;

            // This code is already dead.

            var files = ModManager.instance.GetFileKeys("events");

            foreach (var file in files)
            {
                Script s = ScriptLoader.instance.LoadKey(file);

                if (TestRemove(file))
                {
                    continue;
                }

                string names = null;
                for (int index = 0; index < s.Root.Children.Count; index++)
                {
                    var child = s.Root.Children[index];
                    if (child is ScriptCommand)
                    {
                        if (child.ToString().Contains("namespace"))
                        {
                            names = (child as ScriptCommand).Value.ToString();
                        }
                        continue;
                    }
                    var sc = (child as ScriptScope);

                    if (TestRemove(sc))
                    {
                        s.Root.Remove(child);
                        continue;
                    }

                    EventParser ee = new EventParser(sc);
                    Events.Add(ee);

                    EventMap[(sc.Find("id") as ScriptCommand).Value.ToString()] = ee;
                    if (names != null)
                    {
                        AddToNamespace(names, ee);
                    }
                }
                Scripts.Add(s);
            }

            foreach (var scriptScope in Events)
            {
                scriptScope.FindLinks();
            }
        }
Exemple #2
0
        public void AddToNamespace(String names, EventParser ev)
        {
            EventNamespace e = null;
            if (!NamespaceMap.ContainsKey(names))
            {
                e = new EventNamespace(names);
                NamespaceMap[names] = e;
            }
            else
            {
                e = NamespaceMap[names];
            }

            e.events.Add(ev);
            e.eventmap[ev.GetProperty("id").Value.ToString().Replace(names + ".", "")] = ev;
        }
Exemple #3
0
        public void AddToNamespace(String names, EventParser ev)
        {
            EventNamespace e = null;

            if (!NamespaceMap.ContainsKey(names))
            {
                e = new EventNamespace(names);
                NamespaceMap[names] = e;
            }
            else
            {
                e = NamespaceMap[names];
            }

            e.events.Add(ev);
            e.eventmap[ev.GetProperty("id").Value.ToString().Replace(names + ".", "")] = ev;
        }
Exemple #4
0
        public void Load()
        {
            var files = Directory.GetFiles(Globals.GameDir + "events");

            foreach (var file in files)
            {
                Script s     = ScriptLoader.instance.Load(file);
                string names = null;
                foreach (var child in s.Root.Children)
                {
                    if (child is ScriptCommand)
                    {
                        if (child.ToString().Contains("namespace"))
                        {
                            names = (child as ScriptCommand).Value.ToString();
                        }
                        continue;
                    }
                    var         sc = (child as ScriptScope);
                    EventParser ee = new EventParser(sc);
                    Events.Add(ee);

                    EventMap[(sc.Find("id") as ScriptCommand).Value.ToString()] = ee;
                    if (names != null)
                    {
                        AddToNamespace(names, ee);
                    }
                }
                Scripts.Add(s);
            }

            foreach (var scriptScope in Events)
            {
                scriptScope.FindLinks();
            }

            var ev = EventMap["TOG.1200"];

            var e = ev;
        }
Exemple #5
0
        public void Load()
        {
            var files = Directory.GetFiles(Globals.GameDir + "events");
            
            foreach (var file in files)
            {
                Script s = ScriptLoader.instance.Load(file);
                string names = null;
                foreach (var child in s.Root.Children)
                {
                    if(child is ScriptCommand)
                    {
                        if (child.ToString().Contains("namespace"))
                        {
                            names = (child as ScriptCommand).Value.ToString();
                        }
                        continue;
                    }
                    var sc = (child as ScriptScope);
                    EventParser ee = new EventParser(sc);
                    Events.Add(ee);

                    EventMap[(sc.Find("id") as ScriptCommand).Value.ToString()] = ee;
                    if(names != null)
                        AddToNamespace(names, ee);
                }
                Scripts.Add(s);
            }

            foreach (var scriptScope in Events)
            {
                scriptScope.FindLinks();
            }

            var ev = EventMap["TOG.1200"];

            var e = ev;


        }