Beispiel #1
0
 public override void buttonHit(Button button)
 {
     if (button.getName() == "btnJoin")
     {
     }
     else if (button.getName() == "btnHost")
     {
     }
     else if (button.getName() == "btnCancel")
     {
         exit();
         enter();
     }
     else if (button.getName() == "btnOK")
     {
         thisServer = new GameServer();
         thisServer.OnEscapePressed += new Action(Server_OnEscapePressed);
         GameManager.Instance.trayMgr.destroyAllWidgets();
         serverpanel = GameManager.Instance.trayMgr.createParamsPanel(TrayLocation.TL_CENTER, "serverpanel", 400, serverState);
         ServerStartDelegate server = new ServerStartDelegate(ServerStart);
         server.Invoke();
     }
     else if (button.getName() == "btnExit")
     {
         changeAppState(findByName("MainMenu"), modData);
     }
 }
        void buildGUI()
        {
            AdvancedMogreFramework.Singleton.m_pTrayMgr.showFrameStats(TrayLocation.TL_BOTTOMLEFT);
            AdvancedMogreFramework.Singleton.m_pTrayMgr.showLogo(TrayLocation.TL_BOTTOMRIGHT);
            AdvancedMogreFramework.Singleton.m_pTrayMgr.createLabel(TrayLocation.TL_TOP, "GameLbl", "Game mode", 250);
            AdvancedMogreFramework.Singleton.m_pTrayMgr.showCursor();


            // create a params panel for displaying sample details
            StringVector items = new StringVector();

            items.Insert(items.Count, "cam.pX");
            items.Insert(items.Count, "cam.pY");
            items.Insert(items.Count, "cam.pZ");
            items.Insert(items.Count, "");
            items.Insert(items.Count, "cam.oW");
            items.Insert(items.Count, "cam.oX");
            items.Insert(items.Count, "cam.oY");
            items.Insert(items.Count, "cam.oZ");
            items.Insert(items.Count, "");
            items.Insert(items.Count, "Filtering");
            items.Insert(items.Count, "Poly Mode");

            m_pDetailsPanel = AdvancedMogreFramework.Singleton.m_pTrayMgr.createParamsPanel(TrayLocation.TL_NONE, "DetailsPanel", 200, items);
            m_pDetailsPanel.hide();

            m_pDetailsPanel.setParamValue(9, "Bilinear");
            m_pDetailsPanel.setParamValue(10, "Solid");
        }
Beispiel #3
0
 NameValuePairList mInfo = new NameValuePairList();                // custom sample info
 public SinbadState()
 {
     m_bQuit         = false;
     m_pDetailsPanel = null;
     m_pCamera       = null;
     m_pCameraMan    = null;
     m_pChara        = null;
 }
 public SinbadState()
 {
     m_bQuit         = false;
     m_pDetailsPanel = null;
     m_pCamera       = null;
     m_pCameraMan    = null;
     m_pChara        = null;
     agents          = new List <SinbadCharacterController>();
 }
        private bool Setup()
        {
            createLogManager();
            this.mRoot = new Root(PLUGINS_CFG);
            //mOverlaySystem = new Mogre.OverlaySystem();
            setupResources();
            if (!this.Configure())
            {
                return(false);
            }

            this.ChooseSceneManager();
            this.CreateCamera();
            this.CreateViewports();
            createCompositor();

            TextureManager.Singleton.DefaultNumMipmaps = 5;

            this.LoadResources();
            //
            this.mInput = new MoisManager();
            int windowHnd;

            this.mWindow.GetCustomAttribute("WINDOW", out windowHnd);
            this.mInput.Startup(windowHnd, this.mWindow.Width, this.mWindow.Height);
            //System.Windows.Forms.Control form = System.Windows.Forms.Form.FromHandle(new IntPtr(windowHnd));
            //form.MinimumSize = new System.Drawing.Size(800, 600);

            this.mTrayMgr = new SdkTrayManager("trayMgr", this.mWindow, this.mInput.Mouse, this);
            this.mTrayMgr.showFrameStats(TrayLocation.TL_BOTTOMLEFT);
            this.mTrayMgr.hideCursor();
            //this.mTrayMgr.hideFrameStats();
            //this.mTrayMgr.showFrameStats(TrayLocation.TL_BOTTOMLEFT);
            //this.mTrayMgr.showLogo(TrayLocation.TL_BOTTOMLEFT);
            //this.mTrayMgr.showOkDialog("context...", "this is a test");
            //this.mTrayMgr.showLoadingBar();


            this.mPanel = this.mTrayMgr.createParamsPanel(TrayLocation.TL_NONE, "DetailsPanel", 200, new string[] { "cam.pX", "cam.pY", "cam.pZ", "cam.oW", "cam.oX", "cam.oY", "cam.oZ", "Filtering", "Poly Mode" });
            this.mPanel.setParamValue(7, "Bilinear");
            this.mPanel.setParamValue(8, "Solid");
            this.mPanel.hide();
            MaterialManager.Singleton.SetDefaultTextureFiltering(TextureFilterOptions.TFO_NONE);
            //
            this.CreateScene();
            //
            this.mTrayMgr._HookMouseEvent();
            //
            this.AddFrameLstn(new RootLstn(RootLstn.TypeLstn.FrameRendering, this.OnFrameRendering));
            return(true);
        }
Beispiel #6
0
        private void CreateParamsControls(IList <SolverParameter> pars)
        {
            ParamsPanel.SuspendLayout();
            ParamsPanel.Controls.Clear();

            int currentY = 0;

            foreach (var p in pars)
            {
                CreateTrackBarForParam(p, ref currentY);
            }

            ParamsPanel.ResumeLayout();
        }
Beispiel #7
0
        /// <summary>
        ///
        /// </summary>
        protected override void SetupContent()
        {
            // set background and some fog
            Viewport.BackgroundColor = new ColorEx(1.0f, 1.0f, 0.8f);
            SceneManager.SetFog(FogMode.Linear, new ColorEx(1.0f, 1.0f, 1.0f), 0, 15, 100);

            // set shadow properties
            SceneManager.ShadowTechnique    = ShadowTechnique.TextureModulative;
            SceneManager.ShadowColor        = new ColorEx(0.5f, 0.5f, 0.5f);
            SceneManager.ShadowTextureSize  = 1024;
            SceneManager.ShadowTextureCount = 1;

            // disable default camera control so the character can do its own
            CameraManager.setStyle(CameraStyle.Manual);

            // use a small amount of ambient lighting
            SceneManager.AmbientLight = new ColorEx(0.3f, 0.3f, 0.3f);

            // add a bright light above the scene
            Light light = SceneManager.CreateLight("CharacterLight");

            light.Type     = LightType.Point;
            light.Position = new Vector3(-10, 40, 20);
            light.Specular = ColorEx.White;

            MeshManager.Instance.CreatePlane("floor", ResourceGroupManager.DefaultResourceGroupName,
                                             new Plane(Vector3.UnitY, 0), 100, 100, 10, 10, true, 1, 10, 10, Vector3.UnitZ);

            // create a floor entity, give it a material, and place it at the origin
            Entity floor = SceneManager.CreateEntity("Floor", "floor");

            floor.MaterialName = "Examples/Rockwall";
            floor.CastShadows  = false;
            SceneManager.RootSceneNode.AttachObject(floor);


            // create our character controller
            this.chara = new SinbadCharacterController(Camera);

            TrayManager.ToggleAdvancedFrameStats();

            var items = new List <string>();

            items.Add("Help");
            ParamsPanel help = TrayManager.CreateParamsPanel(TrayLocation.TopLeft, "HelpMessage", 100, items);

            help.SetParamValue("Help", " H / F1");
        }
Beispiel #8
0
        public void createScene()
        {
            // set background and some fog
            AdvancedMogreFramework.Singleton.m_pViewport.BackgroundColour = new ColourValue(1.0f, 1.0f, 0.8f);
            m_pSceneMgr.SetFog(FogMode.FOG_LINEAR, new ColourValue(1.0f, 1.0f, 0.8f), 0, 15, 100);

            // set shadow properties
            m_pSceneMgr.ShadowTechnique = ShadowTechnique.SHADOWTYPE_TEXTURE_MODULATIVE;
            m_pSceneMgr.ShadowColour    = new ColourValue(0.5f, 0.5f, 0.5f);
            m_pSceneMgr.SetShadowTextureSize(1024);
            m_pSceneMgr.ShadowTextureCount = 1;

            // disable default camera control so the character can do its own
            m_pCameraMan.setStyle(CameraStyle.CS_MANUAL);
            // use a small amount of ambient lighting
            m_pSceneMgr.AmbientLight = new ColourValue(0.3f, 0.3f, 0.3f);

            // add a bright light above the scene
            Light light = m_pSceneMgr.CreateLight();

            light.Type           = (Light.LightTypes.LT_POINT);
            light.Position       = new Mogre.Vector3(-10, 40, 20);
            light.SpecularColour = ColourValue.White;

            // create a floor mesh resource
            MeshManager.Singleton.CreatePlane("floor", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME,
                                              new Plane(Mogre.Vector3.UNIT_Y, 0), 100, 100, 10, 10, true, 1, 10, 10, Mogre.Vector3.UNIT_Z);

            // create a floor entity, give it a material, and place it at the origin
            Entity floor = m_pSceneMgr.CreateEntity("Floor", "floor");

            floor.SetMaterialName("Examples/Rockwall");
            floor.CastShadows = (false);
            m_pSceneMgr.RootSceneNode.AttachObject(floor);

            // create our character controller
            m_pChara = new SinbadCharacterController(m_pCamera);

            AdvancedMogreFramework.Singleton.m_pTrayMgr.toggleAdvancedFrameStats();

            StringVector items = new StringVector();

            items.Insert(items.Count, "Help");
            ParamsPanel help = AdvancedMogreFramework.Singleton.m_pTrayMgr.createParamsPanel(TrayLocation.TL_TOPLEFT, "HelpMessage", 100, items);

            help.setParamValue("Help", "H / F1");
        }
Beispiel #9
0
 bool mKeyboard_KeyPressed(MOIS.KeyEvent arg)
 {
     if (arg.key == MOIS.KeyCode.KC_ESCAPE)
     {
         if (!this.isEscapeMenuOpened)
         {
             this.BuildEscapeMenu();
         }
         else
         {
             GameManager.Instance.trayMgr.destroyAllWidgets();
             this.serverpanel        = GameManager.Instance.trayMgr.createParamsPanel(TrayLocation.TL_CENTER, "serverpanel", 400f, this.serverState);
             this.isEscapeMenuOpened = false;
         }
     }
     return(true);
 }
        public GameState()
        {
            m_MoveSpeed   = 0.1f;
            m_RotateSpeed = 0.3f;

            m_bLMouseDown   = false;
            m_bRMouseDown   = false;
            m_bQuit         = false;
            m_bSettingsMode = false;

            m_pDetailsPanel = null;

            physx = Physics.Create();
            SceneDesc desc = new SceneDesc();

            desc.Gravity = new Mogre.Vector3(0, -9.8f, 0);
            physxScene   = physx.CreateScene(desc);

            paused = false;
        }
        public void buildGUI()
        {
            AdvancedMogreFramework.Singleton.m_pTrayMgr.showFrameStats(TrayLocation.TL_BOTTOMLEFT);
            AdvancedMogreFramework.Singleton.m_pTrayMgr.showLogo(TrayLocation.TL_BOTTOMRIGHT);
            AdvancedMogreFramework.Singleton.m_pTrayMgr.createLabel(TrayLocation.TL_TOP, "GameLbl", "Game mode", 250);
            AdvancedMogreFramework.Singleton.m_pTrayMgr.showCursor();

            List <string> items = new List <string>();

            items.Insert(items.Count, "cam.pX");
            items.Insert(items.Count, "cam.pY");
            items.Insert(items.Count, "cam.pZ");
            items.Insert(items.Count, "cam.oW");
            items.Insert(items.Count, "cam.oX");
            items.Insert(items.Count, "cam.oY");
            items.Insert(items.Count, "cam.oZ");
            items.Insert(items.Count, "Mode");

            m_pDetailsPanel = AdvancedMogreFramework.Singleton.m_pTrayMgr.createParamsPanel(TrayLocation.TL_TOPLEFT, "DetailsPanel", 200, items.ToArray());
            m_pDetailsPanel.show();

            string infoText = "[TAB] - Switch input mode\n\n[W] - Forward / Mode up\n[S] - Backwards/ Mode down\n[A] - Left\n";

            infoText.Insert(infoText.Length, "[D] - Right\n\nPress [SHIFT] to move faster\n\n[O] - Toggle FPS / logo\n");
            infoText.Insert(infoText.Length, "[Print] - Take screenshot\n\n[ESC] - Exit");
            AdvancedMogreFramework.Singleton.m_pTrayMgr.createTextBox(TrayLocation.TL_RIGHT, "InfoPanel", infoText, 300, 220);

            StringVector chatModes = new StringVector();

            chatModes.Insert(chatModes.Count, "Solid mode");
            chatModes.Insert(chatModes.Count, "Wireframe mode");
            chatModes.Insert(chatModes.Count, "Point mode");
            AdvancedMogreFramework.Singleton.m_pTrayMgr.createLongSelectMenu(TrayLocation.TL_TOPRIGHT, "ChatModeSelMenu", "ChatMode", 200, 3, chatModes);

            AdvancedMogreFramework.Singleton.m_pMouse.MouseMoved     += mouseMoved;
            AdvancedMogreFramework.Singleton.m_pMouse.MousePressed   += mousePressed;
            AdvancedMogreFramework.Singleton.m_pMouse.MouseReleased  += mouseReleased;
            AdvancedMogreFramework.Singleton.m_pKeyboard.KeyPressed  += keyPressed;
            AdvancedMogreFramework.Singleton.m_pKeyboard.KeyReleased += keyReleased;
        }
        private bool Setup() {
            createLogManager();
            this.mRoot = new Root(PLUGINS_CFG);
            //mOverlaySystem = new Mogre.OverlaySystem();
            setupResources();
            if (!this.Configure())
                return false;

            this.ChooseSceneManager();
            this.CreateCamera();
            this.CreateViewports();
            createCompositor();

            TextureManager.Singleton.DefaultNumMipmaps = 5;

            this.LoadResources();

            this.mInput = new MoisManager();
            int windowHnd;
            this.mWindow.GetCustomAttribute("WINDOW", out windowHnd);
            this.mInput.Startup(windowHnd, this.mWindow.Width, this.mWindow.Height);
            //System.Windows.Forms.Control form = System.Windows.Forms.Form.FromHandle(new IntPtr(windowHnd));
            //form.MinimumSize = new System.Drawing.Size(800, 600);

            this.mTrayMgr = new SdkTrayManager("trayMgr", this.mWindow, this.mInput.Mouse, this);
            this.mTrayMgr.showFrameStats(TrayLocation.TL_BOTTOMLEFT);
            this.mTrayMgr.hideCursor();
            //this.mTrayMgr.hideFrameStats();
            //this.mTrayMgr.showFrameStats(TrayLocation.TL_BOTTOMLEFT);
            //this.mTrayMgr.showLogo(TrayLocation.TL_BOTTOMLEFT);
            //this.mTrayMgr.showOkDialog("context...", "this is a test");
            //this.mTrayMgr.showLoadingBar();


            this.mPanel = this.mTrayMgr.createParamsPanel(TrayLocation.TL_NONE, "DetailsPanel", 200, new string[] { "cam.pX", "cam.pY", "cam.pZ", "cam.oW", "cam.oX", "cam.oY", "cam.oZ", "Filtering", "Poly Mode" });
            this.mPanel.setParamValue(7, "Bilinear");
            this.mPanel.setParamValue(8, "Solid");
            this.mPanel.hide();
            MaterialManager.Singleton.SetDefaultTextureFiltering(TextureFilterOptions.TFO_NONE);
            //
            this.CreateScene();
            //
            this.mTrayMgr._HookMouseEvent();
            this.AddFrameLstn(new RootLstn(RootLstn.TypeLstn.FrameRendering, this.OnFrameRendering));
            return true;
        }
        public void createScene()
        {
            // set background and some fog
            AdvancedMogreFramework.Singleton.m_pViewport.BackgroundColour = new ColourValue(1.0f, 1.0f, 0.8f);
            m_pSceneMgr.SetFog(FogMode.FOG_LINEAR, new ColourValue(1.0f, 1.0f, 0.8f), 0, 15, 100);

            // set shadow properties
            m_pSceneMgr.ShadowTechnique = ShadowTechnique.SHADOWTYPE_TEXTURE_MODULATIVE;
            m_pSceneMgr.ShadowColour    = new ColourValue(0.5f, 0.5f, 0.5f);
            m_pSceneMgr.SetShadowTextureSize(1024);
            m_pSceneMgr.ShadowTextureCount = 1;

            // disable default camera control so the character can do its own
            m_pCameraMan.setStyle(CameraStyle.CS_MANUAL);
            // use a small amount of ambient lighting
            m_pSceneMgr.AmbientLight = new ColourValue(0.3f, 0.3f, 0.3f);

            // add a bright light above the scene
            Light light = m_pSceneMgr.CreateLight();

            light.Type           = (Light.LightTypes.LT_POINT);
            light.Position       = new Mogre.Vector3(-10, 40, 20);
            light.SpecularColour = ColourValue.White;

            // create a floor mesh resource
            MeshManager.Singleton.CreatePlane("floor", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME,
                                              new Plane(Mogre.Vector3.UNIT_Y, 0), 100, 100, 10, 10, true, 1, 10, 10, Mogre.Vector3.UNIT_Z);

            // create a floor entity, give it a material, and place it at the origin
            SceneProp floorSceneProp = new SceneProp(
                this,
                m_pSceneMgr,
                m_pSceneMgr.RootSceneNode,
                physicsScene,
                "Floor",
                "floor"
                );

            floorSceneProp.SetMaterialName("Examples/Rockwall");

            //Navmesh
            Navmesh      floorNavMesh = MeshToNavmesh.LoadNavmesh(floorSceneProp.Entity);
            NavmeshQuery query;
            NavmeshPoint retStartPoint;
            NavmeshPoint retEndPoint;

            org.critterai.Vector3 pointStart = new org.critterai.Vector3(0, 0, 0);
            org.critterai.Vector3 pointEnd   = new org.critterai.Vector3(0, 0, 0);
            org.critterai.Vector3 extents    = new org.critterai.Vector3(2, 2, 2);

            NavStatus status = NavmeshQuery.Create(floorNavMesh, 100, out query);

            Console.WriteLine("Status returned when NavmeshQuery was built: " + status);

            NavmeshQueryFilter filter = new NavmeshQueryFilter();

            filter.IncludeFlags = 1;

            status = query.GetNearestPoint(pointStart, extents, filter, out retStartPoint);
            Console.WriteLine("\nStatus of startPoint GetNearestPoint: " + status);
            status = query.GetNearestPoint(pointEnd, extents, filter, out retEndPoint);
            Console.WriteLine("\nStatus of endPoint GetNearestPoint: " + status);

            uint[] path = new uint[100];
            int    pathCount;

            status = query.FindPath(retStartPoint, retEndPoint, filter, path, out pathCount);
            Console.WriteLine("\nStatus of Find path: " + status);

            // create our character controller
            m_pChara = new SinbadCharacterController(this, physicsScene, m_pCamera, new Mogre.Vector3(0, 5, 0), 0);
            SinbadCharacterController bot1 = new SinbadCharacterController(this, physicsScene, m_pCamera, new Mogre.Vector3(-10, 5, 0), 1, false);
            SinbadCharacterController bot2 = new SinbadCharacterController(this, physicsScene, m_pCamera, new Mogre.Vector3(0, 5, -10), 2, false);
            SinbadCharacterController bot3 = new SinbadCharacterController(this, physicsScene, m_pCamera, new Mogre.Vector3(10, 5, 0), 3, false);

            agents.Add(m_pChara);
            agents.Add(bot1);
            agents.Add(bot2);
            agents.Add(bot3);

            AdvancedMogreFramework.Singleton.m_pTrayMgr.toggleAdvancedFrameStats();

            StringVector items = new StringVector();

            items.Insert(items.Count, "Help");
            ParamsPanel help = AdvancedMogreFramework.Singleton.m_pTrayMgr.createParamsPanel(TrayLocation.TL_TOPLEFT, "HelpMessage", 100, items);

            help.setParamValue("Help", "H / F1");
        }