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)); }
public void Tick() { if (!Main.IsOnServer()) { return; } if (_lastMessageTime.AddSeconds(15) < DateTime.UtcNow && !IsFocused && !_isHidden) { _mainScaleform.CallFunction("hide"); _isHidden = true; } if (!_isHidden) { _mainScaleform.Render2D(); } if (!IsFocused) { return; } Function.Call(Hash.DISABLE_ALL_CONTROL_ACTIONS, 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"); } }
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"); } }
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); }
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; }
private void DrawMissionProgressScaleForm() { // From: https://pastebin.com/SyyMaQD1 _dropOffProgressScaleform.CallFunction("SET_MISSION_TITLE", "Drop Off Mission Title", "Drop Off Description"); // numOfObjective,completed?,objectiveTypeId(?),current,out of,title if (_packagesDelivered == _totalPackages) { _packagesDeliveredComplete = 1; } if (_enemiesKilled == _totalEnemies) { _enemiesKilledComplete = 1; } var completion = Math.Round(((_packagesDelivered / _totalPackages) + (_enemiesKilled / _totalEnemies) + (_foundEasterEgg / 1)) * 100.0f); _dropOffProgressScaleform.CallFunction("SET_DATA_SLOT", 0, _packagesDeliveredComplete, 2, _packagesDelivered, _totalPackages, "Delivered Packages"); _dropOffProgressScaleform.CallFunction("SET_DATA_SLOT", 1, _enemiesKilledComplete, 2, _enemiesKilled, _totalEnemies, "Killed Enemies"); // numOfObjected,completed?,title _dropOffProgressScaleform.CallFunction("SET_DATA_SLOT", 2, 0, "Easter Egg"); // medal type, completion percentage, title _dropOffProgressScaleform.CallFunction("SET_TOTAL", 1, completion, "Completion - Gold"); _dropOffProgressScaleform.CallFunction("SET_MEDAL", 1.0, -1.0, -1.0, -1.0, -1.0); _dropOffProgressScaleform.CallFunction("DRAW_MENU_LIST"); _dropOffProgressScaleform.Render2D(); }
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; } }
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)); }
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); }
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 }
public void DrawCountdown() { if (!sync.status.ShowCountdown) { return; } countdown.CallFunction("SET_MESSAGE", sync.status.Countdown.ToString(), 255, 0, 0, 1); countdown.Render2D(); }
private async Task OnScaleformMessageDrawTick() { await Task.FromResult(0); if (died) { wastedScaleform.CallFunction("SHOW_SHARD_WASTED_MP_MESSAGE", Strings.WASTED, "", -1, true, true); wastedScaleform.Render2D(); } }
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); } } }
internal void Update() { if (_sc == null) { return; } _sc.Render2D(); if (_start != 0 && Game.GameTime - _start > _timer) { _sc.CallFunction("TRANSITION_OUT"); _start = 0; Dispose(); } }
/// <summary> /// Shows the wasted message if enabled. <para/> UnSubscribes from the <see cref="Events.Tick"/> when duration has passed and let server know we're done /// </summary> /// <param name="nametags"></param> private void OnTick(List <Events.TickNametagData> nametags) { if (_wastedScaleformMsg != null && _wastedEnabled) { _wastedScaleformMsg.Render2D(); } //Remove after duration finished if (Misc.GetGameTimer() > (this.timeStarted + _wastedDuration)) { //Chat.Output("Clearing wasted screen"); PlayerHelper.WastedClear(); Events.Tick -= OnTick; Events.CallRemote("WastedScreenFinished"); } }
private static async Task DisplayScaleform() { if (_start + _timer < Game.GameTime) { Dispose(); } if (_sc == null) { Dispose(); } else { _sc.Render2D(); } await Task.FromResult(0); }
public void Tick() { if (!Main.IsOnServer()) { return; } _mainScaleform.Render2D(); if (!IsFocused) { return; } Function.Call(Hash.DISABLE_ALL_CONTROL_ACTIONS, 0); }
public Prop CreateObject(Model model, Vector3 position, Vector3 rotation, bool dynamic, int netHash) { if (model == null) { LogManager.DebugLog("Model was null?"); return(null); } int counter = 0; 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", "Loading Model"); sc.CallFunction("DRAW_INSTRUCTIONAL_BUTTONS", -1); while (!model.IsLoaded && counter < 500) { model.Request(); Script.Yield(); counter++; sc.Render2D(); } var veh = new Prop(Function.Call <int>(Hash.CREATE_OBJECT_NO_OFFSET, model.Hash, position.X, position.Y, position.Z, true, true, dynamic)); veh.Rotation = rotation; veh.Position = position; veh.LodDistance = 3000; if (!dynamic) { veh.FreezePosition = true; } lock (HandleMap) if (!HandleMap.Reverse.ContainsKey(veh.Handle)) { HandleMap.Reverse.Add(veh.Handle, netHash); } model.MarkAsNoLongerNeeded(); return(veh); }
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(); }
public static async Task DrawCenterBar(string message, string subMessage, int colId = 5, int duration = 1000 * 10) { var scaleform = new Scaleform("MP_BIG_MESSAGE_FREEMODE"); while (!scaleform.IsLoaded) { await Delay(100); } var now = API.GetGameTimer(); scaleform.CallFunction("SHOW_SHARD_WASTED_MP_MESSAGE", message, subMessage, colId); while (API.GetGameTimer() - now <= duration) { scaleform.Render2D(); await Delay(0); } scaleform.Dispose(); }
private async Task OnScaleformTick() { await Task.FromResult(0); if (organizationUpdateScaleform != null) { if (--organizationUpdateScaleformTime == 0) { organizationUpdateScaleform.Dispose(); organizationUpdateScaleform = null; } else { organizationUpdateScaleform.CallFunction("SHOW_SHARD_CENTERED_TOP_MP_MESSAGE"); organizationUpdateScaleform.CallFunction("SHARD_SET_TEXT", organizationUpdateScaleformMessage, "", 1); organizationUpdateScaleform.Render2D(); } } }
public void Draw() { if (!Visible) { return; } Game.DisableAllControlsThisFrame(); var res = UIMenu.GetScreenResolutionMantainRatio(); var center = new Point((int)(res.Width / 2), (int)(res.Height / 2)); new UIResRectangle(new Point(0, 0), new Size((int)res.Width + 1, (int)res.Height + 1), Color.Black).Draw(); new UIResText(Header, new Point((int)(res.Width / 2), (int)(res.Height / 2) - 200), 2f, Error ? Color.FromArgb(224, 50, 50) : Color.FromArgb(240, 200, 80), Font.Pricedown, UIResText.Alignment.Centered).Draw(); new UIResText(Message, new Point((int)(res.Width / 2), (int)(res.Height / 2) - 80), 0.4f, Color.White, Font.ChaletLondon, UIResText.Alignment.Centered).Draw(); new UIResRectangle(center - new Size(400, 90), new Size(800, 3), Color.White).Draw(); new UIResRectangle(center - new Size(400, 55 - (25 * (Message.Split('\n').Length) - 1)), new Size(800, 3), Color.White).Draw(); var scaleform = new Scaleform("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.GET_CONTROL_INSTRUCTIONAL_BUTTON, 2, (int)Control.FrontendAccept, 0), "Accept"); scaleform.CallFunction("DRAW_INSTRUCTIONAL_BUTTONS", -1); scaleform.Render2D(); if (Game.IsEnabledControlJustPressed(Control.FrontendAccept)) { OnAccept?.Invoke(); } }
static private async void UpdateTasti() { if (!Scaleform) { Buttons = new Scaleform("instructional_buttons"); while (!HasScaleformMovieLoaded(Buttons.Handle)) await BaseScript.Delay(0); Buttons.CallFunction("CLEAR_ALL"); Buttons.CallFunction("TOGGLE_MOUSE_BUTTONS", false); Buttons.CallFunction("CLEAR_ALL"); Buttons.CallFunction("SET_DATA_SLOT", 0, GetControlInstructionalButton(2, 236, 1), "Change Visual"); Buttons.CallFunction("SET_DATA_SLOT", 1, GetControlInstructionalButton(2, 204, 1), "Get off the Wheel"); Buttons.CallFunction("DRAW_INSTRUCTIONAL_BUTTONS", -1); Scaleform = true; } if (Scaleform) Buttons.Render2D(); }
private async Task OnIsDead() { await Task.FromResult(0); if (_isDead) { _deadMessage.CallFunction("SHOW_SHARD_WASTED_MP_MESSAGE", "~r~Wasted", "Press ~INPUT_CONTEXT~ to respawn", -1, true, true); _deadMessage.Render2D(); if (Game.IsControlJustReleased(0, Control.Context)) { var playerPed = Game.PlayerPed; SetEntityVisible(playerPed.Handle, true, true); FreezeEntityPosition(playerPed.Handle, false); Screen.Fading.FadeOut(500); playerPed.Position = PlayerHousePosition; playerPed.Resurrect(); Screen.Effects.Stop(ScreenEffect.DeathFailMpIn); _isDead = false; _deadMessage.Dispose(); } } }
public async void Update() { scaleform.Render2D(); if (API.IsControlJustPressed(0, (int)Control.MpTextChatAll)) { if (!isChatOpen) { OpenChat(); } else { CloseChat(); } } if (isChatOpen) { if (API.IsControlJustPressed(0, (int)Control.Enter)) { SendMessage(); } } }
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 ResText("mission failed", new Point(middle, 100), 2.5f, Color.FromArgb(255, 148, 27, 46), Common.EFont.Pricedown, ResText.Alignment.Centered).Draw(); new ResText(Reason, new Point(middle, 230), 0.5f, Color.White, Common.EFont.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.CallByHash(0x0499D7B09FC9B407, typeof(string), 2, (int)GameControl.FrontendAccept, 0), "Continue"); scaleform.CallFunction("DRAW_INSTRUCTIONAL_BUTTONS", -1); scaleform.Render2D(); NativeFunction.CallByName <uint>("DISABLE_ALL_CONTROL_ACTIONS", 0); NativeFunction.CallByName <uint>("ENABLE_CONTROL_ACTION", 0, (int)GameControl.FrontendAccept); if (Game.IsControlJustPressed(0, GameControl.FrontendAccept)) { HasPressedContinue = true; NativeFunction.CallByHash <uint>(0xB4EDDC19532BFB85); } }
private void RenderIntructionalButtons() { _instructionalButtons.CallFunction("CLEAR_ALL"); _instructionalButtons.CallFunction("TOGGLE_MOUSE_BUTTONS", false); string str = Function.Call <string>(Hash._0x0499D7B09FC9B407, 2, 24, 0); _instructionalButtons.CallFunction("SET_DATA_SLOT", 4, str, "Select Position"); str = Function.Call <string>(Hash._0x0499D7B09FC9B407, 3, 17, 0); _instructionalButtons.CallFunction("SET_DATA_SLOT", 3, str, "Increase Duration"); str = Function.Call <string>(Hash._0x0499D7B09FC9B407, 1, 16, 0); _instructionalButtons.CallFunction("SET_DATA_SLOT", 2, str, "Decrease Duration"); str = Function.Call <string>(Hash._0x0499D7B09FC9B407, 2, 25, 0); _instructionalButtons.CallFunction("SET_DATA_SLOT", 1, str, "Exit"); string[] args = new string[] { Function.Call <string>(Hash._0x0499D7B09FC9B407, 2, 32, 0), Function.Call <string>(Hash._0x0499D7B09FC9B407, 2, 34, 0), Function.Call <string>(Hash._0x0499D7B09FC9B407, 2, 33, 0), Function.Call <string>(Hash._0x0499D7B09FC9B407, 2, 35, 0) }; _instructionalButtons.CallFunction("SET_DATA_SLOT", 0, args[3], args[2], args[1], args[0], "Move"); _instructionalButtons.CallFunction("SET_BACKGROUND_COLOUR", 0, 0, 0, 80); _instructionalButtons.CallFunction("DRAW_INSTRUCTIONAL_BUTTONS", 0); _instructionalButtons.Render2D(); }
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(); } }
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("race completed", 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(); } }
public void Update() { if (!Visible || TemporarilyHidden) { return; } ShowInstructionalButtons(); Function.Call(Hash.HIDE_HUD_AND_RADAR_THIS_FRAME); Function.Call(Hash._SHOW_CURSOR_THIS_FRAME); var res = UIMenu.GetScreenResolutionMaintainRatio(); var safe = new Point(300, 180); if (!HideTabs) { new UIResText(Title, new Point(safe.X, safe.Y - 80), 1f, Color.White, Font.ChaletComprimeCologne, UIResText.Alignment.Left) { DropShadow = true, }.Draw(); if (Photo == null) { new Sprite("char_multiplayer", "char_multiplayer", new Point((int)res.Width - safe.X - 64, safe.Y - 80), new Size(64, 64)).Draw(); } else { Photo.Position = new Point((int)res.Width - safe.X - 100, safe.Y - 80); Photo.Size = new Size(64, 64); Photo.Draw(); } new UIResText(Name, new Point((int)res.Width - safe.X - 70, safe.Y - 95), 0.7f, Color.White, Font.ChaletComprimeCologne, UIResText.Alignment.Right) { DropShadow = true, }.Draw(); string t = Money; if (string.IsNullOrEmpty(Money)) { t = DateTime.Now.ToString(); } new UIResText(t, new Point((int)res.Width - safe.X - 70, safe.Y - 60), 0.4f, Color.White, Font.ChaletComprimeCologne, UIResText.Alignment.Right) { DropShadow = true, }.Draw(); string subt = MoneySubtitle; if (string.IsNullOrEmpty(MoneySubtitle)) { subt = ""; } new UIResText(subt, new Point((int)res.Width - safe.X - 70, safe.Y - 40), 0.4f, Color.White, Font.ChaletComprimeCologne, UIResText.Alignment.Right) { DropShadow = true, }.Draw(); for (int i = 0; i < Tabs.Count; i++) { var activeSize = res.Width - 2 * safe.X; activeSize -= 4 * 5; int tabWidth = (int)activeSize / Tabs.Count; Game.EnableControlThisFrame(0, Control.CursorX); Game.EnableControlThisFrame(0, Control.CursorY); var hovering = UIMenu.IsMouseInBounds(safe.AddPoints(new Point((tabWidth + 5) * i, 0)), new Size(tabWidth, 40)); var tabColor = Tabs[i].Active ? Color.White : hovering?Color.FromArgb(100, 50, 50, 50) : Color.Black; new UIResRectangle(safe.AddPoints(new Point((tabWidth + 5) * i, 0)), new Size(tabWidth, 40), Color.FromArgb(Tabs[i].Active ? 255 : 200, tabColor)).Draw(); new UIResText(Tabs[i].Title.ToUpper(), safe.AddPoints(new Point((tabWidth / 2) + (tabWidth + 5) * i, 5)), 0.35f, Tabs[i].Active ? Color.Black : Color.White, Font.ChaletLondon, UIResText.Alignment.Centered) .Draw(); if (Tabs[i].Active) { new UIResRectangle(safe.SubtractPoints(new Point(-((tabWidth + 5) * i), 10)), new Size(tabWidth, 10), Color.DodgerBlue).Draw(); } if (hovering && Game.IsControlJustPressed(0, Control.CursorAccept) && !Tabs[i].Active) { Tabs[Index].Active = false; Tabs[Index].Focused = false; Tabs[Index].Visible = false; Index = (1000 - (1000 % Tabs.Count) + i) % Tabs.Count; Tabs[Index].Active = true; Tabs[Index].Focused = true; Tabs[Index].Visible = true; Tabs[Index].JustOpened = true; if (Tabs[Index].CanBeFocused) { FocusLevel = 1; } else { FocusLevel = 0; } Function.Call(Hash.PLAY_SOUND_FRONTEND, -1, "NAV_UP_DOWN", "HUD_FRONTEND_DEFAULT_SOUNDSET", 1); } } } Tabs[Index].Draw(); _sc.CallFunction("DRAW_INSTRUCTIONAL_BUTTONS", -1); _sc.Render2D(); }
static int FilterIndex = 0; // 0 == None public static void Tick() { // Check if the camera is enabled or not if (FCamera == null || !FCamera.Equals(World.RenderingCamera) || Game.IsPaused) { return; } Function.Call(Hash._DISABLE_FIRST_PERSON_CAM_THIS_FRAME); if (!Lock) { Game.DisableAllControlsThisFrame(); } if (HUD) { scaleform.CallFunction("DRAW_INSTRUCTIONAL_BUTTONS", -1); scaleform.Render2D(); } Vector3 CamCoord = FCamera.Position; Vector3 NewPos = ProcessNewPos(CamCoord); if (!Function.Call <bool>(Hash.IS_RADAR_HIDDEN)) { Function.Call(Hash.DISPLAY_RADAR, false); } FCamera.Position = NewPos; FCamera.Rotation = new Vector3(OffsetRotX, OffsetRotY, OffsetRotZ); Function.Call(Hash._SET_FOCUS_AREA, NewPos.X, NewPos.Y, NewPos.Z, 0.0f, 0.0f, 0.0f); #region Misc Controls if (!Lock) { // Misc controls if (Attached && Game.IsControlJustPressed(Control.CursorCancel)) { // Attachment cleanup FCamera.Detach(); AttachedEntity = null; Attached = false; scaleform.CallFunction("SET_DATA_SLOT", 12, Function.Call <string>(Hash.GET_CONTROL_INSTRUCTIONAL_BUTTON, 2, Control.CursorAccept, 0), "Attach"); scaleform.CallFunction("DRAW_INSTRUCTIONAL_BUTTONS", -1); } else if (Game.IsControlJustPressed(Control.CursorAccept)) { Entity AttachEnt = GetEntityInFrontOfCam(FCamera); if (AttachEnt != null) { AttachedEntity = AttachEnt; OffsetCoords = Function.Call <Vector3>(Hash.GET_OFFSET_FROM_ENTITY_GIVEN_WORLD_COORDS, AttachedEntity, FCamera.Position.X, FCamera.Position.Y, FCamera.Position.Z); FCamera.AttachTo(AttachedEntity, new Vector3(OffsetCoords.X, OffsetCoords.Y, OffsetCoords.Z)); Attached = true; scaleform.CallFunction("SET_DATA_SLOT", 12, Function.Call <string>(Hash.GET_CONTROL_INSTRUCTIONAL_BUTTON, 2, Control.CursorCancel, 0), "Detach"); scaleform.CallFunction("DRAW_INSTRUCTIONAL_BUTTONS", -1); } } if (Game.IsControlJustPressed(Control.VehicleHeadlight)) { HUD = !HUD; } if (Game.IsControlPressed(Control.FrontendUp)) { FCamera.FieldOfView -= 1; } else if (Game.IsControlPressed(Control.FrontendDown)) { FCamera.FieldOfView += 1; } if (Game.IsControlJustPressed(Control.FrontendLeft)) { if (FilterIndex == 0) { FilterIndex = Config.Filters.Count - 1; } else { FilterIndex--; } Function.Call(Hash.SET_TIMECYCLE_MODIFIER, Config.Filters[FilterIndex]); Function.Call(Hash.SET_TIMECYCLE_MODIFIER_STRENGTH, Config.FilterIntensity); scaleform.CallFunction("SET_DATA_SLOT", 8, Function.Call <string>(Hash.GET_CONTROL_INSTRUCTIONAL_BUTTON, 2, Control.FrontendLeft, 0), $"Filter: [{Config.Filters[FilterIndex]}]"); scaleform.CallFunction("DRAW_INSTRUCTIONAL_BUTTONS", -1); } else if (Game.IsControlJustPressed(Control.FrontendRight)) { if (FilterIndex == Config.Filters.Count - 1) { FilterIndex = 0; } else { FilterIndex++; } Function.Call(Hash.SET_TIMECYCLE_MODIFIER, Config.Filters[FilterIndex]); Function.Call(Hash.SET_TIMECYCLE_MODIFIER_STRENGTH, Config.FilterIntensity); scaleform.CallFunction("SET_DATA_SLOT", 8, Function.Call <string>(Hash.GET_CONTROL_INSTRUCTIONAL_BUTTON, 2, Control.FrontendLeft, 0), $"Filter: [{Config.Filters[FilterIndex]}]"); scaleform.CallFunction("DRAW_INSTRUCTIONAL_BUTTONS", -1); } else if (Game.IsControlJustPressed(Control.Reload)) { Disable(); Enable(); FilterIndex = 0; Function.Call(Hash.SET_TIMECYCLE_MODIFIER, "None"); scaleform.CallFunction("SET_DATA_SLOT", 8, Function.Call <string>(Hash.GET_CONTROL_INSTRUCTIONAL_BUTTON, 2, Control.FrontendLeft, 0), $"Filter: [{Config.Filters[FilterIndex]}]"); scaleform.CallFunction("DRAW_INSTRUCTIONAL_BUTTONS", -1); } if (Game.IsControlJustPressed(Control.Detonate)) { if (!SlowMode) { Game.TimeScale /= Config.SlowMotionMultiplier; } else { Game.TimeScale = 1; } SlowMode = !SlowMode; } if (Game.IsControlJustPressed(Control.VehicleExit)) { SlowMode = !SlowMode; Frozen = !Frozen; Game.Pause(Frozen); } } if (Game.IsControlJustPressed(Control.FrontendAccept)) { Lock = !Lock; if (Lock) { Game.Pause(false); HUD = false; } else { HUD = true; } } #endregion }
private async Task ATMTick() { //Disable controls when using the ATM DisableAllControlActions(0); //Disable the mouse if using a controller if (GetLastInputMethod(0)) { SetMouseCursorActiveThisFrame(); scaleform.CallFunction("SET_MOUSE_INPUT", GetDisabledControlNormal(0, (int)Control.CursorX), GetDisabledControlNormal(0, (int)Control.CursorY)); } else { scaleform.CallFunction("setCursorInvisible"); scaleform.CallFunction("SET_MOUSE_INPUT", 0, 0); } //Handle button clicks if (IsDisabledControlJustPressed(0, (int)Control.Attack)) { BeginScaleformMovieMethod(scaleform.Handle, "GET_CURRENT_SELECTION"); returnScaleform = EndScaleformMovieMethodReturn(); if (IsScaleformMovieMethodReturnValueReady(returnScaleform)) { int clickResult = GetScaleformMovieMethodReturnValueInt(returnScaleform); HandleMouseSelection(clickResult); } else { //If the click result isn't ready to be read, it needs to be offloaded //to the next tick but not using delay awaitingResult = true; } } else if (IsDisabledControlJustPressed(0, (int)Control.FrontendCancel)) { CloseATM(); } else if (IsDisabledControlJustPressed(0, (int)Control.WeaponWheelNext)) { scaleform.CallFunction("SCROLL_PAGE", -40); } else if (IsDisabledControlJustPressed(0, (int)Control.WeaponWheelPrev)) { scaleform.CallFunction("SCROLL_PAGE", 40); } if (awaitingResult) { if (IsScaleformMovieMethodReturnValueReady(returnScaleform)) { int clickResult = GetScaleformMovieMethodReturnValueInt(returnScaleform); awaitingResult = false; HandleMouseSelection(clickResult); } } //Controller if (IsDisabledControlJustPressed(0, 27)) { scaleform.CallFunction("SET_INPUT_EVENT", 8); } else if (IsDisabledControlJustPressed(0, 20)) { scaleform.CallFunction("SET_INPUT_EVENT", 9); } else if (IsDisabledControlJustPressed(0, 14)) { scaleform.CallFunction("SET_INPUT_EVENT", 11); } else if (IsDisabledControlJustPressed(0, 15)) { scaleform.CallFunction("SET_INPUT_EVENT", 10); } //Render the scaleform scaleform.Render2D(); return; }
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(); }