コード例 #1
0
        void InitSlide(object sender, EventArgs e)
        {
            switch (m_initTickCount--)
            {
            case 0:
                Tick -= InitSlide;

                Application.Start();
                Application.GUI.SetHelpText("F1: Start/Stop recording\nF2: Cancel recording\nF4: Enter freemode\nF9: Set ego car to spawnpoint\nF11: Toggle console\nF12: Toggle help window\n\nControls:\nTab: Select next element\nUp/Down: Navigate in list\nLeft/Right: Change option\nEnter: Select");

                //TODO: This camera initialization only works, if the script is started using the 'load game' option. It does not work when reloading the scripts using the 'Ins' key.
                //To fix the camera after pressing 'Ins', wait until the GUI is showing, then press F4, F8, and F4, one after another and wait a moment between the key presses.
                Application.ExecutionQueue.AddAction(5, () =>
                {
                    Application.GetScript <CameraScript>().SetMode(CameraScript.CameraMode.Free);
                });
                Application.ExecutionQueue.AddAction(50, () =>
                {
                    CameraScript.PressF8Key();
                });
                Application.ExecutionQueue.AddAction(100, () =>
                {
                    Application.GetScript <CameraScript>().SetMode(CameraScript.CameraMode.Fixed);
                    m_lastCameraMode = CameraScript.CameraMode.Fixed;

                    Application.GUI.Show();
                    KeyDown += SafeKeyDownHandler;
                });

                break;

            default:
                break;
            }
        }
コード例 #2
0
        void ToggleFreeMode()
        {
            var Camera = Application.GetScript <CameraScript>();

            if (Camera.CurrentMode != CameraScript.CameraMode.Free)
            {
                Application.Console.WriteLine("[KeyHandler.F4]: Entering freemode");
                m_lastCameraMode = Camera.CurrentMode;
                Camera.SetMode(CameraScript.CameraMode.Free);
                m_showGUIAfterExitingFreemode = Application.GUI.IsVisible;
                if (m_showGUIAfterExitingFreemode)
                {
                    Application.Console.WriteLine("[KeyHandler.F4]: GUI will be shown after exiting freemode");
                }

                Application.GUI.Hide();
            }
            else
            {
                Application.Console.WriteLine("[KeyHandler.F4]: Exiting freemode");
                Camera.SetMode(m_lastCameraMode);
                if (m_showGUIAfterExitingFreemode)
                {
                    Application.Console.WriteLine("[KeyHandler.F4]: Showing GUI");
                    Application.GUI.Show();
                }
            }
        }