Esempio n. 1
0
        public void Init()
        {
            if (initialized)
            {
                Cheetah.Console.WriteLine("mod already initialized. HACK");
                return;
            }

            Root.Instance.Mod = this;
            initialized       = true;

            System.Console.WriteLine(GameString);

            foreach (DictionaryEntry de in Root.Instance.ResourceManager.SearchFileNode("maps"))
            {
                FileSystemNode n = ((FileSystemNode)de.Value);
                if (n.GetName().EndsWith(".dll"))
                {
                    try
                    {
                        AssemblyResource ar = Root.Instance.ResourceManager.LoadAssembly(n.GetFullPath());
                        Root.Instance.Factory.Add(ar.Assembly);
                        Root.Instance.Assemblies.Add(ar.Assembly);
                        Root.Instance.Script.Reference(ar.Assembly);
                    }
                    catch (BadImageFormatException e1)
                    {
                        Cheetah.Console.WriteLine(e1.Message);
                    }
                    catch (FileLoadException e2)
                    {
                        Cheetah.Console.WriteLine(e2.Message);
                    }
                }
            }

            //Root.Instance.Script.Execute(FileSystem.Get("mods/" + r.Mod + "/scripts/init.boo").getStream());
            //Root.Instance.Script.Execute(Root.Instance.FileSystem.Get("mods/" + Root.Instance.Mod + "/scripts/init.boo").getStream());
            Root.Instance.Script.Execute(Root.Instance.FileSystem.Get("scripts/spacewar2006.boo").getStream());
        }