示例#1
1
        /// <summary>
        /// Advanced Menu constructor that allows custom title banner.
        /// </summary>
        /// <param name="title">Title that appears on the big banner. Set to "" if you are using a custom banner.</param>
        /// <param name="subtitle">Subtitle that appears in capital letters in a small black bar.</param>
        /// <param name="offset">Point object with X and Y data for offsets. Applied to all menu elements.</param>
        /// <param name="spriteLibrary">Sprite library name for the banner.</param>
        /// <param name="spriteName">Sprite name for the banner.</param>
        public UIMenu(string title, string subtitle, Point offset, string spriteLibrary, string spriteName)
        {
            _offset = offset;
            Children = new Dictionary<UIMenuItem, UIMenu>();
            WidthOffset = 0;

            _instructionalButtonsScaleform = new Scaleform(0);
            _instructionalButtonsScaleform.Load("instructional_buttons");
            UpdateScaleform();

            _mainMenu = new UIContainer(new Point(0, 0), new Size(700, 500), Color.FromArgb(0, 0, 0, 0));
            _logo = new Sprite(spriteLibrary, spriteName, new Point(0 + _offset.X, 0 + _offset.Y), new Size(431, 107));
            _mainMenu.Items.Add(Title = new UIResText(title, new Point(215 + _offset.X, 20 + _offset.Y), 1.15f, Color.White, Font.HouseScript, UIResText.Alignment.Centered));
            if (!String.IsNullOrWhiteSpace(subtitle))
            {
                _mainMenu.Items.Add(new UIResRectangle(new Point(0 + offset.X, 107 + _offset.Y), new Size(431, 37), Color.Black));
                _mainMenu.Items.Add(Subtitle = new UIResText(subtitle, new Point(8 + _offset.X, 110 + _offset.Y), 0.35f, Color.WhiteSmoke, 0, UIResText.Alignment.Left));

                if (subtitle.StartsWith("~"))
                {
                    CounterPretext = subtitle.Substring(0, 3);
                }
                _counterText = new UIResText("", new Point(425 + _offset.X, 110 + _offset.Y), 0.35f, Color.WhiteSmoke, 0, UIResText.Alignment.Right);
                _extraYOffset = 37;
            }

            _upAndDownSprite = new Sprite("commonmenu", "shop_arrows_upanddown", new Point(190 + _offset.X, 147 + 37 * (MaxItemsOnScreen + 1) + _offset.Y - 37 + _extraYOffset), new Size(50, 50));
            _extraRectangleUp = new UIResRectangle(new Point(0 + _offset.X, 144 + 38 * (MaxItemsOnScreen + 1) + _offset.Y - 37 + _extraYOffset), new Size(431, 18), Color.FromArgb(200, 0, 0, 0));
            _extraRectangleDown = new UIResRectangle(new Point(0 + _offset.X, 144 + 18 + 38 * (MaxItemsOnScreen + 1) + _offset.Y - 37 + _extraYOffset), new Size(431, 18), Color.FromArgb(200, 0, 0, 0));

            _descriptionBar = new UIResRectangle(new Point(_offset.X, 123), new Size(431, 4), Color.Black);
            _descriptionRectangle = new Sprite("commonmenu", "gradient_bgd", new Point(_offset.X, 127), new Size(431, 30));
            _descriptionText = new UIResText("Description", new Point(_offset.X + 5, 125), 0.35f, Color.FromArgb(255, 255, 255, 255), Font.ChaletLondon, UIResText.Alignment.Left);

            _background = new Sprite("commonmenu", "gradient_bgd", new Point(_offset.X, 144 + _offset.Y - 37 + _extraYOffset), new Size(290, 25));

            SetKey(MenuControls.Up, Control.PhoneUp);
            SetKey(MenuControls.Down, Control.PhoneDown);
            SetKey(MenuControls.Left, Control.PhoneLeft);
            SetKey(MenuControls.Right, Control.PhoneRight);
            SetKey(MenuControls.Select, Control.FrontendAccept);

            SetKey(MenuControls.Back, Control.PhoneCancel);
            SetKey(MenuControls.Back, Control.FrontendPause);
        }
示例#2
0
        public void Draw()
        {
            if (!Visible)
            {
                return;
            }

            var res    = UIMenu.GetScreenResolutionMantainRatio();
            var middle = Convert.ToInt32(res.Width / 2);

            new Sprite("mpentry", "mp_modenotselected_gradient", new Point(0, 30), new Size(Convert.ToInt32(res.Width), 300),
                       0f, Color.FromArgb(230, 255, 255, 255)).Draw();

            new ResText("mission failed", new Point(middle, 100), 2.5f, Color.FromArgb(255, 148, 27, 46), Font.Pricedown, ResText.Alignment.Centered).Draw();

            new ResText(Reason, new Point(middle, 230), 0.5f, Color.White, Font.ChaletLondon, ResText.Alignment.Centered).Draw();

            var scaleform = new Scaleform(0);

            scaleform.Load("instructional_buttons");
            scaleform.CallFunction("CLEAR_ALL");
            scaleform.CallFunction("TOGGLE_MOUSE_BUTTONS", 0);
            scaleform.CallFunction("CREATE_CONTAINER");


            scaleform.CallFunction("SET_DATA_SLOT", 0, NativeFunction.Natives.x0499D7B09FC9B407 <string>(2, 201, 0), "Continue");
            scaleform.CallFunction("DRAW_INSTRUCTIONAL_BUTTONS", -1);
            scaleform.Render2D();

            if (!Game.IsKeyDown(Keys.Enter))
            {
                return;
            }
            NativeFunction.Natives.PLAY_SOUND_FRONTEND(-1, "SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET", 0); // Doesn't work
        }
示例#3
0
        /// <summary>
        /// Menu closing sends "CharacterChanged (SelectedModelHash)" to server
        /// </summary>
        /// <param name="sender"></param>
        protected override void MainMenu_OnMenuClose(UIMenu sender)
        {
            //Destroy cameras, set this _camera to inactive
            Cam.RenderScriptCams(false, true, 0, false, false, 0);
            Cam.SetCamActive(_camera, false);
            Cam.DestroyCam(_camera, false);

            //Enable the players controls again
            RAGE.Elements.Player.LocalPlayer.SetGravity(true);
            Pad.EnableAllControlActions(0);

            //Let server know menu is closed to change if selected a ped to sync.
            RAGE.Events.CallRemote("ClientMenuClosed", SelectedModelHash.ToString(), selectedOutfit);

            PlayerHelper.FreezePlayer(false, false);

            ChatHelper.EnableChat(true);
            UiHelper.EnableHuds();

            _instructionLayer = ScaleformHelper.InstructionalButtons(KeyValuePairs);
            if (_debug)
            {
                Chat.Output("Skin selector Menu closed");
            }
        }
示例#4
0
        public static Model LoadObject(int hash)
        {
            int counter = 0;
            var res     = UIMenu.GetScreenResolutionMaintainRatio();

            var m = new Model(hash);

            if (!m.IsValid || !m.IsInCdImage)
            {
                if (!ObjectDatabase.InvalidHashes.Contains(hash))
                {
                    ObjectDatabase.InvalidHashes.Add(hash);
                    ObjectDatabase.SaveInvalidHashes();
                }
                return(null);
            }
            globalCounter++;
            var sc = new Scaleform(0);

            sc.Load("instructional_buttons");
            sc.CallFunction("CLEAR_ALL");
            sc.CallFunction("TOGGLE_MOUSE_BUTTONS", 0);
            sc.CallFunction("CREATE_CONTAINER");
            sc.CallFunction("SET_DATA_SLOT", 0, "b_50", Translation.Translate("Loading Model"));
            sc.CallFunction("DRAW_INSTRUCTIONAL_BUTTONS", -1);
            while (!m.IsLoaded && counter < 200)
            {
                m.Request();
                Script.Yield();
                counter++;
                sc.Render2D();
            }
            return(m);
        }
示例#5
0
        public void Draw()
        {
            if (!Visible)
            {
                return;
            }

            SizeF res    = UIMenu.GetScreenResolutionMantainRatio();
            int   middle = Convert.ToInt32(res.Width / 2);

            new Sprite("mpentry", "mp_modenotselected_gradient", new Point(0, 30), new Size(Convert.ToInt32(res.Width), 300),
                       0f, Color.FromArgb(230, 255, 255, 255)).Draw();

            new UIResText("mission failed", new Point(middle, 100), 2.5f, Color.FromArgb(255, 148, 27, 46), Font.Pricedown, UIResText.Alignment.Centered).Draw();

            new UIResText(Reason, new Point(middle, 230), 0.5f, Color.White, Font.ChaletLondon, UIResText.Alignment.Centered).Draw();

            var scaleform = new Scaleform(0);

            scaleform.Load("instructional_buttons");
            scaleform.CallFunction("CLEAR_ALL");
            scaleform.CallFunction("TOGGLE_MOUSE_BUTTONS", 0);
            scaleform.CallFunction("CREATE_CONTAINER");

            scaleform.CallFunction("SET_DATA_SLOT", 0, Function.Call <string>(Hash._0x0499D7B09FC9B407, 2, (int)Control.FrontendAccept, 0), "Continue");
            scaleform.CallFunction("DRAW_INSTRUCTIONAL_BUTTONS", -1);
            scaleform.Render2D();
            if (Game.IsControlJustPressed(0, Control.FrontendAccept))
            {
                Game.PlaySound("SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET");
            }
        }
示例#6
0
        public static async Task ShowShard(MessageType type, string title, string subtitle, int backgroundColor, int textColor, int duration)
        {
            var scale = new Scaleform("MP_BIG_MESSAGE_FREEMODE");

            if (!HasNamedScaleformMovieLoaded("MP_BIG_MESSAGE_FREEMODE") || !scale.IsLoaded)
            {
                RequestScaleformMovie("MP_BIG_MESSAGE_FREEMODE");
            }
            while (!HasNamedScaleformMovieLoaded("MP_BIG_MESSAGE_FREEMODE") || !scale.IsLoaded)
            {
                await Delay(0);
            }
            switch (type)
            {
            case MessageType.KNOCKED_OUT:
                var timer = GetGameTimer();
                scale.CallFunction("SHOW_SHARD_WASTED_MP_MESSAGE", title, subtitle, 0, true, true);
                StartScreenEffect("MinigameEndNeutral", duration, false);
                //SumoSound.Play(SumoSound.sound.PLAYER_DIED);
                SumoSound.Play(SumoSound.sound.SHARD_RESULT);
                while (GetGameTimer() - timer < duration)
                {
                    scale.Render2D();
                    await Delay(0);
                }
                StopAllScreenEffects();


                break;

            default:
                break;
            }
        }
示例#7
0
        public static void Init()
        {
            scaleform = new Scaleform("instructional_buttons");
            scaleform.CallFunction("CLEAR_ALL", new object[0]);
            scaleform.CallFunction("TOGGLE_MOUSE_BUTTONS", 0);

            // Movement/Rotation
            scaleform.CallFunction("SET_DATA_SLOT", 0, Function.Call <string>(Hash.GET_CONTROL_INSTRUCTIONAL_BUTTON, 2, Control.MoveLeftRight, 0), "");
            scaleform.CallFunction("SET_DATA_SLOT", 1, Function.Call <string>(Hash.GET_CONTROL_INSTRUCTIONAL_BUTTON, 2, Control.MoveUpDown, 0), "Move");
            scaleform.CallFunction("SET_DATA_SLOT", 2, Function.Call <string>(Hash.GET_CONTROL_INSTRUCTIONAL_BUTTON, 2, Control.LookLeftRight, 0), "Look");
            scaleform.CallFunction("SET_DATA_SLOT", 3, Function.Call <string>(Hash.GET_CONTROL_INSTRUCTIONAL_BUTTON, 2, Control.Pickup, 0), "");
            scaleform.CallFunction("SET_DATA_SLOT", 4, Function.Call <string>(Hash.GET_CONTROL_INSTRUCTIONAL_BUTTON, 2, Control.Cover, 0), "Roll");

            // Misc
            scaleform.CallFunction("SET_DATA_SLOT", 5, Function.Call <string>(Hash.GET_CONTROL_INSTRUCTIONAL_BUTTON, 2, Control.FrontendDown, 0), "");
            scaleform.CallFunction("SET_DATA_SLOT", 6, Function.Call <string>(Hash.GET_CONTROL_INSTRUCTIONAL_BUTTON, 2, Control.FrontendUp, 0), "FOV");
            scaleform.CallFunction("SET_DATA_SLOT", 7, Function.Call <string>(Hash.GET_CONTROL_INSTRUCTIONAL_BUTTON, 2, Control.FrontendRight, 0), "");
            scaleform.CallFunction("SET_DATA_SLOT", 8, Function.Call <string>(Hash.GET_CONTROL_INSTRUCTIONAL_BUTTON, 2, Control.FrontendLeft, 0), $"Filter: [{Config.Filters[FilterIndex]}]");
            scaleform.CallFunction("SET_DATA_SLOT", 9, Function.Call <string>(Hash.GET_CONTROL_INSTRUCTIONAL_BUTTON, 2, Control.Reload, 0), $"Reset");
            scaleform.CallFunction("SET_DATA_SLOT", 10, Function.Call <string>(Hash.GET_CONTROL_INSTRUCTIONAL_BUTTON, 2, Control.Detonate, 0), "Slow Motion");
            scaleform.CallFunction("SET_DATA_SLOT", 11, Function.Call <string>(Hash.GET_CONTROL_INSTRUCTIONAL_BUTTON, 2, Control.VehicleExit, 0), "Freeze");
            scaleform.CallFunction("SET_DATA_SLOT", 11, Function.Call <string>(Hash.GET_CONTROL_INSTRUCTIONAL_BUTTON, 2, Control.FrontendAccept, 0), "Control Lock");
            if (!Attached)
            {
                scaleform.CallFunction("SET_DATA_SLOT", 12, Function.Call <string>(Hash.GET_CONTROL_INSTRUCTIONAL_BUTTON, 2, Control.CursorAccept, 0), "Attach");
            }
            else
            {
                scaleform.CallFunction("SET_DATA_SLOT", 12, Function.Call <string>(Hash.GET_CONTROL_INSTRUCTIONAL_BUTTON, 2, Control.CursorCancel, 0), "Detach");
            }
            // HUD Toggle
            scaleform.CallFunction("SET_DATA_SLOT", 13, Function.Call <string>(Hash.GET_CONTROL_INSTRUCTIONAL_BUTTON, 2, 74, 0), "Toggle HUD");
        }
示例#8
0
        public void Draw()
        {
            if (!Visible) return;

            SizeF res = UIMenu.GetScreenResolutionMantainRatio();
            int middle = Convert.ToInt32(res.Width/2);

            new Sprite("mpentry", "mp_modenotselected_gradient", new Point(0, 30), new Size(Convert.ToInt32(res.Width), 300),
                0f, Color.FromArgb(230, 255, 255, 255)).Draw();

            new UIResText("mission failed", new Point(middle, 100), 2.5f, Color.FromArgb(255, 148, 27, 46), Font.Pricedown, UIResText.Alignment.Centered).Draw();

            new UIResText(Reason, new Point(middle, 230), 0.5f, Color.White, Font.ChaletLondon, UIResText.Alignment.Centered).Draw();

            var scaleform = new Scaleform(0);
            scaleform.Load("instructional_buttons");
            scaleform.CallFunction("CLEAR_ALL");
            scaleform.CallFunction("TOGGLE_MOUSE_BUTTONS", 0);
            scaleform.CallFunction("CREATE_CONTAINER");

            scaleform.CallFunction("SET_DATA_SLOT", 0, Function.Call<string>(Hash._0x0499D7B09FC9B407, 2, (int)Control.FrontendAccept, 0), "Continue");
            scaleform.CallFunction("DRAW_INSTRUCTIONAL_BUTTONS", -1);
            scaleform.Render2D();
            if (Game.IsControlJustPressed(0, Control.FrontendAccept))
            {
                Game.PlaySound("SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET");
            }
        }
示例#9
0
        public SpotifyRadio()
        {
            spotify        = new SpotifyController();
            moodMatcher    = new MoodMatch();
            isEngineOn     = false;
            isSpotifyRadio = false;
            isEngineOn     = false;
            matchMood      = false;
            hasDevice      = false;
            time           = 0;

            File.Create("scripts/GTASpotify.log").Close();
            config  = ScriptSettings.Load("scripts/GTASpotify.ini");
            menuKey = config.GetValue("Options", "MenuKey", Keys.F10);
            volume  = config.GetValue <int>("Options", "Volume", 100);
            if (volume < 0 || volume > 100)
            {
                volume = 100;
            }
            defaultPlaylistId = config.GetValue <string>("Options", "DefaultPlaylist", "");
            spotify.GuaranteeLogin();
            if (spotify.obtainedSpotifyClient)
            {
                spotify.InitialSpotifyRequests(defaultPlaylistId);
                DisableRadioAds();
                SetupMenu();
                DashboardScaleform = new Scaleform("dashboard");
                KeyDown           += OnKeyDown;
                Tick += OnTick;
            }
            else
            {
                Logger.Log("ERROR: Did not login to Spotify");
            }
        }
示例#10
0
        private async Task OnTick()
        {
            var playerExists = (Game.PlayerPed.Handle != 0);
            var playerActive = NetworkIsPlayerActive(PlayerId());

            // First Spawn
            if (playerExists && playerActive && !_hasSpawned)
            {
                SpawnPlayer();
                _hasSpawned = true;
            }

            if (Game.Player.IsDead && !_isDead)
            {
                var playerPed = Game.PlayerPed;
                _deadMessage = new Scaleform("MP_BIG_MESSAGE_FREEMODE");
                _isDead      = true;
                Screen.Effects.Start(ScreenEffect.DeathFailMpIn);
                Screen.Fading.FadeOut(500);
                await Delay(3000);

                SetEntityVisible(playerPed.Handle, false, false);
                playerPed.Position = HospitalPosition;
                FreezeEntityPosition(playerPed.Handle, true);
                Screen.Fading.FadeIn(500);
            }

            await Task.FromResult(0);
        }
示例#11
0
        internal Task Update()
        {
            if (_sc == null)
            {
                return(Task.FromResult(0));
            }
            _sc.Render2D();

            if (_start != 0 && Game.GameTime - _start > _timer)
            {
                if (!_hasAnimatedOut)
                {
                    _sc.CallFunction("SHARD_ANIM_OUT", (int)HudColor.HUD_COLOUR_PURPLE, 750);
                    _hasAnimatedOut = true;
                    _timer         += 750;
                }
                else
                {
                    Audio.PlaySoundFrontend("Shard_Disappear", "GTAO_FM_Events_Soundset");
                    _start = 0;
                    Dispose();
                    _sc = null;
                }
            }

            return(Task.FromResult(0));
        }
示例#12
0
        public static Model LoadObject(int hash)
        {
            int counter = 0;
            var res = UIMenu.GetScreenResolutionMantainRatio();

            var m = new Model(hash);

            if (!m.IsValid || !m.IsInCdImage)
            {
                if (!ObjectDatabase.InvalidHashes.Contains(hash))
                {
                    ObjectDatabase.InvalidHashes.Add(hash);
                    ObjectDatabase.SaveInvalidHashes();
                }
                return null;
            }
            globalCounter++;
            var sc = new Scaleform(0);
            sc.Load("instructional_buttons");
            sc.CallFunction("CLEAR_ALL");
            sc.CallFunction("TOGGLE_MOUSE_BUTTONS", 0);
            sc.CallFunction("CREATE_CONTAINER");
            sc.CallFunction("SET_DATA_SLOT", 0, "b_50", Translation.Translate("Loading Model"));
            sc.CallFunction("DRAW_INSTRUCTIONAL_BUTTONS", -1);
            while (!m.IsLoaded && counter < 200)
            {
                m.Request();
                Script.Yield();
                counter++;
                sc.Render2D();
            }
            return m;
        }
示例#13
0
 public ClassicChat()
 {
     CurrentInput   = "";
     _mainScaleform = new Scaleform(0);
     _mainScaleform.Load("multiplayer_chat");
     _messages = new List <Tuple <string, Color> >();
 }
        private static void _registerTestCommand()
        {
            API.RegisterCommand("testshows", new Action <int, List <object>, string>(async(source, args, raw) =>
            {
                var now             = Game.GameTime;
                Scaleform scaleform = new Scaleform("MP_BIG_MESSAGE_FREEMODE");
                while (!scaleform.IsLoaded)
                {
                    await Delay(100);
                }

                var labelText = "";
                if (!(args.Count == 0 || string.IsNullOrEmpty(args[0].ToString())))
                {
                    labelText = args[0].ToString();
                }

                scaleform.CallFunction("SHOW_SHARD_WASTED_MP_MESSAGE", API.GetLabelText(labelText), "~y~DONE~s~", 5);
                while (Game.GameTime - now <= 1000 * 8)
                {
                    scaleform.Render2D();
                    await Delay(0);
                }
            }), false);
        }
示例#15
0
        internal Task Update()
        {
            if (_sc == null)
            {
                return(Task.FromResult(0));
            }
            _sc.Render2D();
            if (_start != 0 && Game.GameTime - _start > _timer)
            {
                if (!_hasAnimatedOut)
                {
                    _sc.CallFunction("TRANSITION_OUT");
                    _hasAnimatedOut = true;
                    _timer         += 750;
                }
                else
                {
                    _start = 0;
                    Dispose();
                    _sc = null;
                }
            }

            return(Task.FromResult(0));
        }
        /// <summary>
        /// Loads the scaleform.
        /// </summary>
        /// <returns></returns>
        private async Task LoadScale()
        {
            if (scale != null)
            {
                for (var i = 0; i < maxClients * 2; i++)
                {
                    scale.CallFunction("SET_DATA_SLOT_EMPTY", i);
                }
                scale.Dispose();
            }
            scale = null;
            while (!HasScaleformMovieLoaded(RequestScaleformMovie("MP_MM_CARD_FREEMODE")))
            {
                await Delay(0);
            }
            scale = new Scaleform("MP_MM_CARD_FREEMODE");
            var titleIcon      = "2";
            var titleLeftText  = "FiveM";
            var titleRightText = $"Players {NetworkGetNumConnectedPlayers()}/{maxClients}";

            scale.CallFunction("SET_TITLE", titleLeftText, titleRightText, titleIcon);
            await UpdateScale();

            scale.CallFunction("DISPLAY_VIEW");
        }
示例#17
0
        public UIManager()
        {
            var bounds = Game.ScreenResolution;

            notifyTimer           = new Timer(5000);
            killInfoTimer         = new Timer(4500);
            scaleformDisplayTimer = new Timer(4000);
            scaleformFadeTimer    = new Timer(2000);
            scaleform             = new Scaleform(Function.Call <int>(Hash.REQUEST_SCALEFORM_MOVIE, "MP_BIG_MESSAGE_FREEMODE"));
            killInfoUI            = new UIBox(new Point(bounds.Width / 2 - (bounds.Width / 2) / 2 + 200, (Game.ScreenResolution.Height - 40) - (Game.ScreenResolution.Height / 10)), new Size(200, 60));
            centerText            = new UIText(null, new Point(bounds.Width / 2 - (bounds.Width / 2) / 2, UI.HEIGHT - 38), 0.70f, Color.White, Font.ChaletComprimeCologne, true);
            teamInfoHUD           = new UIContainer(new Point((int)0.00115f * Game.ScreenResolution.Width + 960, UI.HEIGHT / 6 - 20), new Size(180, Config.MaxTeams * 31), Color.FromArgb(180, Color.Black));
            SetupTeamInfoHUD(Config.MaxTeams);
            _hudAssets[0] = new HUDAsset()
            {
                ActiveAsset = @"scripts\AirSuperiority\hud\fireext\1.png", InactiveAsset = @"scripts\AirSuperiority\hud\fireext\2.png"
            };
            _hudAssets[1] = new HUDAsset()
            {
                ActiveAsset = @"scripts\AirSuperiority\hud\irflares\1.png", InactiveAsset = @"scripts\AirSuperiority\hud\irflares\2.png"
            };
            _hudAssets[2] = new HUDAsset()
            {
                ActiveAsset = @"scripts\AirSuperiority\hud\rdrjam\1.png", InactiveAsset = @"scripts\AirSuperiority\hud\rdrjam\2.png"
            };
            _activeHudAssets = _hudAssets.Select(x => x.ActiveAsset).ToArray();
            SetHUDIcon(2, false);
            rankBar.RankedUp += RankBar_RankedUp;
            Tick             += OnTick;
        }
 private static void ShowOrganizationUpdateEffect(string message)
 {
     organizationUpdateScaleform        = new Scaleform("MP_BIG_MESSAGE_FREEMODE");
     organizationUpdateScaleformMessage = message;
     organizationUpdateScaleformTime    = 100;
     Screen.Effects.Start(ScreenEffect.HeistCelebPass, 2000);
     Audio.ReleaseSound(Audio.PlaySoundFrontend("PROPERTY_PURCHASE", "HUD_AWARDS"));
 }
示例#19
0
 public TextureRenderer(Scaleform scaleform, int id, Vector3 position, Vector3 rotation, Vector3 scale)
 {
     this.scaleform = scaleform;
     this.Id        = id;
     this.Position  = position;
     this.Rotation  = rotation;
     this.Scale     = scale;
 }
示例#20
0
 /// <summary>
 /// W
 /// </summary>
 /// <remarks>
 /// indicator_left, indicator_right, handbrakeLight, engineLight, ABSLight, petrolLight, oilLight, headlights, fullBeam, batteryLight, shiftLight1, shiftLight2, shiftLight3, shiftLight4, shiftLight5
 /// </remarks>
 /// <param name="dashboardSf">A dashboard scaleform</param>
 public static void DashboardSetLights(Scaleform dashboardSf,
                                       int indL, int indR, int handbrake, int engine, int abs, int petrol, int oil, int headlights, int fullbeam,
                                       int batteryLight, int shiftLight1, int shiftLight2, int shiftLight3, int shiftLight4, int shiftLight5)
 {
     dashboardSf.CallFunction("SET_DASHBOARD_LIGHTS",
                              indL, indR, handbrake, engine, abs, petrol, oil, headlights, fullbeam,
                              batteryLight, shiftLight1, shiftLight2, shiftLight3, shiftLight4, shiftLight5);
 }
示例#21
0
        public void Dispose()
        {
            var h = _sc.Handle;

            SetScaleformMovieAsNoLongerNeeded(ref h);
            _sc.Dispose();
            _sc = null;
        }
示例#22
0
文件: DropOff.cs 项目: d0p3t/DopeCore
        internal DropOff()
        {
            _dropOffMarkerScaleform   = new Scaleform("mp_mission_name_freemode");
            _dropOffProgressScaleform = new Scaleform("mission_complete");

            Tick += OnTick;
            Tick += OnMissionScaleFormTick;
            Tick += OnMarkerTick;
        }
示例#23
0
 public static void AtmDisplayTransactions(Scaleform atmScaleform)
 {
     atmScaleform.CallFunction("CLEAR_ALL");
     atmScaleform.CallFunction("SET_DATA_SLOT", 0);
     BeginTextCommand("MPATM_LOG");
     atmScaleform.CallFunction("SET_DATA_SLOT", 1);
     BeginTextCommand("MPATM_BACK");
     atmScaleform.CallFunction("DISPLAY_TRANSACTIONS");
 }
示例#24
0
 /// <summary>
 /// Works, no ticker moving
 /// </summary>
 /// <returns></returns>
 public static void NewsTickerSetText(Scaleform newsScaleform, string title, string subtitle,
                                      string scrollTxt, float scrollSpeed = 0)
 {
     newsScaleform.CallFunction("SET_TEXT", title, subtitle);
     newsScaleform.CallFunction("SET_SCROLL_TEXT", 0f, 0f, scrollTxt);
     newsScaleform.CallFunction("SET_SCROLL_TEXT", 0f, 1f, scrollTxt);
     newsScaleform.CallFunction("SET_SCROLL_TEXT", 0f, 2f, scrollTxt);
     newsScaleform.CallFunction("SET_SCROLL_TEXT", 0f, 3f, scrollTxt);
 }
示例#25
0
 public DriftHUD()
 {
     this.Tick += OnTick;
     this._scaleformDisplayTimer = new Timer(1200);
     this._scaleformFadeTimer = new Timer(2000);
     this._msgTimer = new Timer(5000);
     this._scaleform = new Scaleform(Function.Call<int>(Hash.REQUEST_SCALEFORM_MOVIE, "MP_BIG_MESSAGE_FREEMODE"));
     Config.LoadUserConfig(out UserSettings);
 }
示例#26
0
        private static Scaleform RequestScaleform(string scaleformId)
        {
            var sf = new Scaleform(scaleformId);

            while (!sf.IsLoaded)
            {
                Invoker.Wait(0);
            }
            return(sf);
        }
示例#27
0
        public void ClosePlayerList()
        {
            if (cardScaleform != null)
            {
                cardScaleform.Dispose();
                cardScaleform = null;
            }

            Audio.PlaySoundFrontend("CLOSE_SOUND_NAME");
        }
示例#28
0
        private async void LoadATMScaleform()
        {
            scaleform = await LoadScaleform(scaleformID);

            if (scaleform != null)
            {
                HandleMouseSelection(0);
                Tick += ATMTick;
            }
        }
示例#29
0
        public void DrawDeadMessage()
        {
            if (IsDead)
            {
                float x      = Screen.Width / 2;
                float y      = Screen.Height / 2;
                float width  = 350;
                float height = 120;
                //DrawRect(x - (width / 2), y - (height / 2), width, height, 255, 0, 0, 255);

                Scaleform buttons2 = new Scaleform("mp_big_message_freemode");
                //buttons2.CallFunction("CLEAR_ALL");
                //buttons2.CallFunction("UPDATE_MESSAGE", "Hello ~INPUT_RELOAD~");
                buttons2.CallFunction("SHOW_SHARD_WASTED_MP_MESSAGE", "~r~You died!", "Better luck next time");
                //buttons2.CallFunction("ROLL_UP_BACKGROUND");
                buttons2.Render2D();

                /*Rectangle rect = new Rectangle(new PointF(x - (width / 2), y - (height / 2)), new SizeF(width, height), Color.FromArgb(175, 0, 0, 0));
                 * rect.Draw();
                 *
                 * Text text = new Text("You died!", new PointF(x, rect.Position.Y + 15f), 1.0f);
                 * text.Alignment = Alignment.Center;
                 * text.WrapWidth = width;
                 * //Debug.WriteLine("WrapWidth:{0} - {1}", text.Width, (x - (text.Width)));
                 * //text.Position.X = x - (text.WrapWidth / 2);
                 * //text.Caption = "You died!";
                 * text.Draw();
                 *
                 * string btn = GetControlInstructionalButton(0, (int)Control.Reload, true);
                 * Text restartText = new Text(string.Format("Press {0} to restart!", btn), new PointF(x, rect.Position.Y + height - 50f), .5f);
                 * restartText.Alignment = Alignment.Center;
                 * restartText.WrapWidth = width;
                 * restartText.Draw();*/

                Scaleform buttons = new Scaleform("instructional_buttons");
                buttons.CallFunction("CLEAR_ALL");
                buttons.CallFunction("TOGGLE_MOUSE_BUTTONS", 0);
                buttons.CallFunction("CREATE_CONTAINER");
                buttons.CallFunction("SET_DATA_SLOT", 0, Function.Call <string>((Hash)0x0499D7B09FC9B407, 2, (int)Control.Reload, 0), "Restart");
                buttons.CallFunction("DRAW_INSTRUCTIONAL_BUTTONS", 1);
                buttons.Render2D();

                Screen.Hud.CursorSprite = CursorSprite.MiddleFinger;
                Screen.Hud.ShowCursorThisFrame();

                if (!RanDeathAnimation && PlayerSpawned)
                {
                    Scaleform minimap = new Scaleform("minimap");
                    minimap.Render2D();
                    Debug.WriteLine("DEATH FAIL OUT");
                    RanDeathAnimation = true;
                    Screen.Effects.Start(ScreenEffect.DeathFailOut, 0, true);
                }
            }
        }
        public static async void AddPage(VehicleCard[] vehicles, Scaleform scaleformHandle, int startIndex)
        {
            var i = 0;

            foreach (VehicleCard vc in vehicles)
            {
                await AddVehicle(vc, scaleformHandle, startIndex + i);

                i++;
            }
        }
示例#31
0
        private async Task <Scaleform> LoadScaleform(string id)
        {
            Scaleform scaleform = new Scaleform(id);

            while (!scaleform.IsLoaded)
            {
                RequestScaleformMovieInteractive(id);
                await Delay(0);
            }
            return(scaleform);
        }
示例#32
0
        private async void CloseATM()
        {
            isUsingATM = false;
            int scaleformHandle = scaleform.Handle;

            SetScaleformMovieAsNoLongerNeeded(ref scaleformHandle);
            scaleform = null;
            Tick     -= ATMTick;

            ClearPedTasks(Game.PlayerPed.Handle);
        }
示例#33
0
        public ClassicChat()
        {
            CurrentInput   = "";
            _mainScaleform = new Scaleform("multiplayer_chat");
            _messages      = new List <Tuple <string, Color> >();


            _inputboxRectangle       = new UIResRectangle(new Point(20, 280), new Size(600, 35), Color.FromArgb(150, 60, 60, 60));
            _inputboxBorderRectangle = new UIResRectangle(new Point(20 - borderWidth, 280 - borderWidth), new Size(600 + borderWidth * 2, 35 + borderWidth * 2), Color.FromArgb(200, 0, 0, 0));
            _inputboxText            = new UIResText("", new Point(24, 282), 0.45f, Color.White);
        }
示例#34
0
        public VehicleDial()
        {
            _ply = RAGE.Elements.Player.LocalPlayer;

            if (ScriptEnabled)
            {
                _dashBoard = ScaleformHelper.Dashboard();

                Events.Tick += OnTick;
            }
        }
示例#35
0
        public Chatbox(Main Main)
            : base(new Point(10, 10), new Size(400, 160), Color.FromArgb(0, 0, 0, 0))
        {
            this.Main = Main;

            int x = 5;
            int y = 5;
            for(int index = 0; index < 10; index++) {
                Items.Add(new UIText("", new Point(x, y), 0.3f));
                y += 15;
            }

            ScaleForm = new Scaleform(0);
            ScaleForm.Load("multiplayer_chat");

            ScaleForm.CallFunction("SET_FOCUS", 2, 2, "ALL");
            ScaleForm.CallFunction("SET_FOCUS", 1, 2, "ALL");
        }
示例#36
0
 public void Dispose()
 {
     Function.Call(Hash.SET_SCALEFORM_MOVIE_AS_NO_LONGER_NEEDED, new OutputArgument(_sc.Handle));
     _sc = null;
 }
示例#37
0
文件: TabView.cs 项目: Guad/NativeUI
        public void ShowInstructionalButtons()
        {
            if (_sc == null)
            {
                _sc = new Scaleform(0);
                _sc.Load("instructional_buttons");
            }

            _sc.CallFunction("CLEAR_ALL");
            _sc.CallFunction("TOGGLE_MOUSE_BUTTONS", 0);
            _sc.CallFunction("CREATE_CONTAINER");

            _sc.CallFunction("SET_DATA_SLOT", 0, Function.Call<string>(Hash._0x0499D7B09FC9B407, 2, (int)Control.PhoneSelect, 0), "Select");
            _sc.CallFunction("SET_DATA_SLOT", 1, Function.Call<string>(Hash._0x0499D7B09FC9B407, 2, (int)Control.PhoneCancel, 0), "Back");

            _sc.CallFunction("SET_DATA_SLOT", 2, Function.Call<string>(Hash._0x0499D7B09FC9B407, 2, (int)Control.FrontendRb, 0), "");
            _sc.CallFunction("SET_DATA_SLOT", 3, Function.Call<string>(Hash._0x0499D7B09FC9B407, 2, (int)Control.FrontendLb, 0), "Browse");
        }
示例#38
0
        public void Draw()
        {
            if (!Visible) return;

            SizeF res = UIMenu.GetScreenResolutionMantainRatio();
            int middle = Convert.ToInt32(res.Width/2);

            new Sprite("mpentry", "mp_modenotselected_gradient", new Point(0, 10), new Size(Convert.ToInt32(res.Width), 450 + (_items.Count*40)),
                0f, Color.FromArgb(200, 255, 255, 255)).Draw();

            new UIResText("mission passed", new Point(middle, 100), 2.5f, Color.FromArgb(255, 199, 168, 87), Font.Pricedown, UIResText.Alignment.Centered).Draw();

            new UIResText(Title, new Point(middle, 230), 0.5f, Color.White, Font.ChaletLondon, UIResText.Alignment.Centered).Draw();

            new UIResRectangle(new Point(middle - 300, 290), new Size(600, 2), Color.White).Draw();

            for (int i = 0; i < _items.Count; i++)
            {
                new UIResText(_items[i].Item1, new Point(middle - 230, 300 + (40*i)), 0.35f, Color.White, Font.ChaletLondon, UIResText.Alignment.Left).Draw();
                new UIResText(_items[i].Item2, new Point(_items[i].Item3 == TickboxState.None ? middle + 265 : middle + 230, 300 + (40*i)), 0.35f, Color.White, Font.ChaletLondon, UIResText.Alignment.Right).Draw();
                if (_items[i].Item3 == TickboxState.None) continue;
                string spriteName = "shop_box_blank";
                switch (_items[i].Item3)
                {
                    case TickboxState.Tick:
                        spriteName = "shop_box_tick";
                        break;
                    case TickboxState.Cross:
                        spriteName = "shop_box_cross";
                        break;
                }
                new Sprite("commonmenu", spriteName, new Point(middle + 230, 290 + (40*i)), new Size(48, 48)).Draw();
            }
            new UIResRectangle(new Point(middle - 300, 300 + (40 * _items.Count)), new Size(600, 2), Color.White).Draw();

            new UIResText("Completion", new Point(middle - 150, 320 + (40 * _items.Count)), 0.4f).Draw();
            new UIResText(_completionRate + "%", new Point(middle + 150, 320 + (40 * _items.Count)), 0.4f, Color.White, Font.ChaletLondon, UIResText.Alignment.Right).Draw();

            string medalSprite = "bronzemedal";
            switch (_medal)
            {
                case Medal.Silver:
                    medalSprite = "silvermedal";
                    break;
                case Medal.Gold:
                    medalSprite = "goldmedal";
                    break;
            }

            new Sprite("mpmissionend", medalSprite, new Point(middle + 150, 320 + (40 * _items.Count)), new Size(32, 32)).Draw();

            var scaleform = new Scaleform(0);
            scaleform.Load("instructional_buttons");
            scaleform.CallFunction("CLEAR_ALL");
            scaleform.CallFunction("TOGGLE_MOUSE_BUTTONS", 0);
            scaleform.CallFunction("CREATE_CONTAINER");

            scaleform.CallFunction("SET_DATA_SLOT", 0, Function.Call<string>(Hash._0x0499D7B09FC9B407, 2, (int)Control.FrontendAccept, 0), "Continue");
            scaleform.CallFunction("DRAW_INSTRUCTIONAL_BUTTONS", -1);
            scaleform.Render2D();
            if (Game.IsControlJustPressed(0, Control.FrontendAccept))
            {
                Game.PlaySound("SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET");
                ContinueHit();
            }
        }
示例#39
0
	    public void OnTick(object sender, EventArgs e)
	    {
		    if (DateTime.Now.Second != _lasttime.Second)
		    {
			    _seconds++;
			    _lasttime = DateTime.Now;
			    if (_isInRace && _countdown > 0)
			    {
				    var screen = UIMenu.GetScreenResolutionMantainRatio();
				    var w = Convert.ToInt32(screen.Width/2);
				    _countdown--;
					if(_countdown > 3) return;
				    _fadeoutSprite = new Sprite("mpinventory", "in_world_circle", new Point(w - 125, 200), new Size(250, 250), 0f, _countdown == 0 ? Color.FromArgb(49, 235, 126) : Color.FromArgb(241, 247, 57));
					Function.Call(Hash.REQUEST_SCRIPT_AUDIO_BANK, "HUD_MINI_GAME_SOUNDSET", true);
					Function.Call(Hash.PLAY_SOUND_FRONTEND, 0, "CHECKPOINT_NORMAL", "HUD_MINI_GAME_SOUNDSET");
					if (_countdown == 0)
				    {
					    _participants.ForEach(car => car.FreezePosition = false);
					    _missionStart = _seconds;
				    }
			    }
				else if (_isInRace && _countdown == 0)
				{
					_countdown = -1;
				}
		    }

			GUI.MainMenu.ProcessControl();
			GUI.MainMenu.ProcessMouse();
			GUI.MainMenu.Draw();

			_quitMenu.ProcessControl();
			_quitMenu.ProcessMouse();
			_quitMenu.Draw();

			GUI.DrawSettings(_previewRace, _previewVehicle);

			_passed?.Draw();

			if (_countdown > -1 && _countdown <= 3)
		    {
				var screen = UIMenu.GetScreenResolutionMantainRatio();
				var w = Convert.ToInt32(screen.Width / 2);
				new UIResText(_countdown == 0 ? "GO" : _countdown.ToString(), new Point(w, 260), 2f, Color.White, Font.Pricedown, UIResText.Alignment.Centered).Draw();
		    }

		    if (_fadeoutSprite?.Color.A > 5)
		    {
			    _fadeoutSprite.Color = Color.FromArgb(_fadeoutSprite.Color.A - 5, _fadeoutSprite.Color.R, _fadeoutSprite.Color.G,
				    _fadeoutSprite.Color.B);
				_fadeoutSprite.Draw();
		    }


            /* COURIER */
            GUICourier.Init();
            GUICourier.MainMenu.ProcessControl();
            GUICourier.MainMenu.ProcessMouse();
            var safe = UIMenu.GetSafezoneBounds();
            var res = UIMenu.GetScreenResolutionMantainRatio();

            new UIResRectangle(new Point(((int)res.Width-200), 0), new Size(200, 400), Color.FromArgb(200,0,0,0)).Draw();

            GUICourier.MainMenu.Draw();

            if (activeDeliveries.Count == 0 || (_seconds - lastSpawn > 60 && activeDeliveries.Count < 3))
            {
                Delivery d = Delivery.CreateDelivery();
                d.activate();
                activeDeliveries.Add(d);
                lastSpawn = _seconds;
                UI.Notify("New delivery available");
            }

            int pick = 0,drop = 0;
            Vector3 me = Game.Player.Character.Position;
            String posStr = String.Format("{0} {1} {2}", me.X.ToString("F02"), me.Y.ToString("F02"), me.Z.ToString("F02"));


            new UIResText("Pickup", new Point(Convert.ToInt32(res.Width) - 190, 20), .45f, Color.White, Font.HouseScript, UIResText.Alignment.Left) { DropShadow = true }.Draw();
            new UIResText("Dropoff", new Point(Convert.ToInt32(res.Width) - 190, 210), .45f, Color.White, Font.HouseScript, UIResText.Alignment.Left) { DropShadow = true }.Draw();
            foreach (Delivery d in activeDeliveries.GetRange(0,activeDeliveries.Count)) {
                d.tick();
                if (d.isActive == false)
                {
                    activeDeliveries.Remove(d);
                    continue;
                }

 
                if (d._isStarted)
                {
                    float dist = me.DistanceTo(d.end);
                    String posStr2 = String.Format("{0} {1} {2}", d.end.X.ToString("F02"), d.end.Y.ToString("F02"), d.end.Z.ToString("F02"));
                    new UIResText(String.Format("{0} {1}", dist.ToString("F02"), d.end_text), new Point(Convert.ToInt32(res.Width) - 190, 20 * (drop + 2) + 210), .35f, Color.White, Font.ChaletComprimeCologne, UIResText.Alignment.Left) { DropShadow = true }.Draw();

                    drop++;
                }
                else {
                    float dist = me.DistanceTo(d.start);
                    String posStr2 = String.Format("{0} {1} {2}", d.start.X.ToString("F02"), d.start.Y.ToString("F02"), d.start.Z.ToString("F02"));
                    new UIResText(String.Format("{0} {1}", dist.ToString("F02"), d.start_text), new Point(Convert.ToInt32(res.Width) - 190, 20 * (pick + 2)), .35f, Color.White, Font.ChaletComprimeCologne, UIResText.Alignment.Left) { DropShadow = true }.Draw();

                    pick++;
                }
                //new UIResText("WORLD", new Point(Convert.ToInt32(res.Width) - 190, 40), .35f, Color.DodgerBlue, Font.ChaletComprimeCologne, UIResText.Alignment.Left) { DropShadow = true }.Draw();

            }
            /* COURIER */

            if (!_isInRace)
		    {
				if(GUI.IsInMenu) return;
			    foreach (var race in _races)
			    {
				    World.DrawMarker(MarkerType.VerticalCylinder, race.Trigger, new Vector3(0, 0, 0), new Vector3(0, 0, 0), new Vector3(5f, 5f, 1f), Color.FromArgb(200, 255, 255, 255));
					if(!Game.Player.Character.IsInRangeOf(race.Trigger, 50f)) continue;
				    var tmpSF = new Scaleform(0);
				    tmpSF.Load("PLAYER_NAME_01");
					tmpSF.CallFunction("SET_PLAYER_NAME", race.Name);
				    
					tmpSF.Render3D(race.Trigger + new Vector3(0f, 0f, 2f), new Vector3(0f, 0f, _oldAngle), new Vector3(12, 6, 2));

					var tmpT = new Scaleform(0);
					tmpT.Load("PLAYER_NAME_02");
					tmpT.CallFunction("SET_PLAYER_NAME", "Community Race");

					tmpT.Render3D(race.Trigger + new Vector3(0f, 0f, 1.5f), new Vector3(0f, 0f, _oldAngle), new Vector3(6, 3, 1));

					_oldAngle += 2f;

                    if (!Game.Player.Character.IsInRangeOf(race.Trigger, 5f)) continue;

                    Function.Call(Hash._SET_TEXT_COMPONENT_FORMAT, "STRING");
                    Function.Call(Hash._ADD_TEXT_COMPONENT_STRING, "Press ~INPUT_CONTEXT~ to participate in this Community Race.");
                    Function.Call(Hash._0x238FFE5C7B0498A6, 0, 0, 1, -1);

                    if (Game.IsControlJustPressed(0, GTA.Control.Context))
				    {
					    Game.Player.CanControlCharacter = false;
					    Game.Player.Character.Position = race.Trigger + new Vector3(4f, 0f, -1f);
					    _previewRace = race;
						BuildMenu(race);
					    GUI.MainMenu.Visible = true;
					    GUI.IsInMenu = true;
					    break;
				    }
			    }
				
		    }
		    else if(_isInRace)
		    {
				if(!_raceSettings["Wanted"])
					Function.Call(Hash.SET_MAX_WANTED_LEVEL, 0);
				//if(Game.Player.Character.IsInVehicle())
				Function.Call(Hash.DISABLE_CONTROL_ACTION, 0, (int)GTA.Control.VehicleExit);
			    if ((Game.IsControlJustPressed(0, GTA.Control.VehicleExit) && Game.Player.Character.IsInVehicle()) || (!Game.Player.Character.IsInVehicle() && !Game.Player.Character.IsGettingIntoAVehicle && Game.IsControlJustPressed(0, GTA.Control.Enter)))
			    {
					_quitMenu.RefreshIndex();
				    _quitMenu.Visible = !_quitMenu.Visible;
			    }
				
			    if (!Convert.ToBoolean(_raceSettings["Traffic"]))
			    {
				    Vehicle[] close = World.GetNearbyVehicles(Game.Player.Character, 10000f);
				    foreach (Vehicle vehicle in close)
				    {
					    if (_currentRivals.Any(riv => riv.Vehicle.Handle == vehicle.Handle) ||
					        Game.Player.Character.IsInVehicle(vehicle)) continue;
						vehicle.GetPedOnSeat(VehicleSeat.Driver)?.Delete();
						vehicle?.Delete();
				    }
			    }

			//    var res = UIMenu.GetScreenResolutionMantainRatio();
			//    var safe = UIMenu.GetSafezoneBounds();
			    const int interval = 45;
			    if (_countdown <= 0)
			    {
				    new UIResText("TIME",new Point(Convert.ToInt32(res.Width) - safe.X - 180, Convert.ToInt32(res.Height) - safe.Y - (90 + (1*interval))),0.3f, Color.White).Draw();
				    new UIResText(FormatTime((int) unchecked(_seconds - _missionStart)),new Point(Convert.ToInt32(res.Width) - safe.X - 20, Convert.ToInt32(res.Height) - safe.Y - (102 + (1*interval))),0.5f, Color.White, Font.ChaletLondon, UIResText.Alignment.Right).Draw();
				    new Sprite("timerbars", "all_black_bg",new Point(Convert.ToInt32(res.Width) - safe.X - 248,Convert.ToInt32(res.Height) - safe.Y - (100 + (1*interval))), new Size(250, 37), 0f, Color.FromArgb(200, 255, 255, 255)).Draw();

					new UIResText("POSITION", new Point(Convert.ToInt32(res.Width) - safe.X - 180, Convert.ToInt32(res.Height) - safe.Y - (90 + (2 * interval))), 0.3f, Color.White).Draw();
					new UIResText((CalculatePlayerPositionInRace() + 1) + "/" + (_currentRivals.Count + 1), new Point(Convert.ToInt32(res.Width) - safe.X - 20, Convert.ToInt32(res.Height) - safe.Y - (102 + (2 * interval))), 0.5f, Color.White, Font.ChaletLondon, UIResText.Alignment.Right).Draw();
					new Sprite("timerbars", "all_black_bg", new Point(Convert.ToInt32(res.Width) - safe.X - 248, Convert.ToInt32(res.Height) - safe.Y - (100 + (2 * interval))), new Size(250, 37), 0f, Color.FromArgb(200, 255, 255, 255)).Draw();

				    if (_raceSettings["Laps"] > 1)
				    {
						int playerCheckpoint = _currentRace.Checkpoints.Length - _checkpoints.Count;
					    int currentLap = Convert.ToInt32(Math.Floor(playerCheckpoint/(decimal)_totalLaps)) + 1;

						new UIResText("LAP",new Point(Convert.ToInt32(res.Width) - safe.X - 180,Convert.ToInt32(res.Height) - safe.Y - (90 + (3*interval))), 0.3f, Color.White).Draw();
					    new UIResText(currentLap + "/" + _raceSettings["Laps"], new Point(Convert.ToInt32(res.Width) - safe.X - 20,Convert.ToInt32(res.Height) - safe.Y - (102 + (3*interval))), 0.5f, Color.White, Font.ChaletLondon,UIResText.Alignment.Right).Draw();
					    new Sprite("timerbars", "all_black_bg",new Point(Convert.ToInt32(res.Width) - safe.X - 248,Convert.ToInt32(res.Height) - safe.Y - (100 + (3*interval))), new Size(250, 37), 0f,Color.FromArgb(200, 255, 255, 255)).Draw();
				    }
			    }


			    for (int i = 0; i < _rivalCheckpointStatus.Count; i++)
			    {
				    Tuple<Rival, int> tuple = _rivalCheckpointStatus[i];
				    if (tuple.Item1.Vehicle.IsInRangeOf(_currentRace.Checkpoints[tuple.Item2], 10f))
				    {
					    tuple.Item1.Character.Task.ClearAll();
					    if (_currentRace.Checkpoints.Length <= tuple.Item2 + 1)
					    {
						    if (!_finishedParticipants.Contains(tuple.Item1))
							    _finishedParticipants.Add(tuple.Item1);
						    tuple.Item1.Vehicle.HandbrakeOn = true;
						    continue;
					    }
					    _rivalCheckpointStatus[i] = new Tuple<Rival, int>(tuple.Item1,tuple.Item2 + 1);
					    Function.Call(Hash.TASK_VEHICLE_MISSION_COORS_TARGET, tuple.Item1.Character.Handle, tuple.Item1.Vehicle.Handle,
						    _currentRace.Checkpoints[tuple.Item2 + 1].X, _currentRace.Checkpoints[tuple.Item2 + 1].Y,
						    _currentRace.Checkpoints[tuple.Item2 + 1].Z, Mode, 200f, Rival.MainDrivingStyle, 5f, 0f, 0); // TODO: Debuggin // old - 6
				    }
			    }


			    World.DrawMarker(MarkerType.VerticalCylinder, _checkpoints[0], new Vector3(0, 0, 0), new Vector3(0, 0, 0), new Vector3(10f, 10f, 2f), Color.FromArgb(100, 241, 247, 57));
			    if (_nextBlip == null)
				    _nextBlip = World.CreateBlip(_checkpoints[0]);
			    if (_checkpoints.Count >= 2)
			    {
				    if (_secondBlip == null)
				    {
					    _secondBlip = World.CreateBlip(_checkpoints[1]);
					    _secondBlip.Scale = 0.5f;
						if(_checkpoints.Count == 2)
							_secondBlip.Sprite = BlipSprite.RaceFinish;
				    }
				    Vector3 dir = _checkpoints[1] - _checkpoints[0];
					dir.Normalize();
					World.DrawMarker(MarkerType.ChevronUpx1, _checkpoints[0] + new Vector3(0f, 0f, 2f), dir, new Vector3(60f, 0f, 0f), new Vector3(4f, 4f, 4f), Color.FromArgb(200, 87, 193, 250));
			    }
			    else
			    {
					Vector3 dir = Game.Player.Character.Position - _checkpoints[0];
					dir.Normalize();
				    World.DrawMarker(MarkerType.CheckeredFlagRect, _checkpoints[0] + new Vector3(0f, 0f, 2f), dir, new Vector3(0f, 0f, 0f), new Vector3(4f, 4f, 4f), Color.FromArgb(200, 87, 193, 250));
					_nextBlip.Sprite = BlipSprite.RaceFinish;
			    }

			    if (Game.Player.Character.IsInVehicle() && Game.Player.Character.IsInRangeOf(_checkpoints[0], 10f))
			    {
					Function.Call(Hash.REQUEST_SCRIPT_AUDIO_BANK, "HUD_MINI_GAME_SOUNDSET", true);
					Function.Call(Hash.PLAY_SOUND_FRONTEND, 0, "CHECKPOINT_NORMAL", "HUD_MINI_GAME_SOUNDSET");
					_checkpoints.RemoveAt(0);
					_nextBlip?.Remove();
					_secondBlip?.Remove();
				    _nextBlip = null;
				    _secondBlip = null;
				    if (_checkpoints.Count == 0)
				    {
					    Game.Player.CanControlCharacter = false;
						Function.Call(Hash._START_SCREEN_EFFECT, "HeistCelebPass", 0, true);
						if(Game.Player.Character.IsInVehicle())
							Game.Player.Character.CurrentVehicle.HandbrakeOn = true;
						World.DestroyAllCameras();
					    World.RenderingCamera = World.CreateCamera(GameplayCamera.Position, GameplayCamera.Rotation, 60f);
						Function.Call(Hash.PLAY_SOUND_FRONTEND, 0, "CHECKPOINT_UNDER_THE_BRIDGE", "HUD_MINI_GAME_SOUNDSET");
						int position = _finishedParticipants.Count + 1;
					    int peoplecount = _currentRivals.Count + 1;
					    int score = 100 - ((position - 1)*10);
					    if (score < 0)
						    score = 0;
						_passed = new MissionPassedScreen(_currentRace.Name, score, score > 50 ? score > 90 ? MissionPassedScreen.Medal.Gold : MissionPassedScreen.Medal.Silver : MissionPassedScreen.Medal.Bronze);
						_passed.AddItem("Time Elapsed", FormatTime((int)unchecked(_seconds - _missionStart)), MissionPassedScreen.TickboxState.None);
						_passed.AddItem("Position", position + "/" + peoplecount, position == 1 ? MissionPassedScreen.TickboxState.Tick : MissionPassedScreen.TickboxState.Empty);
					    _passed.OnContinueHit += () =>
					    {
							Game.FadeScreenOut(1000);
							Wait(1000);
							Function.Call(Hash._STOP_SCREEN_EFFECT, "HeistCelebPass");
						    Game.Player.Character.Position = _currentRace.Trigger;
						    Game.Player.CanControlCharacter = true;
						    World.RenderingCamera = null;
							EndRace();
						    _passed = null;
							Game.FadeScreenIn(1500);
					    };
						_passed.Show();
						_isInRace = false;
				    }
			    }
			}
	    }
示例#40
0
文件: Chat.cs 项目: butich/GTACoop
 public Chat()
 {
     CurrentInput = "";
     _mainScaleform = new Scaleform(0);
     _mainScaleform.Load("multiplayer_chat");
 }
示例#41
0
文件: GUI.cs 项目: Guad/NOOSE
        public static void DrawScaleform()
        {
            var scaleform = new Scaleform(0);
            scaleform.Load("instructional_buttons");
            scaleform.CallFunction("CLEAR_ALL");
            scaleform.CallFunction("TOGGLE_MOUSE_BUTTONS", 0);
            scaleform.CallFunction("CREATE_CONTAINER");

            scaleform.CallFunction("SET_DATA_SLOT", 0, Function.Call<string>(Hash._0x0499D7B09FC9B407, 2, (int)Control.Jump, 0), "Begin Assault");
            scaleform.CallFunction("SET_DATA_SLOT", 1, Function.Call<string>(Hash._0x0499D7B09FC9B407, 2, (int)Control.FrontendCancel, 0), "Cancel");
            scaleform.CallFunction("SET_DATA_SLOT", 2, Function.Call<string>(Hash._0x0499D7B09FC9B407, 2, (int)Control.PhoneRight, 0), "");
            scaleform.CallFunction("SET_DATA_SLOT", 3, Function.Call<string>(Hash._0x0499D7B09FC9B407, 2, (int)Control.PhoneLeft, 0), "Change Mission");
            scaleform.CallFunction("SET_DATA_SLOT", 4, Function.Call<string>(Hash._0x0499D7B09FC9B407, 2, (int)Control.FrontendRb, 0), "");
            scaleform.CallFunction("SET_DATA_SLOT", 5, Function.Call<string>(Hash._0x0499D7B09FC9B407, 2, (int)Control.FrontendLb, 0), "Change Entry Point");
            scaleform.CallFunction("DRAW_INSTRUCTIONAL_BUTTONS", -1);
            scaleform.Render2D();
        }
示例#42
0
        public MapEditor()
        {
            Tick += OnTick;
            KeyDown += OnKeyDown;

            if (!Directory.Exists("scripts\\MapEditor"))
                Directory.CreateDirectory("scripts\\MapEditor");

            ObjectDatabase.SetupRelationships();
            LoadSettings();

            try
            {
                Translation.Load("scripts\\MapEditor", _settings.Translation);
            }
            catch (Exception e)
            {
                UI.Notify("~b~~h~Map Editor~h~~w~~n~Failed to load translations. Falling back to English.");
                UI.Notify(e.Message);
            }

            _scaleform = new Scaleform(0);
            _scaleform.Load("instructional_buttons");

            _objectInfoMenu = new UIMenu("", "~b~" + Translation.Translate("PROPERTIES"), new Point(0, -107));
            _objectInfoMenu.ResetKey(UIMenu.MenuControls.Back);
            _objectInfoMenu.DisableInstructionalButtons(true);
            _objectInfoMenu.SetBannerType(new UIResRectangle(new Point(), new Size()));
            _menuPool.Add(_objectInfoMenu);

            ModManager.InitMenu();

            _objectsMenu = new UIMenu("Map Editor", "~b~" + Translation.Translate("PLACE OBJECT"));

            ObjectDatabase.LoadFromFile("scripts\\ObjectList.ini", ref ObjectDatabase.MainDb);
            ObjectDatabase.LoadInvalidHashes();
            ObjectDatabase.LoadFromFile("scripts\\PedList.ini", ref ObjectDatabase.PedDb);
            ObjectDatabase.LoadFromFile("scripts\\VehicleList.ini", ref ObjectDatabase.VehicleDb);

            _crosshairPath = Path.GetFullPath("scripts\\MapEditor\\crosshair.png");
            _crosshairBluePath = Path.GetFullPath("scripts\\MapEditor\\crosshair_blue.png");
            _crosshairYellowPath = Path.GetFullPath("scripts\\MapEditor\\crosshair_yellow.png");

            if (!File.Exists("scripts\\MapEditor\\crosshair.png"))
                _crosshairPath = Sprite.WriteFileFromResources(Assembly.GetExecutingAssembly(), "MapEditor.crosshair.png", "scripts\\MapEditor\\crosshair.png");
            if (!File.Exists("scripts\\MapEditor\\crosshair_blue.png"))
                _crosshairBluePath = Sprite.WriteFileFromResources(Assembly.GetExecutingAssembly(), "MapEditor.crosshair_blue.png", "scripts\\MapEditor\\crosshair_blue.png");
            if (!File.Exists("scripts\\MapEditor\\crosshair_yellow.png"))
                _crosshairYellowPath = Sprite.WriteFileFromResources(Assembly.GetExecutingAssembly(), "MapEditor.crosshair_yellow.png", "scripts\\MapEditor\\crosshair_yellow.png");

            RedrawObjectsMenu();
            _objectsMenu.OnItemSelect += OnObjectSelect;
            _objectsMenu.OnIndexChange += OnIndexChange;
            _menuPool.Add(_objectsMenu);

            _objectsMenu.ResetKey(UIMenu.MenuControls.Back);
            _objectsMenu.AddInstructionalButton(new InstructionalButton(Control.SelectWeapon, Translation.Translate("Change Axis")));
            _objectsMenu.AddInstructionalButton(new InstructionalButton(Control.MoveUpDown, Translation.Translate("Zoom")));
            _objectsMenu.AddInstructionalButton(new InstructionalButton(Control.Jump, Translation.Translate("Search")));

            _searchMenu = new UIMenu("Map Editor", "~b~" + Translation.Translate("PLACE OBJECT"));
            _searchMenu.OnItemSelect += OnObjectSelect;
            _searchMenu.OnIndexChange += OnIndexChange;
            _menuPool.Add(_searchMenu);

            _searchMenu.ResetKey(UIMenu.MenuControls.Back);
            _searchMenu.AddInstructionalButton(new InstructionalButton(Control.SelectWeapon, Translation.Translate("Change Axis")));
            _searchMenu.AddInstructionalButton(new InstructionalButton(Control.MoveUpDown, Translation.Translate("Zoom")));
            _searchMenu.AddInstructionalButton(new InstructionalButton(Control.Jump, Translation.Translate("Search")));

            _mainMenu = new UIMenu("Map Editor", "~b~" + Translation.Translate("MAIN MENU"));
            _mainMenu.AddItem(new UIMenuItem(Translation.Translate("Enter/Exit Map Editor")));
            _mainMenu.AddItem(new UIMenuItem(Translation.Translate("New Map"), Translation.Translate("Remove all current objects and start a new map.")));
            _mainMenu.AddItem(new UIMenuItem(Translation.Translate("Save Map"), Translation.Translate("Save all current objects to a file.")));
            _mainMenu.AddItem(new UIMenuItem(Translation.Translate("Load Map"), Translation.Translate("Load objects from a file and add them to the world.")));
            _mainMenu.RefreshIndex();
            _mainMenu.DisableInstructionalButtons(true);
            _menuPool.Add(_mainMenu);

            _formatMenu = new UIMenu("Map Editor", "~b~" + Translation.Translate("SELECT FORMAT"));
            _formatMenu.DisableInstructionalButtons(true);
            _formatMenu.ParentMenu = _mainMenu;
            RedrawFormatMenu();
            _menuPool.Add(_formatMenu);

            _metadataMenu = new UIMenu("Map Editor", "~b~" + Translation.Translate("SAVE MAP"));
            _metadataMenu.DisableInstructionalButtons(true);
            _metadataMenu.ParentMenu = _formatMenu;
            RedrawMetadataMenu();
            _menuPool.Add(_metadataMenu);

            _filepicker = new UIMenu("Map Editor", "~b~" + Translation.Translate("PICK FILE"));
            _filepicker.DisableInstructionalButtons(true);
            _filepicker.ParentMenu = _formatMenu;
            _menuPool.Add(_filepicker);

            _mainMenu.OnItemSelect += (m, it, i) =>
            {
                switch (i)
                {
                    case 0: // Enter/Exit Map Editor
                        IsInFreecam = !IsInFreecam;
                        Game.Player.Character.FreezePosition = IsInFreecam;
                        Game.Player.Character.IsVisible = !IsInFreecam;
                        World.RenderingCamera = null;
                        if (!IsInFreecam)
                        {
                            Game.Player.Character.Position -= new Vector3(0f, 0f, Game.Player.Character.HeightAboveGround - 1f);
                            return;
                        }
                        World.DestroyAllCameras();
                        _mainCamera = World.CreateCamera(GameplayCamera.Position, GameplayCamera.Rotation, 60f);
                        _objectPreviewCamera = World.CreateCamera(new Vector3(1200.016f, 3980.998f, 86.05062f), new Vector3(0f, 0f, 0f), 60f);
                        World.RenderingCamera = _mainCamera;
                        break;
                    case 1: // New Map
                        JavascriptHook.StopAllScripts();
                        PropStreamer.RemoveAll();
                        PropStreamer.Markers.Clear();
                        _currentObjectsMenu.Clear();
                        PropStreamer.Identifications.Clear();
                        PropStreamer.ActiveScenarios.Clear();
                        PropStreamer.ActiveRelationships.Clear();
                        PropStreamer.ActiveWeapons.Clear();
                        PropStreamer.Doors.Clear();
                        PropStreamer.CurrentMapMetadata = new MapMetadata();
                        ModManager.CurrentMod?.ModDisconnectInvoker();
                        ModManager.CurrentMod = null;
                        foreach (MapObject o in PropStreamer.RemovedObjects)
                        {
                            var t = World.CreateProp(o.Hash, o.Position, o.Rotation, true, false);
                            t.PositionNoOffset = o.Position;
                        }
                        PropStreamer.RemovedObjects.Clear();
                        _loadedEntities = 0;
                        _changesMade = 0;
                        _lastAutosave = DateTime.Now;
                        UI.Notify("~b~~h~Map Editor~h~~w~~n~" + Translation.Translate("Loaded new map."));
                        break;
                    case 2:
                        if (ModManager.CurrentMod != null)
                        {
                            string filename = Game.GetUserInput(255);
                            if (String.IsNullOrWhiteSpace(filename))
                            {
                                UI.Notify("~r~~h~Map Editor~h~~n~~w~" + Translation.Translate("The filename was empty."));
                                return;
                            }
                            Map tmpMap = new Map();
                            tmpMap.Objects.AddRange(PropStreamer.GetAllEntities());
                            tmpMap.RemoveFromWorld.AddRange(PropStreamer.RemovedObjects);
                            tmpMap.Markers.AddRange(PropStreamer.Markers);
                            UI.Notify("~b~~h~Map Editor~h~~n~~w~" + Translation.Translate("Map sent to external mod for saving."));
                            ModManager.CurrentMod.MapSavedInvoker(tmpMap, filename);
                            return;
                        }
                        _savingMap = true;
                        _mainMenu.Visible = false;
                        RedrawFormatMenu();
                        _formatMenu.Visible = true;
                        break;
                    case 3:
                        _savingMap = false;
                        _mainMenu.Visible = false;
                        RedrawFormatMenu();
                        _formatMenu.Visible = true;
                        break;
                }
            };

            _formatMenu.OnItemSelect += (m, item, indx) =>
            {
                if (_savingMap)
                {
                    string filename = "";
                    if (indx != 0)
                        filename = Game.GetUserInput(255);

                    switch (indx)
                    {
                        case 0: // XML
                            // TODO: Send to another menu
                            _formatMenu.Visible = false;
                            RedrawMetadataMenu();
                            _metadataMenu.Visible = true;
                            break;
                        case 1: // Objects.ini
                            if (!filename.EndsWith(".ini")) filename += ".ini";
                            SaveMap(filename, MapSerializer.Format.SimpleTrainer);
                            break;
                        case 2: // C#
                            if (!filename.EndsWith(".cs")) filename += ".cs";
                            SaveMap(filename, MapSerializer.Format.CSharpCode);
                            break;
                        case 3: // Raw
                            if (!filename.EndsWith(".txt")) filename += ".txt";
                            SaveMap(filename, MapSerializer.Format.Raw);
                            break;
                        case 4: // SpoonerLegacy
                            if (!filename.EndsWith(".SP00N")) filename += ".SP00N";
                            SaveMap(filename, MapSerializer.Format.SpoonerLegacy);
                            break;
                        case 5: // Menyoo
                            if (!filename.EndsWith(".xml")) filename += ".xml";
                            SaveMap(filename, MapSerializer.Format.Menyoo);
                            break;
                    }
                }
                else
                {
                    string filename = "";
                    if (indx != 4)
                        filename = Game.GetUserInput(255);

                    MapSerializer.Format tmpFor = MapSerializer.Format.NormalXml;
                    switch (indx)
                    {
                        case 0: // XML
                            tmpFor = MapSerializer.Format.NormalXml;
                            break;
                        case 1: // Objects.ini
                            tmpFor = MapSerializer.Format.SimpleTrainer;
                            break;
                        case 2: // Spooner
                            tmpFor = MapSerializer.Format.SpoonerLegacy;
                            break;
                        case 3: // Spooner
                            tmpFor = MapSerializer.Format.Menyoo;
                            break;
                        case 4: // File picker
                            _formatMenu.Visible = false;
                            RedrawFilepickerMenu();
                            _filepicker.Visible = true;
                            return;
                    }
                    LoadMap(filename, tmpFor);
                }
                _formatMenu.Visible = false;
            };

            _settingsMenu = new UIMenu("Map Editor", "~b~" + Translation.Translate("SETTINGS"));

            for (int i = -_possibleRange; i <= _possibleRange; i++)
            {
                _possiblePositions.Add(i * 0.01);
            }

            for (int i = -36000; i <= 36000; i++)
            {
                _possibleRoll.Add(i * 0.01);
            }

            var possibleLangauges = new List<string>
            {
                "Auto"
            };
            possibleLangauges.AddRange(Translation.Translations.Select(t => t.Language).ToList());

            var language = new UIMenuListItem(Translation.Translate("Language"),
                possibleLangauges.Select(t => (dynamic) t).ToList(), possibleLangauges.IndexOf(_settings.Translation));

            language.OnListChanged += (sender, index) =>
            {
                var newLanguage = sender.IndexToItem(index).ToString();
                Translation.SetLanguage(newLanguage);
                _settings.Translation = newLanguage;
                SaveSettings();
                if (newLanguage == "Auto")
                {
                    language.Description = "Use your game's language settings.";
                    return;
                }
                var descFile = Translation.Translations.FirstOrDefault(t => t.Language == newLanguage);
                if (descFile == null) return;
                language.Description = "~h~" + Translation.Translate("Translator") + ":~h~ " + descFile.Translator;
            };

            var checkem = new UIMenuListItem(Translation.Translate("Marker"), new List<dynamic>(Enum.GetNames(typeof(CrosshairType))), Enum.GetNames(typeof(CrosshairType)).ToList().FindIndex(x => x == _settings.CrosshairType.ToString()));
            checkem.OnListChanged += (i, indx) =>
            {
                CrosshairType outHash;
                Enum.TryParse(i.IndexToItem(indx).ToString(), out outHash);
                _settings.CrosshairType = outHash;
                SaveSettings();
            };

            List<dynamic> autosaveList = new List<dynamic> {Translation.Translate("Disable")};
            for (int i = 5; i <= 60; i += 5)
            {
                autosaveList.Add(i);
            }
            int aIndex = autosaveList.IndexOf(_settings.AutosaveInterval);
            if (aIndex == -1)
                aIndex = 0;

            var autosaveItem = new UIMenuListItem(Translation.Translate("Autosave Interval"), autosaveList, aIndex, Translation.Translate("Interval in minutes between automatic autosaves."));
            autosaveItem.OnListChanged += (item, index) =>
            {
                var sel = item.IndexToItem(index);
                _settings.AutosaveInterval = (sel as string) == Translation.Translate("Disable") ? -1 : Convert.ToInt32(item.IndexToItem(index), CultureInfo.InvariantCulture);
                SaveSettings();
            };

            List<dynamic> possibleDrawDistances = new List<dynamic> {Translation.Translate("Default"), 50, 75};
            for (int i = 100; i <= 3000; i += 100)
            {
                possibleDrawDistances.Add(i);
            }
            int dIndex = possibleDrawDistances.IndexOf(_settings.DrawDistance);
            if (dIndex == -1)
                dIndex = 0;
            var drawDistanceItem = new UIMenuListItem(Translation.Translate("Draw Distance"), possibleDrawDistances, dIndex, Translation.Translate("Draw distance for props, vehicles and peds. Reload the map for changes to take effect."));
            drawDistanceItem.OnListChanged += (item, index) =>
            {
                var sel = item.IndexToItem(index);
                _settings.DrawDistance = (sel as string) == Translation.Translate("Default") ? -1 : Convert.ToInt32(item.IndexToItem(index), CultureInfo.InvariantCulture);
                SaveSettings();
            };

            List<dynamic> senslist = new List<dynamic>();
            for (int i = 1; i < 60; i++)
            {
                senslist.Add(i);
            }
            var gamboy = new UIMenuListItem(Translation.Translate("Mouse Camera Sensitivity"), senslist, _settings.CameraSensivity - 1);
            gamboy.OnListChanged += (item, index) =>
            {
                _settings.CameraSensivity = index + 1;
                SaveSettings();
            };
            var gampadSens = new UIMenuListItem(Translation.Translate("Gamepad Camera Sensitivity"), senslist, _settings.GamepadCameraSensitivity - 1);
            gampadSens.OnListChanged += (item, index) =>
            {
                _settings.GamepadCameraSensitivity = index + 1;
                SaveSettings();
            };

            var keymovesens = new UIMenuListItem(Translation.Translate("Keyboard Movement Sensitivity"), senslist, _settings.KeyboardMovementSensitivity - 1);
            keymovesens.OnListChanged += (item, index) =>
            {
                _settings.KeyboardMovementSensitivity = index + 1;
                SaveSettings();
            };

            var gammovesens = new UIMenuListItem(Translation.Translate("Gamepad Movement Sensitivity"), senslist, _settings.GamepadMovementSensitivity - 1);
            gammovesens.OnListChanged += (item, index) =>
            {
                _settings.GamepadMovementSensitivity = index + 1;
                SaveSettings();
            };

            var butts = new UIMenuCheckboxItem(Translation.Translate("Instructional Buttons"), _settings.InstructionalButtons);
            butts.CheckboxEvent += (i, checkd) =>
            {
                _settings.InstructionalButtons = checkd;
                SaveSettings();
            };
            var gamepadItem = new UIMenuCheckboxItem(Translation.Translate("Enable Gamepad Shortcut"), _settings.Gamepad);
            gamepadItem.CheckboxEvent += (i, checkd) =>
            {
                _settings.Gamepad = checkd;
                SaveSettings();
            };

            var counterItem = new UIMenuCheckboxItem(Translation.Translate("Entity Counter"), _settings.PropCounterDisplay);
            counterItem.CheckboxEvent += (i, checkd) =>
            {
                _settings.PropCounterDisplay = checkd;
                SaveSettings();
            };

            var snapper = new UIMenuCheckboxItem(Translation.Translate("Follow Object With Camera"), _settings.SnapCameraToSelectedObject);
            snapper.CheckboxEvent += (i, checkd) =>
            {
                _settings.SnapCameraToSelectedObject = checkd;
                SaveSettings();
            };

            var boundItem = new UIMenuCheckboxItem(Translation.Translate("Bounding Box"), _settings.BoundingBox.GetValueOrDefault(false));
            boundItem.CheckboxEvent += (i, checkd) =>
            {
                _settings.BoundingBox = checkd;
                SaveSettings();
            };

            var scriptItem = new UIMenuCheckboxItem(Translation.Translate("Execute Scripts"), _settings.LoadScripts);
            scriptItem.CheckboxEvent += (i, checkd) =>
            {
                _settings.LoadScripts = checkd;
                SaveSettings();
            };

            var validate = new UIMenuItem(Translation.Translate("Validate Object Database"),Translation.Translate(
                "This will update the current object database, removing any invalid objects. The changes will take effect after you restart the script." +
                " It will take a couple of minutes."));
            validate.Activated += (men, item) => ValidateDatabase();

            var resetGrps = new UIMenuItem(Translation.Translate("Reset Active Relationship Groups"),
                Translation.Translate("This will set all ped's relationship groups to Companion."));
            resetGrps.Activated += (men, item) =>
            {
                PropStreamer.Peds.ForEach(ped => ObjectDatabase.SetPedRelationshipGroup(new Ped(ped), "Companion"));
            };

            var objectValidationItem = new UIMenuCheckboxItem(Translation.Translate("Skip Invalid Objects"), _settings.OmitInvalidObjects);
            objectValidationItem.CheckboxEvent += (i, checkd) =>
            {
                _settings.OmitInvalidObjects = checkd;
                SaveSettings();
            };

            #if DEBUG

            var testItem = new UIMenuItem("Load Terrain");
            testItem.Activated += (sender, item) =>
            {
                if (!Game.IsWaypointActive)
                {
                    Function.Call(Hash.CLEAR_HD_AREA);
                    return;
                }
                var wpyPos = World.GetWaypointPosition();

                Function.Call(Hash.SET_HD_AREA, wpyPos.X, wpyPos.Y, wpyPos.Z, 400f);
            };
            _settingsMenu.AddItem(testItem);

            #endif

            _settingsMenu.AddItem(language);
            _settingsMenu.AddItem(gamepadItem);
            _settingsMenu.AddItem(drawDistanceItem);
            _settingsMenu.AddItem(autosaveItem);
            _settingsMenu.AddItem(checkem);
            _settingsMenu.AddItem(boundItem);
            _settingsMenu.AddItem(gamboy);
            _settingsMenu.AddItem(gampadSens);
            _settingsMenu.AddItem(keymovesens);
            _settingsMenu.AddItem(gammovesens);
            _settingsMenu.AddItem(butts);
            _settingsMenu.AddItem(counterItem);
            _settingsMenu.AddItem(snapper);
            _settingsMenu.AddItem(scriptItem);
            _settingsMenu.AddItem(objectValidationItem);
            _settingsMenu.AddItem(validate);
            _settingsMenu.AddItem(resetGrps);
            _settingsMenu.RefreshIndex();
            _settingsMenu.DisableInstructionalButtons(true);
            _menuPool.Add(_settingsMenu);

            _currentObjectsMenu = new UIMenu("Map Editor", "~b~" + Translation.Translate("CURRENT ENTITES"));
            _currentObjectsMenu.OnItemSelect += OnEntityTeleport;
            _currentObjectsMenu.DisableInstructionalButtons(true);
            _menuPool.Add(_currentObjectsMenu);

            var binder = new UIMenuItem(Translation.Translate("Settings"));
            _currentEntitiesItem = new UIMenuItem(Translation.Translate("Current Entities"));

            var binder2 = new UIMenuItem(Translation.Translate("Create Map for External Mod"));

            _mainMenu.AddItem(_currentEntitiesItem);
            _mainMenu.AddItem(binder);
            _mainMenu.AddItem(binder2);

            _mainMenu.BindMenuToItem(_settingsMenu, binder);
            _mainMenu.BindMenuToItem(_currentObjectsMenu, _currentEntitiesItem);
            _mainMenu.BindMenuToItem(ModManager.ModMenu, binder2);
            _mainMenu.RefreshIndex();
            _menuPool.Add(ModManager.ModMenu);
        }
示例#43
0
 public void Load()
 {
     if (_sc != null) return;
     _sc = new Scaleform(0);
     _sc.Load("MP_BIG_MESSAGE_FREEMODE");
     var timeout = 1000;
     var start = DateTime.Now;
     while (!Function.Call<bool>(Hash.HAS_SCALEFORM_MOVIE_LOADED, _sc.Handle) && DateTime.Now.Subtract(start).TotalMilliseconds < timeout) Script.Yield();
 }