Beispiel #1
0
        private void ModelViewerStart_Click(object sender, EventArgs e)
        {
            if (GameRunning)
            {
                if (Root.Instance.CurrentFlow is SpaceWar2006.Flows.Viewer)
                {
                    FileSystemNode n1 = (FileSystemNode)ModelList.SelectedItems[0].Tag;
                    ((SpaceWar2006.Flows.Viewer)Root.Instance.CurrentFlow).ChangeMesh(n1.GetFullPath());
                }
                else
                {
                    MessageBox.Show(this, "Stop the current game first.", "<°)))><", MessageBoxButtons.AbortRetryIgnore);
                }
                return;
            }

            GameRunning = true;

            Root r = Root.Instance;

            r.Authoritive = true;

            ViewerForm vf = new ViewerForm();

            vf.Show();
            r.ClientClient(new string[] { }, vf.glControl1);

            //r.ClientClient(new string[] { });
            IUserInterface ui = r.UserInterface;

            FileSystemNode n = (FileSystemNode)ModelList.SelectedItems[0].Tag;

            SpaceWar2006.Flows.Viewer v = new SpaceWar2006.Flows.Viewer(n.GetFullPath());
            Root.Instance.CurrentFlow = v;
            v.Start();
            r.CurrentFlow = v;



            v.Start();

            r.ClientLoop();

            //Cheetah.Root.Instance.LocalObjects.Remove(h);

            r.ResourceManager.UnloadAll();
            r.UserInterface.Dispose();
            r.UserInterface = null;
            vf.Close();

            GameRunning = false;
        }
Beispiel #2
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());
        }