### Initialize and Draw TimerBarPool Source: https://github.com/alexguirre/ragenativeui/wiki/Timer-Bars-Overview Demonstrates how to initialize a TimerBarPool and draw it continuously using a GameFiber. Add timer bars to the pool before starting the drawing process. ```csharp static TimerBarPool myTimerBarPool = new TimerBarPool(); // ... // add timer bars to the pool myTimerBarPool.Add(myTimerBar); // start the fiber which will handle drawing the timer bars GameFiber.StartNew(ProcessTimerBars); // ... private static void ProcessTimerBars() { while (true) { GameFiber.Yield(); myTimerBarPool.Draw(); } } ``` -------------------------------- ### Create a Basic UIMenu Source: https://github.com/alexguirre/ragenativeui/wiki/Menus-Overview Instantiate a UIMenu with a banner title and subtitle. Overloads exist for custom offsets and sprites. ```csharp UIMenu myMenu = new UIMenu("Banner Title", "~b~SUBTITLE"); ``` -------------------------------- ### Manage Menu Visibility and Updates with MenuPool Source: https://github.com/alexguirre/ragenativeui/wiki/Menus-Overview Use the MenuPool helper class to simplify menu updates and rendering. Add menus to the pool and process them each tick. Implement an open/close trigger for menu visibility. ```csharp static MenuPool myMenuPool = new MenuPool(); // ... myMenuPool.Add(myMenu); // start the fiber which will handle drawing and processing the menus GameFiber.StartNew(ProcessMenus); // ... private static void ProcessMenus() { // draw the menu banners (only needed if UIMenu.SetBannerType(Rage.Texture) is used) // Game.RawFrameRender += (s, e) => pool.DrawBanners(e.Graphics); while (true) { GameFiber.Yield(); myMenuPool.ProcessMenus(); if (Game.IsKeyDown(Keys.F5)) // the open/close trigger { if (myMenu.Visible) { // close the menu myMenu.Visible = false; } else if (!UIMenu.IsAnyMenuVisible && !TabView.IsAnyPauseMenuVisible) // check that no menus are visible { // open the menu myMenu.Visible = true; } } } } ``` -------------------------------- ### Display LCtrl + E using Raw Tokens Source: https://github.com/alexguirre/ragenativeui/wiki/Instructional-Buttons-Overview Manually construct help text using raw tokens for character keys ('t_') and special icons ('b_'). This method bypasses enum-based localization. ```csharp Game.DisplayHelp("Press ~b_1013~ ~+~ ~t_E~"); ``` -------------------------------- ### Initialize CheckpointsTimerBar Source: https://github.com/alexguirre/ragenativeui/wiki/Timer-Bars-Overview Initializes a CheckpointsTimerBar with a label and a specified number of checkpoints. The state and appearance of individual checkpoints can then be modified. ```csharp var tb = new CheckpointsTimerBar("LABEL", 5); tb.Checkpoints[0].State = TimerBarCheckpointState.Completed; tb.Checkpoints[1].State = TimerBarCheckpointState.Failed; tb.Checkpoints[2].State = TimerBarCheckpointState.Completed; tb.Checkpoints[2].IsCrossedOut = true; tb.Checkpoints[3].IsCrossedOut = true; foreach (var cp in tb.Checkpoints) cp.Color = HudColor.Green.GetColor(); ``` -------------------------------- ### Create and Set BarTimerBar Percentage Source: https://github.com/alexguirre/ragenativeui/wiki/Timer-Bars-Overview Creates a BarTimerBar with a label and sets its progress percentage. The percentage should be between 0.0f and 1.0f. ```csharp var tb = new BarTimerBar("LABEL") { Percentage = 0.75f }; ``` -------------------------------- ### MIT License for InjectModuleInitializer Source: https://github.com/alexguirre/ragenativeui/blob/master/NOTICE.md This is the MIT license for the InjectModuleInitializer library. It allows for free use, modification, and distribution. ```plaintext The MIT License (MIT) Copyright (c) 2014 Einar Egilsson (einar@einaregilsson.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ``` -------------------------------- ### Set Menu Banner to Custom Texture Source: https://github.com/alexguirre/ragenativeui/wiki/Menus-Customization Use the `UIMenu.SetBannerType(Rage.Texture)` overload to set a banner from an external image file. This requires loading the texture using `Game.CreateTextureFromFile` and drawing it via `MenuPool.DrawBanners` in the `Game.RawFrameRender` event. ```csharp menu.SetBannerType(Game.CreateTextureFromFile("custom-banner.png")); Game.RawFrameRender += (s, e) => pool.DrawBanners(e.Graphics); ``` -------------------------------- ### Display Busy Spinner Icon Source: https://github.com/alexguirre/ragenativeui/wiki/Instructional-Buttons-Overview Use the InstructionalKey enum and its GetId() extension method to display a busy spinner icon in help text. This method automatically handles localization. ```csharp Game.DisplayHelp("~{InstructionalKey.SymbolBusySpinner.GetId()}~ Loading..."); ``` -------------------------------- ### Initialize and Show Mission Passed Message Source: https://github.com/alexguirre/ragenativeui/wiki/Big-Messages-Overview Initializes a BigMessageThread and displays a mission passed message. Ensure BigMessageThread is properly initialized before calling message display methods. ```csharp BigMessageThread bigMessage = new BigMessageThread(); // ... bigMessage.MessageInstance.ShowMissionPassedMessage("The message"); ``` -------------------------------- ### Display LCtrl + E Key Combination Source: https://github.com/alexguirre/ragenativeui/wiki/Instructional-Buttons-Overview Utilize the GetInstructionalId() extension method for System.Windows.Forms.Keys to display key combinations. The '~+~' token is an alias for the plus symbol icon. ```csharp Game.DisplayHelp("Press ~{Keys.LControlKey.GetInstructionalId()}~ ~+~ ~{Keys.E.GetInstructionalId()}~"); ``` -------------------------------- ### Add Icons to IconsTimerBar Source: https://github.com/alexguirre/ragenativeui/wiki/Timer-Bars-Overview Creates an IconsTimerBar and adds various icons to it. Icons can be built-in or custom, with optional colors. ```csharp var tb = new IconsTimerBar("LABEL"); tb.Icons.Add(TimerBarIcon.Rocket); // a built-in icon tb.Icons.Add(new TimerBarIcon("commonmenu", "card_suit_diamonds") { Color = HudColor.Red.GetColor() }); tb.Icons.Add(TimerBarIcon.Spike); ``` -------------------------------- ### Display D-Pad Right Controller Button Source: https://github.com/alexguirre/ragenativeui/wiki/Instructional-Buttons-Overview Use the GetInstructionalId() extension method for Rage.ControllerButtons to display controller button icons. This method ensures icons are localized. ```csharp Game.DisplayHelp("Press ~{ControllerButtons.DPadRight.GetInstructionalId()}~"); ``` -------------------------------- ### Create a Gradient Background Sprite Source: https://github.com/alexguirre/ragenativeui/wiki/UI-Drawing-Overview Instantiates a Sprite object to create a gradient background. This is useful for setting up visual elements in the UI. ```csharp var background = new Sprite("commonmenu", "bgd_gradient", new Point(100, 20), new Size(200, 500)); ``` -------------------------------- ### Subscribe to UIMenu OnItemSelect Event using Lambda Expression Source: https://github.com/alexguirre/ragenativeui/wiki/Menus-Events This snippet demonstrates subscribing to the OnItemSelect event of a UIMenu using an inline lambda expression. This is a concise way to handle events when the logic is simple and specific to the subscription point. ```csharp myMenu.OnItemSelect += (sender, selectedItem, index) => { // Your logic goes here } ``` -------------------------------- ### Create TextTimerBar Source: https://github.com/alexguirre/ragenativeui/wiki/Timer-Bars-Overview Creates a TextTimerBar with a label and specific text content displayed on the right side. ```csharp var tb = new TextTimerBar("LABEL", "TEXT"); ``` -------------------------------- ### Add Menu Items Source: https://github.com/alexguirre/ragenativeui/wiki/Menus-Overview Add various types of menu items like buttons, checkboxes, lists, and numeric scrollers to a UIMenu. Items can also have descriptions. ```csharp var button = new UIMenuItem("Simple Button"); var checkbox = new UIMenuCheckboxItem("Simple Checkbox", false); var list = new UIMenuListScrollerItem("Simple List", "", new[] { "Item 1", "Item 2", "Item 3" })); var numericList = new UIMenuNumericScrollerItem("Simple Numeric List", "", -100, 100, 5)); var anotherButton = new UIMenuItem("Another Button", "Items can have descriptions too!"); myMenu.AddItems(button, checkbox, list, numericList, anotherButton); ``` -------------------------------- ### MIT License for System.Runtime.CompilerServices.Unsafe Source: https://github.com/alexguirre/ragenativeui/blob/master/NOTICE.md This is the MIT license for the System.Runtime.CompilerServices.Unsafe library. It permits unrestricted use, modification, and distribution. ```plaintext The MIT License (MIT) Copyright (c) .NET Foundation and Contributors All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ``` -------------------------------- ### Show Weapon Purchased Message Source: https://github.com/alexguirre/ragenativeui/wiki/Big-Messages-Overview Displays a message confirming a weapon purchase, including a large message text, the weapon's name, its hash, and a duration. Essential for in-game economy feedback. ```csharp ShowWeaponPurchasedMessage(string bigMessage, string weaponName, WeaponHash weapon, int time) ``` -------------------------------- ### Show Simple Shard Message Source: https://github.com/alexguirre/ragenativeui/wiki/Big-Messages-Overview Displays a simple shard message with a title, subtitle, and duration. Ideal for brief, non-critical notifications. ```csharp ShowSimpleShard(string title, string subtitle, int time) ``` -------------------------------- ### Set Menu Banner to Game Sprite Source: https://github.com/alexguirre/ragenativeui/wiki/Menus-Customization Use the `UIMenu.SetBannerType(Sprite)` overload to set a banner using images from texture dictionaries. Requires specifying the texture dictionary, texture name, and optionally position and size. ```csharp menu.SetBannerType(new Sprite("commonmenu", "interaction_bgd", Point.Empty, Size.Empty)); ``` -------------------------------- ### Show Rankup Message Source: https://github.com/alexguirre/ragenativeui/wiki/Big-Messages-Overview Displays a rank-up message including a main text, a subtitle, the rank achieved, and a duration. Used to inform players about their progression. ```csharp ShowRankupMessage(string msg, string subtitle, int rank, int time) ``` -------------------------------- ### Subscribe to UIMenu OnItemSelect Event using Handler Method Source: https://github.com/alexguirre/ragenativeui/wiki/Menus-Events This snippet shows how to subscribe to the OnItemSelect event of a UIMenu using a dedicated event handler method. This is useful for organizing event logic into separate, reusable functions. ```csharp myMenu.OnItemSelect += ItemSelectEventHandler; public void ItemSelectEventHandler(UIMenu sender, UIMenuItem selectedItem, int index) { // Your logic goes here } ``` -------------------------------- ### Add Markers to BarTimerBar Source: https://github.com/alexguirre/ragenativeui/wiki/Timer-Bars-Overview Adds markers to a BarTimerBar at specified percentages. Markers can optionally have a specific color. ```csharp tb.Markers.Add(new TimerBarMarker(0.25f)); tb.Markers.Add(new TimerBarMarker(0.5f, HudColor.Green.GetColor())); ``` -------------------------------- ### Set TimerBar Highlight Color Source: https://github.com/alexguirre/ragenativeui/wiki/Timer-Bars-Overview Sets the highlight color overlay for a timer bar. If not null, the timer bar background is drawn with this color. ```csharp tb.Highlight = HudColor.Red.GetColor(); ``` -------------------------------- ### Show Colored Shard Message Source: https://github.com/alexguirre/ragenativeui/wiki/Big-Messages-Overview Displays a colored shard message with a main text, a description, and specified text and background colors, along with a duration. Useful for highlighting specific events with custom colors. ```csharp ShowColoredShard(string msg, string desc, HudColor textColor, HudColor bgColor, int time) ``` -------------------------------- ### Draw Custom Texture with Graphics Instance Source: https://github.com/alexguirre/ragenativeui/wiki/UI-Drawing-Overview Draws a custom texture using the static _DrawTexture method. This method requires a Graphics instance and is typically called during a frame render event. ```csharp _DrawTexture(Texture texture, Point position, Size size, Graphics graphics); ``` -------------------------------- ### UIMenuItem Activated Event Handler Signature Source: https://github.com/alexguirre/ragenativeui/wiki/Menus-Items Defines the signature for the event handler that is triggered when a UIMenuItem is activated. ```csharp public delegate void ItemActivatedEvent(UIMenu sender, UIMenuItem selectedItem); ``` -------------------------------- ### Create UIMenuListScrollerItem with Custom Formatter Source: https://github.com/alexguirre/ragenativeui/wiki/Menus-Items Initializes a UIMenuListScrollerItem for boolean values and provides a custom formatter to display 'On' or 'Off'. ```csharp var scroller = new UIMenuListScrollerItem("Scroller", "", new[] { true, false }) { Formatter = v => v ? "On" : "Off" }; ``` -------------------------------- ### Show Mission Passed Message Source: https://github.com/alexguirre/ragenativeui/wiki/Big-Messages-Overview Displays a mission passed message with a specified text and duration. This is a common way to notify players of mission completion. ```csharp ShowMissionPassedMessage(string msg, int time) ``` -------------------------------- ### MIT License for ILMerge Source: https://github.com/alexguirre/ragenativeui/blob/master/NOTICE.md This is the MIT license for the ILMerge library. It grants broad permissions for use, modification, and distribution. ```plaintext MIT License Copyright (c) .NET Foundation and Contributors All Rights Reserved Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ``` -------------------------------- ### Set Menu Banner to Single Color Source: https://github.com/alexguirre/ragenativeui/wiki/Menus-Customization Use the `UIMenu.SetBannerType(Color)` overload to set a banner as a solid color rectangle. The color is defined using `Color.FromArgb` with RGBA values. ```csharp menu.SetBannerType(Color.FromArgb(255, 200, 10, 10)); ``` -------------------------------- ### Handle Item Selection Events Source: https://github.com/alexguirre/ragenativeui/wiki/Menus-Overview Subscribe to the OnItemSelect event to execute custom logic when a menu item is selected. The handler receives the sender menu, selected item, and its index. ```csharp myMenu.OnItemSelect += ItemSelectHandler; // ... private static void ItemSelectHandler(UIMenu sender, UIMenuItem selectedItem, int index) { Game.DisplaySubtitle("You have selected: ~b~" + selectedItem.Text, 1000); } ``` -------------------------------- ### Configure UIMenuScrollerItem as a Slider Bar Source: https://github.com/alexguirre/ragenativeui/wiki/Menus-Items Instantiates a UIMenuScrollerSliderBar and assigns it to a scroller item to enable slider bar functionality. ```csharp scroller.SliderBar = new UIMenuScrollerSliderBar(); ``` -------------------------------- ### UIMenuCheckboxItem Toggle Event Handler Signature Source: https://github.com/alexguirre/ragenativeui/wiki/Menus-Items Defines the signature for the event handler that is triggered when a UIMenuCheckboxItem is toggled. ```csharp public delegate void ItemCheckboxEvent(UIMenuCheckboxItem sender, bool Checked); ``` -------------------------------- ### Show Old Style Message Source: https://github.com/alexguirre/ragenativeui/wiki/Big-Messages-Overview Displays a message in an older, classic GTA style with a specified text and duration. This can be used for retro-themed notifications. ```csharp ShowOldMessage(string msg, int time) ``` -------------------------------- ### Set TimerBar Accent Color Source: https://github.com/alexguirre/ragenativeui/wiki/Timer-Bars-Overview Sets the accent color for a timer bar. If not null, it is displayed as a thin line on the right edge of the timer bar. ```csharp tb.Accent = HudColor.Red.GetColor(); ``` -------------------------------- ### Customize UIMenuScrollerSliderBar Properties Source: https://github.com/alexguirre/ragenativeui/wiki/Menus-Items Sets custom properties for a UIMenuScrollerSliderBar, including colors, size, and markers. ```csharp sliderBar.ForegroundColor = HudColor.Green.GetColor(); sliderBar.BackgroundColor = Color.FromArgb(120, sliderBar.ForegroundColor); sliderBar.Width = 0.5f; sliderBar.Height = 0.4f; sliderBar.Markers.Add(new UIMenuScrollerSliderBarMarker(0.25f)); sliderBar.Markers.Add(new UIMenuScrollerSliderBarMarker(0.5f, Color.Red)); ``` -------------------------------- ### UIMenuScrollerItem Index Changed Event Handler Signature Source: https://github.com/alexguirre/ragenativeui/wiki/Menus-Items Defines the signature for the event handler that is triggered when the index of a UIMenuScrollerItem changes. ```csharp public delegate void ItemScrollerEvent(UIMenuScrollerItem sender, int oldIndex, int newIndex); ``` -------------------------------- ### Show Large MP Message Source: https://github.com/alexguirre/ragenativeui/wiki/Big-Messages-Overview Displays a large message suitable for multiplayer announcements, with an optional subtitle and a specified duration. Supports both single-line and double-line message formats. ```csharp ShowMpMessageLarge(string msg, int time) ``` ```csharp ShowMpMessageLarge(string msg, string subtitle, int time) ``` -------------------------------- ### Remove Menu Banner Source: https://github.com/alexguirre/ragenativeui/wiki/Menus-Customization Call `UIMenu.RemoveBanner()` to completely remove the currently displayed banner from the menu. ```csharp menu.RemoveBanner(); ``` -------------------------------- ### Format Numeric Value in UIMenuNumericScrollerItem Source: https://github.com/alexguirre/ragenativeui/wiki/Menus-Items Applies a custom formatter to a UIMenuNumericScrollerItem to display numeric values with a dollar sign and two decimal places. ```csharp scroller.Formatter = v => v.ToString("$0"); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.