Esempio n. 1
0
        public static void onActivateBasicLM()
        {
            Torque3D.PostEffect HDRPostFx = Sim.FindObjectByName <Torque3D.PostEffect>("HDRPostFx");
            // If HDR is enabled... enable the special format token.
            if (!Globals.GetString("platform").Equals("macos") && HDRPostFx.isEnabled())
            {
                Core.RenderManager.AL_FormatToken.enable();
            }

            // Create render pass for projected shadow.
            BL_ProjectedShadowRPM = new RenderPassManager("BL_ProjectedShadowRPM");
            BL_ProjectedShadowRPM.registerObject();

            // Create the mesh bin and add it to the manager.
            RenderMeshMgr meshBin = new RenderMeshMgr();

            meshBin.registerObject();
            BL_ProjectedShadowRPM.addManager(meshBin);

            SimGroup RootGroup = Sim.FindObjectByName <SimGroup>("RootGroup");

            // Add both to the root group so that it doesn't
            // end up in the MissionCleanup instant group.
            RootGroup.add(BL_ProjectedShadowRPM);
            RootGroup.add(meshBin);
        }
Esempio n. 2
0
        /// Pauses the playback of active sound sources.
        ///
        /// @param %channels    An optional word list of channel indices or an empty
        /// string to pause sources on all channels.
        /// @param %pauseSet    An optional SimSet which is filled with the paused
        /// sources.  If not specified the global SFXPausedSet
        /// is used.
        ///
        /// @deprecated
        public static void sfxPause(List <int> channels = null, SimSet pauseSet = null)
        {
            // Did we get a set to populate?
            if (pauseSet == null)
            {
                pauseSet = SFXPausedSet;
            }

            SimSet SFXSourceSet = Sim.FindObjectByName <SimSet>("SFXSourceSet");

            int count = SFXSourceSet.getCount();

            for (uint i = 0; i < count; i++)
            {
                SFXSource source = SFXSourceSet.getObject(i).As <SFXSource>();

                int channel = sfxGroupToOldChannel(source.getGroup());
                if (channels != null && !channels.Contains(channel))
                {
                    continue;
                }

                source.pause();
                pauseSet.add(source);
            }
        }
Esempio n. 3
0
 public static void RefreshCenterTextCtrl()
 {
     if (Global.IsObject("CenterPrintText"))
     {
         Sim.FindObjectByName <GuiTextCtrl>("CenterPrintText").Position = new Point2I(0, 0);
     }
 }
Esempio n. 4
0
        public static bool IsMethod(string className, string methodName)
        {
            if (className == null)
            {
                return(FunctionDictionary.ContainsKey(methodName));
            }

            SimObject obj = Sim.FindObjectByName <SimObject>(className);

            if (obj == null)
            {
                if (!ClassTypeDictionary.ContainsKey(className))
                {
                    return(false);
                }

                MethodInfo method = ClassTypeDictionary[className]
                                    .GetMethod(methodName, bindingFlags);
                return(method != null && method.DeclaringType.GetCustomAttributes <ConsoleClassAttribute>().Any());
            }

            Type type = GetObjectType(obj.GetClassName(), obj.GetClassNamespace(), obj);

            return(type != null &&
                   type.GetMethod(methodName, bindingFlags) !=
                   null);
        }
Esempio n. 5
0
        public static string CallScriptFunction(string pFunctionNamespace, string pFunctionName, object[] args,
                                                out bool found)
        {
            if (pFunctionNamespace != null)
            {
                ISimObject obj  = Sim.FindObjectByName <UnknownSimObject>(pFunctionNamespace);
                Type       type = GetObjectType(null, pFunctionNamespace, obj);

                if (type == null)
                {
                    found = false;
                    return(null);
                }

                return(CallNamespaceMethod(type, obj, pFunctionName, args, out found));
            }

            if (!FunctionDictionary.ContainsKey(pFunctionName))
            {
                found = false;
                return(null);
            }

            found = true;
            MethodInfo methodInfo = FunctionDictionary[pFunctionName];

            return(InvokeMethod(methodInfo, null, args, out found));
        }
Esempio n. 6
0
        public override void OnWake()
        {
            // Turn off any shell sounds...
            // sfxStop( ... );

            Global.SetConsoleBool("enableDirectInput", true);
            Global.ActivateDirectInput();

            // Message hud dialog
            if (Global.IsObject("MainChatHud"))
            {
                Core.SimObjects.UI.Canvas.PushDialog("MainChatHud");
            }

            // just update the action map here
            Sim.FindObjectByName <ActionMap>("moveMap").Push();

            // hack city - these controls are floating around and need to be clamped
            if (Global.IsFunction("refreshCenterTextCtrl"))
            {
                Global.Schedule("0", "0", "refreshCenterTextCtrl");
            }
            if (Global.IsFunction("refreshBottomTextCtrl"))
            {
                Global.Schedule("0", "0", "refreshBottomTextCtrl");
            }
        }
        //-----------------------------------------------------------------------------
        // Called when all datablocks have been transmitted.
        public void onEnterGame()
        {
            //TODO should this be pClient
            //GameConnection client = Sim.FindObject<GameConnection>(pClient);

            // Create a camera for the client.
            Camera theCamera = new Camera("TheCamera")
            {
                DataBlock = Sim.FindObjectByName <CameraData>("Observer")
            };

            theCamera.registerObject();
            theCamera.setTransform(new TransformF(new Point3F(0, 0, 2), new AngAxisF(1, 0, 0, 0)));

            // Cameras are not ghosted (sent across the network) by default; we need to
            // do it manually for the client that owns the camera or things will go south
            // quickly.
            theCamera.scopeToClient(this);
            // And let the client control the camera.
            setControlObject(theCamera);
            // Add the camera to the group of game objects so that it's cleaned up when
            // we close the game.
            SimGroup gameGroup = Sim.FindObject <SimGroup>("GameGroup");

            gameGroup.add(theCamera);
            // Activate HUD which allows us to see the game. This should technically be
            // a commandToClient, but since the client and server are on the same
            // machine...
            GuiCanvas canvas = Sim.FindObject <GuiCanvas>("Canvas");

            canvas.setContent(Sim.FindObject <GuiTSCtrl>("PlayGui"));
            Global.activateDirectInput();
        }
Esempio n. 8
0
        public static void Init()
        {
            Core.Console.Profiles.Init();
            Core.Console.Console.Init();
            ActionMap globalActionMap = Sim.FindObjectByName <ActionMap>("GlobalActionMap");

            globalActionMap.bindCmd("keyboard", "tilde", "toggleConsole(true);");
        }
Esempio n. 9
0
        public override void OnSleep()
        {
            if (Global.IsObject("MainChatHud"))
            {
                Core.SimObjects.UI.Canvas.PopDialog(Sim.FindObjectByName <GuiControl>("MainChatHud"));
            }

            // pop the keymaps
            Sim.FindObjectByName <ActionMap>("moveMap").Pop();
        }
Esempio n. 10
0
        public static void hideCursor()
        {
            if (Globals.GetBool("cursorControlled"))
            {
                Global.lockMouse(true);
            }
            GuiCanvas canvas = Sim.FindObjectByName <GuiCanvas>("Canvas");

            canvas.cursorOff();
        }
        // Called when all datablocks from above have been transmitted.
        public void onDataBlocksDone(string sequence)
        {
            //closeSplashWindow();
            GuiCanvas canvas = Sim.FindObjectByName <GuiCanvas>("Canvas");

            canvas.showWindow();

            // Start sending ghosts to the client.
            activateGhosting();
            onEnterGame();
        }
Esempio n. 12
0
 public ConsoleDlg()
 {
     Name        = "ConsoleDlg";
     Profile     = Sim.FindObjectByName <GuiControlProfile>("GuiDefaultProfile");
     HorizSizing = GuiHorizontalSizing.Right;
     VertSizing  = GuiVerticalSizing.Bottom;
     Position    = new Point2I(0, 0);
     Extent      = new Point2I(640, 480);
     MinExtent   = new Point2I(8, 8);
     Visible     = true;
 }
Esempio n. 13
0
        public void ClearHud()
        {
            if (Global.IsObject("MainChatHud"))
            {
                Core.SimObjects.UI.Canvas.PopDialog(Sim.FindObjectByName <GuiControl>("MainChatHud"));
            }

            while (GetCount() > 0)
            {
                GetObject(0).Delete();
            }
        }
Esempio n. 14
0
 public ConsoleEntry()
 {
     Name        = "ConsoleEntry";
     Profile     = Sim.FindObjectByName <GuiControlProfile>("ConsoleTextEditProfile");
     HorizSizing = GuiHorizontalSizing.Width;
     VertSizing  = GuiVerticalSizing.Top;
     Position    = new Point2I(0, 462);
     Extent      = new Point2I(640, 18);
     MinExtent   = new Point2I(8, 8);
     Visible     = true;
     AltCommand  = "ConsoleEntry::eval();";
     //TODO HelpTag = "0";
     MaxLength          = 255;
     HistorySize        = 40;
     Password           = false;
     TabComplete        = false;
     SinkAllKeyEvents   = true;
     UseSiblingScroller = true;
 }
Esempio n. 15
0
        public static void onStart()
        {
            // Create objects!
            SimGroup gameGroup = new SimGroup("GameGroup");

            gameGroup.Name = "GameGroup";
            gameGroup.registerObject();

            LevelInfo levelInfo = new LevelInfo("TheLevelInfo")
            {
                CanvasClearColor = new ColorI(0, 0, 0, 0)
            };

            levelInfo.registerObject();

            GroundPlane groundPlane = new GroundPlane("TheGround")
            {
                Position = Point3F.Zero,
                Material = "BlankWhite"
            };

            groundPlane.registerObject();

            Sun sun = new Sun("TheSun")
            {
                Azimuth     = 230,
                Elevation   = 45,
                Color       = ColorF.WHITE,
                Ambient     = new ColorF(0.1f, 0.1f, 0.1f, 1),
                CastShadows = true
            };

            sun.registerObject();

            gameGroup.add(levelInfo, groundPlane, sun);

            // Allow us to exit the game...
            ActionMap globalActionMap = Sim.FindObjectByName <ActionMap>("GlobalActionMap");

            globalActionMap.bindCmd("keyboard", "escape", "quit");
        }
Esempio n. 16
0
        public static void Init()
        {
            ConsoleDlg = new ConsoleDlg();

            GuiConsoleEditCtrl ConsoleEntry = new ConsoleEntry();

            ConsoleEntry.registerObject();
            ConsoleDlg.add(ConsoleEntry);

            GuiScrollCtrl scrollCtrl = new GuiScrollCtrl
            {
                InternalName = "Scroll",
                Profile      = Sim.FindObjectByName <GuiControlProfile>("ConsoleScrollProfile"),
                HorizSizing  = GuiHorizontalSizing.Width,
                VertSizing   = GuiVerticalSizing.Height,
                Position     = Point2I.Zero,
                Extent       = new Point2I(640, 462),
                MinExtent    = new Point2I(8, 8),
                Visible      = true,
                //TODO HelpTag = "0",
                WillFirstRespond    = true,
                HScrollBar          = GuiScrollBarBehavior.AlwaysOn,
                VScrollBar          = GuiScrollBarBehavior.AlwaysOn,
                LockHorizScroll     = false,
                LockVertScroll      = false,
                ConstantThumbHeight = false,
                ChildMargin         = new Point2I(0, 0)
            };
            GuiConsole ConsoleMessageLogView = new GuiConsole("ConsoleMessageLogView")
            {
                Profile  = Sim.FindObjectByName <GuiControlProfile>("GuiConsoleProfile"),
                Position = Point2I.Zero
            };

            ConsoleMessageLogView.registerObject();
            scrollCtrl.add(ConsoleMessageLogView);
            scrollCtrl.registerObject();
            ConsoleDlg.add(scrollCtrl);
            ConsoleDlg.registerObject();
        }
Esempio n. 17
0
        public SceneObject PickCameraSpawnPoint(string spawnGroups)
        {
            SimObject spawnPoint = spawnGroups.Split(' ')
                                   .ToList()
                                   .Select((group) => Sim.FindObjectByName <SimSet>(group)?.GetRandom())
                                   .ToList()
                                   .Find((x) => x != null && Global.IsObject(x.GetId().ToString()));

            if (spawnPoint != null)
            {
                return(spawnPoint.As <SceneObject>());
            }

            // Didn't find a spawn point by looking for the groups
            // so let's return the "default" SpawnSphere
            // First create it if it doesn't already exist
            SpawnSphere spawn;

            if (!Global.IsObject("DefaultCameraSpawnSphere"))
            {
                spawn = new SpawnSphere("DefaultCameraSpawnSphere")
                {
                    DataBlock      = Sim.FindObjectByName <GameBaseData>("SpawnSphereMarker"),
                    SpawnClass     = Global.GetConsoleString("Game::DefaultCameraClass"),
                    SpawnDatablock = Global.GetConsoleString("Game::DefaultCameraDataBlock"),
                };
                spawn.RegisterObject();

                // Add it to the MissionCleanup group so that it
                // doesn't get saved to the Mission (and gets cleaned
                // up of course)
                Core.SimObjects.Collections.MissionCleanup.Add(spawn);
            }
            else
            {
                spawn = Sim.FindObjectByName <SpawnSphere>("DefaultCameraSpawnSphere");
            }

            return(spawn);
        }
Esempio n. 18
0
        public static void configureCanvas()
        {
            // Setup a good default if we don't have one already.
            if (string.IsNullOrWhiteSpace(Globals.GetString("pref::Video::Resolution")))
            {
                Globals.SetString("pref::Video::Resolution", "800 600");
            }
            if (string.IsNullOrWhiteSpace(Globals.GetString("pref::Video::FullScreen")))
            {
                Globals.SetBool("pref::Video::FullScreen", false);
            }
            if (string.IsNullOrWhiteSpace(Globals.GetString("pref::Video::BitDepth")))
            {
                Globals.SetInt("pref::Video::BitDepth", 32);
            }
            if (string.IsNullOrWhiteSpace(Globals.GetString("pref::Video::RefreshRate")))
            {
                Globals.SetInt("pref::Video::RefreshRate", 60);
            }
            if (string.IsNullOrWhiteSpace(Globals.GetString("pref::Video::AA")))
            {
                Globals.SetInt("pref::Video::AA", 4);
            }

            string[] res  = Globals.GetString("pref::Video::Resolution").Split(' ');
            uint     resX = uint.Parse(res[0]);
            uint     resY = uint.Parse(res[1]);
            bool     fs   = Globals.GetBool("pref::Video::FullScreen");
            string   _bpp = Globals.GetString("pref::Video::BitDepth");
            uint     bpp;

            uint.TryParse(_bpp, out bpp);
            int rate = Globals.GetInt("pref::Video::RefreshRate");
            int aa   = Globals.GetInt("pref::Video::AA");

            if (!string.IsNullOrEmpty("cliFullscreen"))
            {
                fs = Globals.GetBool("cliFullscreen");
                Globals.SetString("cliFullscreen", "");
            }


            Global.echo("--------------");
            Global.echo($"Attempting to set resolution to \"{resX} {resY} {fs} {bpp} {rate} {aa}\"");

            Point3F deskRes = Global.getDesktopResolution();

            // We shouldn't be getting this any more but just in case...
            if (_bpp == "Default")
            {
                bpp = (uint)deskRes.Z;
            }

            GuiCanvas canvas = Sim.FindObjectByName <GuiCanvas>("Canvas");

            // Make sure we are running at a valid resolution
            if (!fs)
            {
                // Windowed mode has to use the same bit depth as the desktop
                bpp = (uint)deskRes.Z;

                // Windowed mode also has to run at a smaller resolution than the desktop
                if ((resX >= deskRes.X) || (resY >= deskRes.Y))
                {
                    Global.warn(
                        "Warning: The requested windowed resolution is equal to or larger than the current desktop resolution. Attempting to find a better resolution");

                    int resCount = canvas.getModeCount();
                    for (int i = (resCount - 1); i >= 0; i--)
                    {
                        string   testRes      = canvas.getMode(i);
                        string[] testResSplit = testRes.Split(' ');
                        uint     testResX     = uint.Parse(testResSplit[0]);
                        uint     testResY     = uint.Parse(testResSplit[1]);
                        uint     testBPP      = uint.Parse(testResSplit[2]);

                        if (testBPP != bpp)
                        {
                            continue;
                        }

                        if ((testResX < deskRes.X) && (testResY < deskRes.Y))
                        {
                            // This will work as our new resolution
                            resX = testResX;
                            resY = testResY;

                            Global.warn($"Warning: Switching to \"{resX} {resY} {bpp}\"");

                            break;
                        }
                    }
                }
            }

            Globals.SetString("pref::Video::Resolution", resX + " " + resY);
            Globals.SetBool("pref::Video::FullScreen", fs);
            Globals.SetInt("pref::Video::BitDepth", (int)bpp);
            Globals.SetInt("pref::Video::RefreshRate", rate);
            Globals.SetInt("pref::Video::AA", aa);

            string fsLabel = "No";

            if (fs)
            {
                fsLabel = "Yes";
            }

            Global.echo("Accepted Mode: \n" +
                        $"--Resolution : {resX} {resY}\n" +
                        $"--Full Screen : {fsLabel} \n" +
                        $"--Bits Per Pixel : {bpp} \n" +
                        $"--Refresh Rate : {rate} \n" +
                        $"--FSAA Level : {aa} \n" +
                        "--------------");

            // Actually set the new video mode
            canvas.setVideoMode(resX, resY, fs, bpp, (uint)rate, (uint)aa);

            /*todo Global.commandToServer(Global.addTaggedString("setClientAspectRatio"), resX, resY);*/

            // FXAA piggybacks on the FSAA setting in $pref::Video::mode.
            if (Global.isObject("FXAA_PostEffect"))
            {
                Torque3D.PostEffect FXAA_PostEffect = Sim.FindObjectByName <Torque3D.PostEffect>("FXAA_PostEffect");
                FXAA_PostEffect.IsEnabled = (aa > 0);
            }
        }
Esempio n. 19
0
 public void popDialog(string ctrl)
 {
     base.popDialog(Sim.FindObjectByName <GuiControl>(ctrl));
     checkCursor();
 }
Esempio n. 20
0
        public static void Init()
        {
            if (Global.IsObject("moveMap"))
            {
                ActionMap oldMoveMap = Sim.FindObjectByName <ActionMap>("moveMap");
                oldMoveMap.Delete();
            }

            ActionMap moveMap = new ActionMap("moveMap");

            moveMap.RegisterObject();

            ActionMap globalActionMap = Sim.FindObjectByName <ActionMap>("GlobalActionMap");

            //------------------------------------------------------------------------------
            // Non-remapable binds
            //------------------------------------------------------------------------------
            moveMap.Bind("keyboard", "F2", "showPlayerList");

            moveMap.Bind("keyboard", "ctrl h", "hideHUDs");

            moveMap.Bind("keyboard", "alt p", "doScreenShotHudless");

            moveMap.BindCmd("keyboard", "escape", "", "Canvas.pushDialog(PauseMenu);");

            //------------------------------------------------------------------------------
            // Movement Keys
            //------------------------------------------------------------------------------
            moveMap.Bind("keyboard", "a", "moveleft");
            moveMap.Bind("keyboard", "d", "moveright");
            moveMap.Bind("keyboard", "left", "moveleft");
            moveMap.Bind("keyboard", "right", "moveright");

            moveMap.Bind("keyboard", "w", "moveforward");
            moveMap.Bind("keyboard", "s", "movebackward");
            moveMap.Bind("keyboard", "up", "moveforward");
            moveMap.Bind("keyboard", "down", "movebackward");

            moveMap.Bind("keyboard", "e", "moveup");
            moveMap.Bind("keyboard", "c", "movedown");

            moveMap.Bind("keyboard", "space", "jump");
            moveMap.Bind("mouse", "xaxis", "yaw");
            moveMap.Bind("mouse", "yaxis", "pitch");

            moveMap.Bind("gamepad", "thumbrx", "D", "-0.23 0.23", "gamepadYaw");
            moveMap.Bind("gamepad", "thumbry", "D", "-0.23 0.23", "gamepadPitch");
            moveMap.Bind("gamepad", "thumblx", "D", "-0.23 0.23", "gamePadMoveX");
            moveMap.Bind("gamepad", "thumbly", "D", "-0.23 0.23", "gamePadMoveY");

            moveMap.Bind("gamepad", "btn_a", "jump");
            moveMap.BindCmd("gamepad", "btn_back", "disconnect();", "");

            moveMap.BindCmd("gamepad", "dpadl", "toggleLightColorViz();", "");
            moveMap.BindCmd("gamepad", "dpadu", "toggleDepthViz();", "");
            moveMap.BindCmd("gamepad", "dpadd", "toggleNormalsViz();", "");
            moveMap.BindCmd("gamepad", "dpadr", "toggleLightSpecularViz();", "");

            // ----------------------------------------------------------------------------
            // Stance/pose
            // ----------------------------------------------------------------------------
            moveMap.Bind("keyboard", "lcontrol", "doCrouch");
            moveMap.Bind("gamepad", "btn_b", "doCrouch");

            moveMap.Bind("keyboard", "lshift", "doSprint");

            //------------------------------------------------------------------------------
            // Mouse Trigger
            //------------------------------------------------------------------------------
            //function altTrigger(%val)
            //{
            //$mvTriggerCount1++;
            //}

            moveMap.Bind("mouse", "button0", "mouseFire");
            //moveMap.Bind( "mouse", button1, altTrigger );

            //------------------------------------------------------------------------------
            // Gamepad Trigger
            //------------------------------------------------------------------------------
            moveMap.Bind("gamepad", "triggerr", "gamepadFire");
            moveMap.Bind("gamepad", "triggerl", "gamepadAltTrigger");

            //------------------------------------------------------------------------------
            // Zoom and FOV functions
            //------------------------------------------------------------------------------

            if (Global.GetConsoleString("Player::CurrentFOV") == "")
            {
                Global.SetConsoleString("Player::CurrentFOV",
                                        (Global.GetConsoleFloat("pref::Player::DefaultFOV") / 2).ToString(CultureInfo.InvariantCulture));
            }

            // toggleZoomFOV() works by dividing the CurrentFOV by 2.  Each time that this
            // toggle is hit it simply divides the CurrentFOV by 2 once again.  If the
            // FOV is reduced below a certain threshold then it resets to equal half of the
            // DefaultFOV value.  This gives us 4 zoom levels to cycle through.
            moveMap.Bind("keyboard", "f", "setZoomFOV"); // f for field of view
            moveMap.Bind("keyboard", "z", "toggleZoom"); // z for zoom
            moveMap.Bind("mouse", "button1", "mouseButtonZoom");

            //------------------------------------------------------------------------------
            // Camera & View functions
            //------------------------------------------------------------------------------
            moveMap.Bind("keyboard", "v", "toggleFreeLook"); // v for vanity
            moveMap.Bind("keyboard", "tab", "toggleFirstPerson");

            moveMap.Bind("gamepad", "btn_x", "toggleFirstPerson");

            // ----------------------------------------------------------------------------
            // Misc. Player stuff
            // ----------------------------------------------------------------------------

            // Gideon does not have these animations, so the player does not need access to
            // them.  Commenting instead of removing so as to retain an example for those
            // who will want to use a player model that has these animations and wishes to
            // use them.

            //moveMap.BindCmd( "keyboard", "ctrl w", "commandToServer('playCel',\"wave\");", "");
            //moveMap.BindCmd( "keyboard", "ctrl s", "commandToServer('playCel',\"salute\");", "");

            moveMap.BindCmd("keyboard", "ctrl k", "commandToServer('suicide');", "");

            //------------------------------------------------------------------------------
            // Item manipulation
            //------------------------------------------------------------------------------
            moveMap.BindCmd("keyboard", "1", "commandToServer('use',\"Ryder\");", "");
            moveMap.BindCmd("keyboard", "2", "commandToServer('use',\"Lurker\");", "");
            moveMap.BindCmd("keyboard", "3", "commandToServer('use',\"LurkerGrenadeLauncher\");", "");
            moveMap.BindCmd("keyboard", "4", "commandToServer('use',\"ProxMine\");", "");
            moveMap.BindCmd("keyboard", "5", "commandToServer('use',\"DeployableTurret\");", "");

            moveMap.BindCmd("keyboard", "r", "commandToServer('reloadWeapon');", "");

            moveMap.Bind("keyboard", "0", "unmountWeapon");

            moveMap.Bind("keyboard", "alt w", "throwWeapon");
            moveMap.Bind("keyboard", "alt a", "tossAmmo");

            moveMap.Bind("keyboard", "q", "nextWeapon");
            moveMap.Bind("keyboard", "ctrl q", "prevWeapon");
            moveMap.Bind("mouse", "zaxis", "mouseWheelWeaponCycle");

            //------------------------------------------------------------------------------
            // Message HUD functions
            //------------------------------------------------------------------------------
            moveMap.Bind("keyboard", "u", "toggleMessageHud");
            //moveMap.Bind( "keyboard", y, teamMessageHud );
            moveMap.Bind("keyboard", "pageUp", "pageMessageHudUp");
            moveMap.Bind("keyboard", "pageDown", "pageMessageHudDown");
            moveMap.Bind("keyboard", "p", "resizeMessageHud");

            //------------------------------------------------------------------------------
            // Demo recording functions
            //------------------------------------------------------------------------------
            moveMap.Bind("keyboard", "F3", "startRecordingDemo");
            moveMap.Bind("keyboard", "F4", "stopRecordingDemo");

            //------------------------------------------------------------------------------
            // Helper Functions
            //------------------------------------------------------------------------------
            moveMap.Bind("keyboard", "F8", "dropCameraAtPlayer");
            moveMap.Bind("keyboard", "F7", "dropPlayerAtCamera");

            globalActionMap.Bind("keyboard", "ctrl F3", "doProfile");

            //------------------------------------------------------------------------------
            // Misc.
            //------------------------------------------------------------------------------
            globalActionMap.Bind("keyboard", "tilde", "toggleConsole");
            globalActionMap.BindCmd("keyboard", "alt k", "cls();", "");
            globalActionMap.BindCmd("keyboard", "alt enter", "", "Canvas.attemptFullscreenToggle();");
            globalActionMap.BindCmd("keyboard", "F1", "", "contextHelp();");
            moveMap.BindCmd("keyboard", "n", "toggleNetGraph();", "");

            // ----------------------------------------------------------------------------
            // Useful vehicle stuff
            // ----------------------------------------------------------------------------
            // Bind the keys to the carjack command
            moveMap.BindCmd("keyboard", "ctrl z", "carjack();", "");

            // Starting vehicle action map code
            if (Global.IsObject("vehicleMap"))
            {
                ActionMap oldVehicleMap = Sim.FindObjectByName <ActionMap>("vehicleMap");
                oldVehicleMap.Delete();
            }

            ActionMap vehicleMap = new ActionMap("vehicleMap");

            vehicleMap.RegisterObject();

            //------------------------------------------------------------------------------
            // Non-remapable binds
            //------------------------------------------------------------------------------
            vehicleMap.BindCmd("keyboard", "escape", "", "Canvas.pushDialog(PauseMenu);");

            // The key command for flipping the car
            vehicleMap.BindCmd("keyboard", "ctrl x", "commandToServer(\'flipCar\');", "");

            vehicleMap.Bind("keyboard", "w", "moveforward");
            vehicleMap.Bind("keyboard", "s", "movebackward");
            vehicleMap.Bind("keyboard", "up", "moveforward");
            vehicleMap.Bind("keyboard", "down", "movebackward");
            vehicleMap.Bind("mouse", "xaxis", "yaw");
            vehicleMap.Bind("mouse", "yaxis", "pitch");
            vehicleMap.Bind("mouse", "button0", "mouseFire");
            vehicleMap.Bind("mouse", "button1", "altTrigger");
            vehicleMap.BindCmd("keyboard", "f", "getout();", "");
            vehicleMap.Bind("keyboard", "space", "brake");
            vehicleMap.BindCmd("keyboard", "l", "brakeLights();", "");
            vehicleMap.Bind("keyboard", "v", "toggleFreeLook"); // v for vanity
            //vehicleMap.Bind( "keyboard", tab, toggleFirstPerson );
            // bind the left thumbstick for steering
            vehicleMap.Bind("gamepad", "thumblx", "D", "-0.23 0.23", "gamepadYaw");
            // bind the gas, break, and reverse buttons
            vehicleMap.Bind("gamepad", "btn_a", "moveforward");
            vehicleMap.Bind("gamepad", "btn_b", "brake");
            vehicleMap.Bind("gamepad", "btn_x", "movebackward");
            // bind exiting the vehicle to a button
            vehicleMap.BindCmd("gamepad", "btn_y", "getout();", "");
        }
Esempio n. 21
0
 //---------------------------------------------------------------------------------------------
 // The following functions override the GuiCanvas defaults that involve changing the content
 // of the Canvas. Basically, all we are doing is adding a call to checkCursor to each one.
 //---------------------------------------------------------------------------------------------
 public void setContent(string ctrl)
 {
     base.setContent(Sim.FindObjectByName <GuiControl>(ctrl));
     //Parent::setContent(%this, %ctrl);
     checkCursor();
 }