Example #1
0
        public static void DrawBriefing(CustomMission currentMission)
        {
            UI.ShowSubtitle("Choose an entry point.", 10);
            if (currentMission.EntryPoints.Length - 1 < SelectedEntry)
            {
                SelectedEntry = 0;
            }
            Function.Call(Hash._SHOW_CURSOR_THIS_FRAME);
            DisEnableControls(false, true);
            currentMission.DrawBriefingMap();
            Game.Player.Character.Position = currentMission.CameraPosition + new Vector3(0, 0, 10f);
            Function.Call(Hash.FREEZE_ENTITY_POSITION, Game.Player.Character.Handle, true);
            if (_mainCamera == null || (_mainCamera.Position != currentMission.CameraPosition))
            {
                World.DestroyAllCameras();
                _mainCamera = World.CreateCamera(currentMission.CameraPosition, new Vector3(0, 0, 0), 60f);
            }
            _mainCamera.PointAt(currentMission.CameraPosition - new Vector3(0, 0, 30f));
            World.RenderingCamera = _mainCamera;
            SizeF res = UIMenu.GetScreenResolutionMantainRatio();

            for (int i = 0; i < currentMission.EntryPoints.Length; i++)
            {
                Vector3 entryPoint = currentMission.EntryPoints[i];

                var  xPointer   = new OutputArgument();
                var  yPointer   = new OutputArgument();
                bool successful = Function.Call <bool>(Hash._WORLD3D_TO_SCREEN2D, entryPoint.X, entryPoint.Y, entryPoint.Z, xPointer,
                                                       yPointer);
                var x = xPointer.GetResult <float>() * res.Width;
                var y = yPointer.GetResult <float>() * res.Height;

                if (!successful)
                {
                    x = 64f;
                    y = res.Height - 64f - 64 * i;
                }

                bool hovering = UIMenu.IsMouseInBounds(new Point(Convert.ToInt32(x) - 32, Convert.ToInt32(y) - 32),
                                                       new Size(64, 64));

                new Sprite("trafficcam", SelectedEntry == i ? "traffic_junction_box" : "cursor",
                           new Point(Convert.ToInt32(x) - 32, Convert.ToInt32(y) - 32), new Size(64, 64), 0f, SelectedEntry == i ? Color.DarkGreen : Color.DarkRed)
                .Draw();

                if (Game.IsControlPressed(0, GTA.Control.Attack) && hovering)
                {
                    SelectedEntry = i;
                }
                new UIResText(currentMission.EntryNames[i], new Point(Convert.ToInt32(x) + 32, Convert.ToInt32(y) - 32), 1f, Color.White, Font.Monospace,
                              UIResText.Alignment.Left).Draw();
            }
            new UIResText(currentMission.MissionName, new Point(Convert.ToInt32(res.Width), 20), 3f, Color.White,
                          GTA.Font.Pricedown, UIResText.Alignment.Right).Draw();

            DrawScaleform();
            Function.Call(Hash.FREEZE_ENTITY_POSITION, Game.Player.Character.Handle, false);
        }
Example #2
0
File: GUI.cs Project: Guad/NOOSE
        public static void DrawBriefing(CustomMission currentMission)
        {
            UI.ShowSubtitle("Choose an entry point.", 10);
            if (currentMission.EntryPoints.Length - 1 < SelectedEntry)
                SelectedEntry = 0;
            Function.Call(Hash._SHOW_CURSOR_THIS_FRAME);
            DisEnableControls(false, true);
            currentMission.DrawBriefingMap();
            Game.Player.Character.Position = currentMission.CameraPosition + new Vector3(0, 0, 10f);
            Function.Call(Hash.FREEZE_ENTITY_POSITION, Game.Player.Character.Handle, true);
            if (_mainCamera == null || (_mainCamera.Position != currentMission.CameraPosition))
            {
                World.DestroyAllCameras();
                _mainCamera = World.CreateCamera(currentMission.CameraPosition, new Vector3(0, 0, 0), 60f);
            }
            _mainCamera.PointAt(currentMission.CameraPosition - new Vector3(0,0, 30f));
            World.RenderingCamera = _mainCamera;
            SizeF res = UIMenu.GetScreenResolutionMantainRatio();

            for (int i = 0; i < currentMission.EntryPoints.Length; i++)
            {
                Vector3 entryPoint = currentMission.EntryPoints[i];

                var xPointer = new OutputArgument();
                var yPointer = new OutputArgument();
                bool successful = Function.Call<bool>(Hash._WORLD3D_TO_SCREEN2D, entryPoint.X, entryPoint.Y, entryPoint.Z, xPointer,
                    yPointer);
                var x = xPointer.GetResult<float>()*res.Width;
                var y = yPointer.GetResult<float>()*res.Height;

                if (!successful)
                {
                    x = 64f;
                    y = res.Height - 64f - 64*i;
                }

                bool hovering = UIMenu.IsMouseInBounds(new Point(Convert.ToInt32(x) - 32, Convert.ToInt32(y) - 32),
                    new Size(64, 64));

                new Sprite("trafficcam", SelectedEntry == i ? "traffic_junction_box" : "cursor",
                    new Point(Convert.ToInt32(x) - 32, Convert.ToInt32(y) - 32), new Size(64, 64), 0f, SelectedEntry == i ? Color.DarkGreen : Color.DarkRed)
                    .Draw();

                if (Game.IsControlPressed(0, GTA.Control.Attack) && hovering)
                    SelectedEntry = i;
                new UIResText(currentMission.EntryNames[i], new Point(Convert.ToInt32(x) + 32, Convert.ToInt32(y) - 32), 1f, Color.White, Font.Monospace,
                    UIResText.Alignment.Left).Draw();
            }
            new UIResText(currentMission.MissionName, new Point(Convert.ToInt32(res.Width), 20), 3f, Color.White,
                GTA.Font.Pricedown, UIResText.Alignment.Right).Draw();

            DrawScaleform();
            Function.Call(Hash.FREEZE_ENTITY_POSITION, Game.Player.Character.Handle, false);
        }