public void Begin() { guiModule = new GuiModule(Main.GraphicsDevice, Main.Input); inputModule = new InputModule(Main.Input); simulation = new Simulation(Main.Content, new MISP.GenericScriptObject( "episode-name", "main-menu", "server", null)); simulation.debugOutput += (s) => { Main.Write(s); }; simulation.Content.FrontLoadTextures(); Main.Write("Started menu simulation\n"); Main.ScriptEngine.PrepareEnvironment(simulation.scriptEngine); Main.ScriptEngine.AddEnvironment("menu", simulation.scriptEngine, simulation.scriptContext); renderModule = new RenderModule(Main.GraphicsDevice, simulation.Content); simulation.modules.Add(renderModule); octTreeModule = new OctTreeModule(new BoundingBox(new Vector3(-100, -100, -100), new Vector3(100, 100, 100)), 5.0f); simulation.modules.Add(octTreeModule); simulation.modules.Add(inputModule); simulation.modules.Add(guiModule); simulation.beginSimulation(); //var labelString = "Jemgine"; //var label = new UIItem(Layout.CenterItem(new Rectangle(0, 0, 10 * labelString.Length, 16), // Main.GraphicsDevice.Viewport.Bounds)); //label.settings = new MISP.GenericScriptObject( // "bg-color", new Vector3(0, 0, 0), // "text-color", new Vector3(1,1,1), // "label", labelString); //guiModule.uiRoot.AddChild(label); }
public void Begin() { simulation = new Simulation(Main.Content, new MISP.GenericScriptObject("episode-name", episodeName, "server", true)); Main.Write("Started server simulation with episode " + episodeName + "\n"); simulation.modules.Add(serverModule); simulation.beginSimulation(); clientGame = new ClientGame(System.Net.IPAddress.Loopback, port); clientGame.Input = Input; clientGame.Main = Main; clientGame.Begin(); Main.ScriptEngine.PrepareEnvironment(simulation.scriptEngine); Main.ScriptEngine.AddEnvironment("server", simulation.scriptEngine, simulation.scriptContext); }
internal void StartSimulation(String episodeName, uint version) { //System.Threading.Thread.Sleep(10000); if (simulation != null) throw new InvalidProgramException(); simulation = new Simulation(Main.Content, new MISP.GenericScriptObject( "episode-name", episodeName, "server", null)); simulation.Content.FrontLoadTextures(); Main.Write("Started client simulation with episode " + episodeName + "\n"); Main.ScriptEngine.PrepareEnvironment(simulation.scriptEngine); Main.ScriptEngine.AddEnvironment("client", simulation.scriptEngine, simulation.scriptContext); //simulation.scriptEngine.AddGlobalVariable("ui", (context) => { return uiRoot; }); //uiRoot.children.Clear(); renderModule = new RenderModule(Main.GraphicsDevice, simulation.Content); simulation.modules.Add(renderModule); octTreeModule = new OctTreeModule(new BoundingBox(new Vector3(-100, -100, -100), new Vector3(100, 100, 100)), 5.0f); simulation.modules.Add(octTreeModule); simulation.modules.Add(clientModule); simulation.modules.Add(inputModule); simulation.modules.Add(guiModule); simulation.beginSimulation(); mouseLabel = new UIItem(new Rectangle(0, 0, 128, 64)); mouseLabel.settings = new MISP.GenericScriptObject("bg-color", new Vector3(1, 1, 1)); //guiModule.uiRoot.AddChild(mouseLabel); }