diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 00000000..f40fbd8b --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1,5 @@ +_site +.sass-cache +.jekyll-cache +.jekyll-metadata +vendor diff --git a/docs/404.html b/docs/404.html new file mode 100644 index 00000000..54eaf601 --- /dev/null +++ b/docs/404.html @@ -0,0 +1,26 @@ +--- +permalink: /404.html +layout: page +nav_exclude: true +--- + + + +
+

404

+ +

Page not found :(

+

The requested page could not be found.

+
diff --git a/docs/Elemements/index.md b/docs/Elemements/index.md new file mode 100644 index 00000000..357b7551 --- /dev/null +++ b/docs/Elemements/index.md @@ -0,0 +1,9 @@ +--- +layout: default +title: Elements +show_buttons: true +show_all_code: false +--- +# Elements + +This section will show all the elements that are used by the varous components and by the menus themselves. \ No newline at end of file diff --git a/docs/Gemfile b/docs/Gemfile new file mode 100644 index 00000000..e1e6aabd --- /dev/null +++ b/docs/Gemfile @@ -0,0 +1,36 @@ +source "https://rubygems.org" +# Hello! This is where you manage which Jekyll version is used to run. +# When you want to use a different version, change it below, save the +# file and run `bundle install`. Run Jekyll with `bundle exec`, like so: +# +# bundle exec jekyll serve +# +# This will help ensure the proper Jekyll version is running. +# Happy Jekylling! +#gem "jekyll", "~> 4.4.0" +gem "github-pages", group: :jekyll_plugins +# This is the default theme for new Jekyll sites. You may change this to anything you like. +gem "just-the-docs", "~> 0.10.1" +# If you want to use GitHub Pages, remove the "gem "jekyll"" above and +# uncomment the line below. To upgrade, run `bundle update github-pages`. +# gem "github-pages", group: :jekyll_plugins +# If you have any plugins, put them here! +group :jekyll_plugins do + gem "jekyll-feed", "~> 0.12" +end + +# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem +# and associated library. +platforms :mingw, :x64_mingw, :mswin, :jruby do + gem "tzinfo", ">= 1", "< 3" + gem "tzinfo-data" +end + +# Performance-booster for watching directories on Windows +gem "wdm", "~> 0.1", :platforms => [:mingw, :x64_mingw, :mswin] + +# Lock `http_parser.rb` gem to `v0.6.x` on JRuby builds since newer versions of the gem +# do not have a Java counterpart. +gem "http_parser.rb", "~> 0.6.0", :platforms => [:jruby] + +gem 'jekyll-relative-links' diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock new file mode 100644 index 00000000..bb1ed31c --- /dev/null +++ b/docs/Gemfile.lock @@ -0,0 +1,304 @@ +GEM + remote: https://rubygems.org/ + specs: + activesupport (8.0.1) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + logger (>= 1.4.2) + minitest (>= 5.1) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + base64 (0.2.0) + benchmark (0.4.0) + bigdecimal (3.1.9) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.12.2) + colorator (1.1.0) + commonmarker (0.23.11) + concurrent-ruby (1.3.5) + connection_pool (2.5.0) + csv (3.3.2) + dnsruby (1.72.3) + base64 (~> 0.2.0) + simpleidn (~> 0.2.1) + drb (2.2.1) + em-websocket (0.5.3) + eventmachine (>= 0.12.9) + http_parser.rb (~> 0) + ethon (0.16.0) + ffi (>= 1.15.0) + eventmachine (1.2.7) + execjs (2.10.0) + faraday (2.12.2) + faraday-net_http (>= 2.0, < 3.5) + json + logger + faraday-net_http (3.4.0) + net-http (>= 0.5.0) + ffi (1.17.1-arm64-darwin) + ffi (1.17.1-x64-mingw-ucrt) + ffi (1.17.1-x86_64-linux-gnu) + forwardable-extended (2.6.0) + gemoji (4.1.0) + github-pages (232) + github-pages-health-check (= 1.18.2) + jekyll (= 3.10.0) + jekyll-avatar (= 0.8.0) + jekyll-coffeescript (= 1.2.2) + jekyll-commonmark-ghpages (= 0.5.1) + jekyll-default-layout (= 0.1.5) + jekyll-feed (= 0.17.0) + jekyll-gist (= 1.5.0) + jekyll-github-metadata (= 2.16.1) + jekyll-include-cache (= 0.2.1) + jekyll-mentions (= 1.6.0) + jekyll-optional-front-matter (= 0.3.2) + jekyll-paginate (= 1.1.0) + jekyll-readme-index (= 0.3.0) + jekyll-redirect-from (= 0.16.0) + jekyll-relative-links (= 0.6.1) + jekyll-remote-theme (= 0.4.3) + jekyll-sass-converter (= 1.5.2) + jekyll-seo-tag (= 2.8.0) + jekyll-sitemap (= 1.4.0) + jekyll-swiss (= 1.0.0) + jekyll-theme-architect (= 0.2.0) + jekyll-theme-cayman (= 0.2.0) + jekyll-theme-dinky (= 0.2.0) + jekyll-theme-hacker (= 0.2.0) + jekyll-theme-leap-day (= 0.2.0) + jekyll-theme-merlot (= 0.2.0) + jekyll-theme-midnight (= 0.2.0) + jekyll-theme-minimal (= 0.2.0) + jekyll-theme-modernist (= 0.2.0) + jekyll-theme-primer (= 0.6.0) + jekyll-theme-slate (= 0.2.0) + jekyll-theme-tactile (= 0.2.0) + jekyll-theme-time-machine (= 0.2.0) + jekyll-titles-from-headings (= 0.5.3) + jemoji (= 0.13.0) + kramdown (= 2.4.0) + kramdown-parser-gfm (= 1.1.0) + liquid (= 4.0.4) + mercenary (~> 0.3) + minima (= 2.5.1) + nokogiri (>= 1.16.2, < 2.0) + rouge (= 3.30.0) + terminal-table (~> 1.4) + webrick (~> 1.8) + github-pages-health-check (1.18.2) + addressable (~> 2.3) + dnsruby (~> 1.60) + octokit (>= 4, < 8) + public_suffix (>= 3.0, < 6.0) + typhoeus (~> 1.3) + html-pipeline (2.14.3) + activesupport (>= 2) + nokogiri (>= 1.4) + http_parser.rb (0.8.0) + i18n (1.14.7) + concurrent-ruby (~> 1.0) + jekyll (3.10.0) + addressable (~> 2.4) + colorator (~> 1.0) + csv (~> 3.0) + em-websocket (~> 0.5) + i18n (>= 0.7, < 2) + jekyll-sass-converter (~> 1.0) + jekyll-watch (~> 2.0) + kramdown (>= 1.17, < 3) + liquid (~> 4.0) + mercenary (~> 0.3.3) + pathutil (~> 0.9) + rouge (>= 1.7, < 4) + safe_yaml (~> 1.0) + webrick (>= 1.0) + jekyll-avatar (0.8.0) + jekyll (>= 3.0, < 5.0) + jekyll-coffeescript (1.2.2) + coffee-script (~> 2.2) + coffee-script-source (~> 1.12) + jekyll-commonmark (1.4.0) + commonmarker (~> 0.22) + jekyll-commonmark-ghpages (0.5.1) + commonmarker (>= 0.23.7, < 1.1.0) + jekyll (>= 3.9, < 4.0) + jekyll-commonmark (~> 1.4.0) + rouge (>= 2.0, < 5.0) + jekyll-default-layout (0.1.5) + jekyll (>= 3.0, < 5.0) + jekyll-feed (0.17.0) + jekyll (>= 3.7, < 5.0) + jekyll-gist (1.5.0) + octokit (~> 4.2) + jekyll-github-metadata (2.16.1) + jekyll (>= 3.4, < 5.0) + octokit (>= 4, < 7, != 4.4.0) + jekyll-include-cache (0.2.1) + jekyll (>= 3.7, < 5.0) + jekyll-mentions (1.6.0) + html-pipeline (~> 2.3) + jekyll (>= 3.7, < 5.0) + jekyll-optional-front-matter (0.3.2) + jekyll (>= 3.0, < 5.0) + jekyll-paginate (1.1.0) + jekyll-readme-index (0.3.0) + jekyll (>= 3.0, < 5.0) + jekyll-redirect-from (0.16.0) + jekyll (>= 3.3, < 5.0) + jekyll-relative-links (0.6.1) + jekyll (>= 3.3, < 5.0) + jekyll-remote-theme (0.4.3) + addressable (~> 2.0) + jekyll (>= 3.5, < 5.0) + jekyll-sass-converter (>= 1.0, <= 3.0.0, != 2.0.0) + rubyzip (>= 1.3.0, < 3.0) + jekyll-sass-converter (1.5.2) + sass (~> 3.4) + jekyll-seo-tag (2.8.0) + jekyll (>= 3.8, < 5.0) + jekyll-sitemap (1.4.0) + jekyll (>= 3.7, < 5.0) + jekyll-swiss (1.0.0) + jekyll-theme-architect (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-cayman (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-dinky (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-hacker (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-leap-day (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-merlot (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-midnight (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-minimal (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-modernist (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-primer (0.6.0) + jekyll (> 3.5, < 5.0) + jekyll-github-metadata (~> 2.9) + jekyll-seo-tag (~> 2.0) + jekyll-theme-slate (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-tactile (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-time-machine (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-titles-from-headings (0.5.3) + jekyll (>= 3.3, < 5.0) + jekyll-watch (2.2.1) + listen (~> 3.0) + jemoji (0.13.0) + gemoji (>= 3, < 5) + html-pipeline (~> 2.2) + jekyll (>= 3.0, < 5.0) + json (2.9.1) + just-the-docs (0.10.1) + jekyll (>= 3.8.5) + jekyll-include-cache + jekyll-seo-tag (>= 2.0) + rake (>= 12.3.1) + kramdown (2.4.0) + rexml + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) + liquid (4.0.4) + listen (3.9.0) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) + logger (1.6.5) + mercenary (0.3.6) + minima (2.5.1) + jekyll (>= 3.5, < 5.0) + jekyll-feed (~> 0.9) + jekyll-seo-tag (~> 2.1) + minitest (5.25.4) + net-http (0.6.0) + uri + nokogiri (1.18.2-arm64-darwin) + racc (~> 1.4) + nokogiri (1.18.2-x64-mingw-ucrt) + racc (~> 1.4) + nokogiri (1.18.2-x86_64-linux-gnu) + racc (~> 1.4) + octokit (4.25.1) + faraday (>= 1, < 3) + sawyer (~> 0.9) + pathutil (0.16.2) + forwardable-extended (~> 2.6) + public_suffix (5.1.1) + racc (1.8.1) + rake (13.2.1) + rb-fsevent (0.11.2) + rb-inotify (0.11.1) + ffi (~> 1.0) + rexml (3.4.0) + rouge (3.30.0) + rubyzip (2.4.1) + safe_yaml (1.0.5) + sass (3.7.4) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + sawyer (0.9.2) + addressable (>= 2.3.5) + faraday (>= 0.17.3, < 3) + securerandom (0.4.1) + simpleidn (0.2.3) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) + typhoeus (1.4.1) + ethon (>= 0.9.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + tzinfo-data (1.2025.1) + tzinfo (>= 1.0.0) + unicode-display_width (1.8.0) + uri (1.0.2) + wdm (0.2.0) + webrick (1.9.1) + +PLATFORMS + arm64-darwin + x64-mingw-ucrt + x86_64-linux-gnu + +DEPENDENCIES + github-pages + http_parser.rb (~> 0.6.0) + jekyll-feed (~> 0.12) + jekyll-relative-links + just-the-docs (~> 0.10.1) + tzinfo (>= 1, < 3) + tzinfo-data + wdm (~> 0.1) + +BUNDLED WITH + 2.6.3 diff --git a/docs/RadialMenu/index.md b/docs/RadialMenu/index.md new file mode 100644 index 00000000..f6ba6072 --- /dev/null +++ b/docs/RadialMenu/index.md @@ -0,0 +1,108 @@ +--- +layout: default +title: Radial Menu +show_buttons: true +show_all_code: false +--- +# Radial Menu + +![image](https://github.com/manups4e/ScaleformUI/assets/4005518/ae808585-af36-4f00-a323-3b3f6036dd74) + +Radial Menu is a customizable WeaponWheel menu, it's divided in 8 segments ([RadialSegment](./radialsegment.md)) that can be selected, and to each segment you can add any amount of [SegmentItem](./segmentitem.md) items you want. + +## Constructor + +```c# +public RadialMenu() +public RadialMenu(PointF offset) +``` + +```lua +RadialMenu.New(x, y) +``` + +## Parameters + +### Visible +Gets or Sets the menu visible status. If Visible is `true` the menu is drawn on screen. + +```c# +public bool Visible {get;set;} +``` + +```lua +radMenu:Visible(bool) +``` + +### CurrentSegment +Gets or Sets the current highlighted segment + +```c# +public int CurrentSegment {get;set;} +``` + +```lua +radMenu:CurrentSegment(index) +``` + +### Segments +A `table` in Lua and a `List` in C#, both using only `RadialSegment` tab and max 8 items. Each item can contain int32.max items to scroll like the original `Weapon Wheel`. + +```c# +public RadialSegment[] Segments +``` + +```lua +radMenu.Segments -- An 8 items table, each item represents a segment of the wheel (clockwise) +``` + +### Enable3D +Gets or Sets the 3D effect on wheel, `true` by default. + +```c# +public bool Enable3D {get;set;} +``` + +```lua +radMenu:Enable3D(enable) -- Enables / disables the 3D effects on the wheel (default true) +``` + +## Instructional Buttons +This menu like all other menus have `InstructionalButtons` table / List handled automatically by ScaleformUI. Here's the functions to handle the list. + +```c# +List InstructionalButtons // the instructional buttons to show while the menu is Visible +void AddInstructionalButton(InstructionalButton button) // adds an instructional button to the current menu +void RemoveInstructionalButton(InstructionalButton button) // removes the desired instructional button +void RemoveInstructionalButton(int index) // removes the desired instructional button +``` + +```lua +.InstructionalButtons -- the instructional buttons to show while the menu is Visible +:AddInstructionButton(button) -- adds an instructional button to the current menu +:RemoveInstructionButton(button) -- removes the desired instructional button +``` + +## Events +Triggered based on player's actions. + +```c# +MenuOpenedEvent(RadialMenu menu, dynamic data = null); +MenuClosedEvent(RadialMenu menu); +SegmentChanged(RadialSegment segment); +IndexChanged(RadialSegment segment, int index); +SegmentSelected(RadialSegment segment); +``` + +```lua +OnMenuOpen = function(menu, data) +end, +OnMenuClose = function(menu) +end, +OnSegmentHighlight = function(segment) +end, +OnSegmentIndexChange = function(segment, index) +end, +OnSegmentSelect = function(segment) +end +``` diff --git a/docs/RadialMenu/radialsegment.md b/docs/RadialMenu/radialsegment.md new file mode 100644 index 00000000..c1d24cf8 --- /dev/null +++ b/docs/RadialMenu/radialsegment.md @@ -0,0 +1,48 @@ +--- +layout: default +title: Radial Segment +parent: Radial Menu +show_buttons: true +show_all_code: false +--- + +# Radial Segment +Only 8 of them exist, and usually they're already available on menu open. You can access them directly by the Segments List in Clockwise order + +## Parameters + +### CurrentSelection +Gets or Sets the current segment selection scrolling its internal items + +```c# +int CurrentSelection { get; set; } +``` + +```lua +radMenu.Segments[currSeg]:CurrentSelection() +``` + +## Functions + +### Add Item +Adds a [SegmentItem](./segmentitem.md) to the list of this Segment + +```c# +public void AddItem(SegmentItem item) +``` + +```lua +radMenu.Segments[curSeg]:AddItem(item) +``` + +### RemoveItem and RemoveItemAt +Removes an item from the list + +```c# +public void RemoveItemAt(int index){} +public void RemoveItem(SegmentItem item){} +``` + +```lua +function RadialSegment:RemoveItem(item) +``` \ No newline at end of file diff --git a/docs/RadialMenu/segmentitem.md b/docs/RadialMenu/segmentitem.md new file mode 100644 index 00000000..14dd8f87 --- /dev/null +++ b/docs/RadialMenu/segmentitem.md @@ -0,0 +1,105 @@ +--- +layout: default +title: Segment Item +parent: Radial Menu +show_buttons: true +show_all_code: false +--- + +# Segment Item +Each of the 8 [RadialSegment](./radialsegment.md)s can have multiple instances of this item. + +## Constructor + +```c# +public SegmentItem(string label, string desc, string txd, string txn, int txwidth, int txheight, SColor color) +``` + +```lua +SegmentItem.New(_label, _desc, _txd, _txn, _txwidth, _txheight, _color) +``` + +## Parameters + +### Label + +```c# +public string Label {get; set;} +``` + +```lua +segItem:Label(lbl) +``` + +### Description + +```c# +public string Description {get; set;} +``` + +```lua +segItem:Description(desc) +``` + +### TextureDict + +```c# +public string TextureDict {get; set;} +``` + +```lua +segItem:TextureDict(txd) +``` + +### TextureName + +```c# +public string TextureName {get; set;} +``` + +```lua +segItem:TextureName(txn) +``` + +### TextureWidth + +```c# +public int TextureWidth {get; set;} +``` + +```lua +segItem:TextureWidth(width) +``` + +### TextureHeight + +```c# +public int TextureHeight {get; set;} +``` + +```lua +segItem:TextureHeight(height) +``` + +### Color + +```c# +public SColor Color {get; set;} +``` + +```lua +segItem:Color(color) +``` + +## Functions + +### Set Quantity +Set the quantity of this item, if max == 0 then the quantity will be centered + +```c# +public void SetQuantity(int qtty, int max = 0) +``` + +```lua +segItem:SetQuantity(qtty, max) +``` diff --git a/docs/RadioMenu/index.md b/docs/RadioMenu/index.md new file mode 100644 index 00000000..06190ba7 --- /dev/null +++ b/docs/RadioMenu/index.md @@ -0,0 +1,126 @@ +--- +layout: default +title: Radio Menu +show_buttons: true +show_all_code: false +--- + +# Radio Menu +![image](https://github.com/user-attachments/assets/9466c3c1-dab0-4251-8227-49166d804028) + +Counterpart of the Radial Menu it emulates the Vehicle Radio menu multiple [RadioItem](./radioitem.md)s to be added to the circle. + +## Constructor + +```c# +public UIRadioMenu() +``` + +```lua +UIRadioMenu.New() +``` + +## Parameters + +### Stations +This is the main List inside the menu, a list of [RadioItem](./radioitem.md)s + +```c# +public List Stations { get; private set; } +``` + +```lua +menu.Stations = {} +``` + +### Instructional Buttons +Like [Radial Menu]({{ site.baseurl }}/RadialMenu/index) and [UIMenu]({{ site.baseurl }}/UIMenu/index) this menu allows adding and removing custom instructional buttons + +```c# +public void AddInstructionalButton(InstructionalButton button){} +public void RemoveInstructionalButton(InstructionalButton button){} +public void RemoveInstructionalButton(int index){} +``` + +```lua +function UIRadioMenu:AddInstructionButton(button) +function UIRadioMenu:RemoveInstructionButton(button) +``` + +### Current Selection +Gets or Sets the current selected item in the menu. + +```c# +public int CurrentSelection {get; set;} +``` + +```lua +function UIRadioMenu:CurrentSelection(index) +``` + +### Visible +Gets or Sets the visible state of the menu, if set to `true` the menu will be visible and automatically drawn on screen. + +```c# +public bool Visible {get;set;} +``` + +```lua +function UIRadioMenu:Visible(bool) +``` + +### Animation Direction +The menu has animation opening and closing, you can choose between `ZoomOut` and `ZoomIn` + +```c# +public AnimationDirection AnimDirection = AnimationDirection.ZoomIn; +``` + +```lua +function UIRadioMenu:AnimDirection(direction) +``` + +### Animation Duration +The time of exection for the animation where 1.0 means 1 second. + +```c# +public float AnimationDuration = 1f; +``` + +```lua +function UIRadioMenu:AnimationDuration(time) +``` + +## Functions + +### Add Station +Adds a [station](./radioitem.md) to the menu wheel. + +```c# +public void AddStation(RadioItem station) +``` + +```lua +function UIRadioMenu:AddStation(station) +``` + +## Events +Events are triggered on player interaction with the menu. + +```c# +public delegate void MenuOpenedEvent(UIRadioMenu menu, dynamic data = null); +public delegate void MenuClosedEvent(UIRadioMenu menu); +public delegate void IndexChanged(int index); +public delegate void StationSelected(RadioItem item, int index); +``` + +```lua +OnMenuOpen = function(menu, data) +end +OnMenuClose = function(menu) +end +OnIndexChange = function(index) +end +OnStationSelect = function(segment, index) +end +``` \ No newline at end of file diff --git a/docs/RadioMenu/radioitem.md b/docs/RadioMenu/radioitem.md new file mode 100644 index 00000000..48a41115 --- /dev/null +++ b/docs/RadioMenu/radioitem.md @@ -0,0 +1,20 @@ +--- +layout: default +title: Radio Item +parent: Radio Menu +show_buttons: true +show_all_code: false +--- + +# Radio Item +Each item of the [Radio Menu](./index.md) are Radio Items. + +### Constructor + +```c# +public RadioItem(string station, string artist, string track, string txd, string txn) +``` + +```lua +function RadioItem.New(_station, _artist, _track, _txd, _txn) +``` \ No newline at end of file diff --git a/docs/Scaleforms/BigMessage.md b/docs/Scaleforms/BigMessage.md new file mode 100644 index 00000000..cfbe2262 --- /dev/null +++ b/docs/Scaleforms/BigMessage.md @@ -0,0 +1,72 @@ +--- +layout: default +title: Big Message +parent: Scaleforms API +show_buttons: true +show_all_code: false +--- + +# Big Message +![image](https://user-images.githubusercontent.com/4005518/162581479-ccb4dabe-9225-4e9a-9b20-69fb5f7f0c15.png) + +```c# +Main.BigMessageInstance +``` + +```lua +ScaleformUI.Scaleforms.BigMessageInstance +``` + +## Parameters + +### Manual Dispose +Allows to choose if disposing of the scaleform movie will be manual or automatic after time ends. +Manual Dispose is also a parameter of all the available API functions. Check below. + +```c# +public bool ManualDispose { get; set; } +``` + +```lua +BigMessageInstance._manualDispose +``` + +### Transition +These settings give full control of the transition animation. The available transitions are `TRANSITION_UP`, `TRANSITION_OUT`, `TRANSITION_DOWN` + +```c# +public string Transition { get; set; } = "TRANSITION_OUT"; +public float TransitionDuration { get; set; } = 0.4f; +public bool TransitionAutoExpansion { get; set; } = false; +``` + +```lua +function BigMessageInstance:SetTransition(transition, duration, preventAutoExpansion) +``` + +## Functions +Time parameter is defaulted at 5000 if not specified. + +```c# +public void ShowMissionPassedMessage(string msg, int time = 5000, bool manualDispose = false){} +public void ShowMissionPassedMessage(ScaleformLabel msg, int time = 5000, bool manualDispose = false){} +public void ShowColoredShard(string msg, string desc, HudColor textColor, HudColor bgColor, int time = 5000, bool manualDispose = false){} +public void ShowOldMessage(string msg, int time = 5000, bool manualDispose = false){} +public void ShowSimpleShard(string title, string subtitle, int time = 5000, bool manualDispose = false){} +public void ShowRankupMessage(string msg, string subtitle, int rank, int time = 5000, bool manualDispose = false){} +public void ShowWeaponPurchasedMessage(string bigMessage, string weaponName, WeaponHash weapon, int time = 5000, bool manualDispose = false){} +public void ShowMpMessageLarge(string msg, int time = 5000, bool manualDispose = false){} +public void ShowMpWastedMessage(string msg, string sub, int time = 5000, bool manualDispose = false){} +public void ShowCustomShard(string funcName, params object[] paremeters){} +``` + +```lua +function BigMessageInstance:ShowMissionPassedMessage(msg, duration, manualDispose) +function BigMessageInstance:ShowColoredShard(msg, desc, textColor, bgColor, duration, manualDispose) +function BigMessageInstance:ShowOldMessage(msg, duration, manualDispose) +function BigMessageInstance:ShowSimpleShard(msg, subtitle, duration, manualDispose) +function BigMessageInstance:ShowRankupMessage(msg, subtitle, rank, duration, manualDispose) +function BigMessageInstance:ShowWeaponPurchasedMessage(bigMessage, weaponName, weaponHash, duration, manualDispose) +function BigMessageInstance:ShowMpMessageLarge(msg, duration, manualDispose) +function BigMessageInstance:ShowMpWastedMessage(msg, subtitle, duration, manualDispose) +``` diff --git a/docs/Scaleforms/Countdown.md b/docs/Scaleforms/Countdown.md new file mode 100644 index 00000000..8ca37860 --- /dev/null +++ b/docs/Scaleforms/Countdown.md @@ -0,0 +1,47 @@ +--- +layout: default +title: Countdown +parent: Scaleforms API +show_buttons: true +show_all_code: false +--- + +# Countdown + + + +```c# +Main.Countdown +``` + +```lua +ScaleformUI.Scaleforms.Countdown +``` + +## Functions + +```c# +async Task Start(int number = 3, HudColor hudColor = HudColor.HUD_COLOUR_GREEN, string countdownAudioName = "321", string countdownAudioRef = "Car_Club_Races_Pursuit_Series_Sounds", string goAudioName = "Go", string goAudioRef = "Car_Club_Races_Pursuit_Series_Sounds") +// This will start a countdown and play the audio for each step, default is 3, 2, 1, GO +// method is awaitable and will return when the countdown shows "GO" +``` + +```lua +:Start(number, hudColour, countdownAudioName, countdownAudioRef, goAudioName, goAudioRef) +---Starts the countdown +---@param number number? - The number to start the countdown from +---@param hudColour number? - The hud colour to use for the countdown +---@param countdownAudioName string? - The audio name to play for each number +---@param countdownAudioRef string? - The audio ref to play for each number +---@param goAudioName string? - The audio name to play when the countdown is finished +---@param goAudioRef string? - The audio ref to play when the countdown is finished +---@return promise +-- consider that: + if number == nil then number = 3 end + if hudColour == nil then hudColour = 18 end + if countdownAudioName == nil then countdownAudioName = "321" end + if countdownAudioRef == nil then countdownAudioRef = "Car_Club_Races_Pursuit_Series_Sounds" end + if goAudioName == nil then goAudioName = "Go" end + if goAudioRef == nil then goAudioRef = "Car_Club_Races_Pursuit_Series_Sounds" end + +``` diff --git a/docs/Scaleforms/Feed.md b/docs/Scaleforms/Feed.md new file mode 100644 index 00000000..bba88973 --- /dev/null +++ b/docs/Scaleforms/Feed.md @@ -0,0 +1,41 @@ +--- +layout: default +title: Big Feed +parent: Scaleforms API +show_buttons: true +show_all_code: false +--- + +# Big Feed + +![image](https://github.com/manups4e/ScaleformUI/assets/4005518/62bc56a8-c67d-43f6-9c6a-2511b23a7c04) + +```c# +Main.BigFeed +``` + +```lua +ScaleformUI.Scaleforms.BigFeed +``` + +## Functions +```c# +bool RightAligned // Decides if the feed is centered or right aligned, *MUST* be called before Enabled +bool DisabledNotifications // If true disables all kind of notifications while the feed is showing +string Title // Sets the title of the BigFeedInstance +string Subtitle // Sets the subtitle of the BigFeedInstance +string BodyText // Sets the body text of the BigFeedInstance +string TextureDictionary // The Texture Dictionary (TXD) where the texture is loaded +string TextureName // The texture in the dictionary +bool Enabled // Toggles the BigFeedInstance on or off +void UpdatePicture(string txd, string txn) // updates the texture +``` + +```lua +:Title(title) -- Sets the title of the BigFeedInstance, if no title is provided it will return the current title +:Subtitle(subtitle) -- Sets the subtitle of the BigFeedInstance, if no subtitle is provided it will return the current subtitle +:BodyText(body) -- Sets the body text of the BigFeedInstance, if no body text is provided it will return the current body text +:RightAligned(rightAligned) -- [boolean] Sets the BigFeedInstance to be right aligned, if no state is provided it will return the current state +:Texture(textureName, textureDictionary) -- Sets the texture of the BigFeedInstance, if no texture is provided it will return the current texture +:Enabled(enabled) -- [boolean] Toggles the BigFeedInstance on or off, if a state is not provided it will return the current enabled state +``` \ No newline at end of file diff --git a/docs/Scaleforms/Instructionalbuttons.md b/docs/Scaleforms/Instructionalbuttons.md new file mode 100644 index 00000000..4d1749dc --- /dev/null +++ b/docs/Scaleforms/Instructionalbuttons.md @@ -0,0 +1,104 @@ +--- +layout: default +title: Instructional Buttons +parent: Scaleforms API +show_buttons: true +show_all_code: false +--- + +# Instructional Buttons +One of the most used and most important scaleforms in FiveM and in ScaleformUI. + +![image](https://user-images.githubusercontent.com/4005518/162583983-be7a6a7d-c976-4258-9aea-c5e03d15c514.png) + +The instructional buttons are used to guide the player while using the menus but they can be used for whatever reason (one of them is the saving notification). + +```c# +Main.InstructionalButtons +``` + +```lua +ScaleformUI.Scaleforms.InstructionalButtons +``` + +Before showing what and how this scaleform performs, we need to look at one more component to make it work, an `InstructionalButton` must be declared for each control the developer wants to add or remove. + +the InstructionalButton can be created in a list in c# or in a table in lua and then the list/table can be added via the instructionalButtons's SetInstructionalButtons function. + +here's an example: + +```c# +// new InstructionalButton(Control control, string text, PadCheck padFilter = PadCheck.Any) +// new InstructionalButton(List controls, string text, PadCheck padFilter = PadCheck.Any) +// new InstructionalButton(Control gamepadControl, Control keyboardControl, string text) +// InstructionalButton(List gamepadControls, List keyboardControls, string text) +// InstructionalButton(InputGroup control, string text, PadCheck padFilter = PadCheck.Any) + +List buttons = new List() +{ + new InstructionalButton(Control.PhoneCancel, Game.GetGXTEntry("HUD_INPUT3")), + new InstructionalButton(Control.LookUpDown, "Scroll text", PadCheck.Controller), + new InstructionalButton(InputGroup.INPUTGROUP_CURSOR_SCROLL, "Scroll text", PadCheck.Keyboard) + // cannot make difference between controller / keyboard here in 1 line because we are using the InputGroup for keyboard +}; +ScaleformUI.InstructionalButtons.SetInstructionalButtons(buttons); + +``` + +```lua +-- InstructionalButton.New(text, padcheck, gamepadControls, keyboardControls, inputGroup) + +-- padCheck can be -1 for both, 0 for gamepad, 1 for keyboard and mouse, it filters to show that control only for the selected control or both +-- gamepadControls can be one or a table of controls, for example 51 or {51, 47, 176, 177} +-- keyboardControls the same as gamepadControls, +-- inpuGroup can be set to handle all the buttons needed automatically (needs gamepad and keyboard controls to be -1) + +local buttons = { + InstructionalButton.New(GetLabelText("HUD_INPUT3"), -1, 177, 177, -1), + InstructionalButton.New("Scroll text", 0, 2, -1, -1), + InstructionalButton.New("Scroll text", 1, -1, -1, "INPUTGROUP_CURSOR_SCROLL") + -- cannot make difference between controller / keyboard here in 1 line because we are using the InputGroup for keyboard +} +ScaleformUI.Scaleforms.InstructionalButtons:SetInstructionalButtons(buttons) +``` + +The InstructionalButton can be filtered, setting 1 or more controls for controller / keyboard separately and can handle InputGroups, using the padcheck the control selected will be shown only if the player is using one of the 2 input methods. + +## Parameters + +### IsSaving check +Used to check if the saving notification is showing (Busy Spinner) + +```c# +public bool IsSaving {get;} +``` + +```lua +ScaleformUI.Scaleforms.InstructionalButtons.IsSaving +``` + +## Functions + +```c# +public void SetInstructionalButtons(List buttons) {} +public void AddInstructionalButton(InstructionalButton button) {} +public void RemoveInstructionalButton(InstructionalButton button) {} +public void RemoveInstructionalButtons(List buttons) {} +public void RemoveInstructionalButton(int button) {} +public void ClearButtonList() {} +public void AddSavingText(LoadingSpinnerType spinnerType, string text, int time) {} +public void AddSavingText(LoadingSpinnerType spinnerType, string text) {} +public void HideSavingText() {} +public static bool IsControlJustPressed(Control control, PadCheck keyboardOnly = PadCheck.Any) {} +public void ForceUpdate() {} +``` + +```lua +function ButtonsHandler:SetInstructionalButtons(buttons) +function ButtonsHandler:AddInstructionalButton(button) +function ButtonsHandler:RemoveInstructionalButton(button) +function ButtonsHandler:ClearButtonList() +function ButtonsHandler:Refresh() +function ButtonsHandler:ShowBusySpinner(spinnerType, text, time, manualDispose) +function ButtonsHandler:HideBusySpinner() +``` \ No newline at end of file diff --git a/docs/Scaleforms/MidsizeMessage.md b/docs/Scaleforms/MidsizeMessage.md new file mode 100644 index 00000000..34df5d5a --- /dev/null +++ b/docs/Scaleforms/MidsizeMessage.md @@ -0,0 +1,30 @@ +--- +layout: default +title: Midsize Message +parent: Scaleforms API +show_buttons: true +show_all_code: false +--- + +# Midsize Message + +![image](https://user-images.githubusercontent.com/4005518/162582501-cd80a049-21ff-477e-b567-84b8fb477188.png) + +```c# +Main.MedMessageInstance +``` + +```lua +ScaleformUI.Scaleforms.MidMessageInstance +``` + +## Functions +Time parameter is defaulted at 5000 if not specified. + +```c# +void ShowColoredShard(string msg, string desc, HudColor bgColor, HudColor outColor = HudColor.HUD_COLOUR_FREEMODE, bool useDarkerShard = false, bool useCondensedShard = false, int time = 5000, float animTime = 0.33f) +``` + +```lua +function MidMessageInstance:ShowColoredShard(msg, desc, bgColor, useDarkerShard, useCondensedShard, time) +``` diff --git a/docs/Scaleforms/MinimapOverlays.md b/docs/Scaleforms/MinimapOverlays.md new file mode 100644 index 00000000..4cb911b5 --- /dev/null +++ b/docs/Scaleforms/MinimapOverlays.md @@ -0,0 +1,81 @@ +--- +layout: default +title: Minimap Overlays +parent: Scaleforms API +show_buttons: true +show_all_code: false +--- + +# Minimap Overlays +![image](https://github.com/manups4e/ScaleformUI/assets/4005518/3f1dbc73-da73-4c8c-813e-cae8c92f96d8) + +This is a custom scaleform that allows you to add as many overlays (textures) as you want to the ingame Map and Minimap, useful for custom maps and blips! + +```c# +Main.MinimapOverlays +``` + +```lua +ScaleformUI.Scaleforms.MinimapOverlays +``` + +## Functions + +```c# +public static async Task AddSizedOverlayToMap(string textureDict, string textureName, float x, float y, float rotation = 0, float width = -1, float height = -1, int alpha = 100, bool centered = false) {} +public static async Task AddScaledOverlayToMap(string textureDict, string textureName, float x, float y, float rotation = 0, float xScale = 100f, float yScale = 100f, int alpha = 100, bool centered = false) {} +public static void SetOverlayColor(int overlayId, SColor color) {} +public static void HideOverlay(int overlayId, bool hide) {} +public static void SetOverlayAlpha(int overlayId, float alpha) {} +public static void SetOverlayPosition(int overlayId, Vector2 pos) {} +public static void SetOverlayPosition(int overlayId, float x, float y) {} +public static void SetOverlayPosition(int overlayId, float[] pos) {} +public static void SetOverlaySizeOrScale(int overlayId, SizeF size) {} +public static void SetOverlaySizeOrScale(int overlayId, float w, float h) {} +public static void SetOverlaySizeOrScale(int overlayId, float[] size) {} +public static void SetOverlayRotation(int overlayId, float rotation) {} +public static async void RemoveOverlayFromMinimap(int overlayId) {} +public static void ClearAll() {} +``` + +```lua +function MinimapOverlays:AddSizedOverlayToMap(textureDict, textureName, x, y, rotation, width, height, alpha, centered) +function MinimapOverlays:AddScaledOverlayToMap(textureDict, textureName, x, y, rotation, xScale, yScale, alpha, centered) +function MinimapOverlays:SetOverlayColor(overlayId, color) +function MinimapOverlays:HideOverlay(overlayId, hide) +function MinimapOverlays:SetOverlayAlpha(overlayId, alpha) +function MinimapOverlays:SetOverlayPosition(overlayId, position) +function MinimapOverlays:SetOverlaySizeOrScale(overlayId, width, height) +function MinimapOverlays:RemoveOverlayFromMinimap(overlayId) +function MinimapOverlays:ClearAll() +``` + +## Minimap Overlay +Adding an overlay generates a `MinimapOverlay` item. +The `MinimapOverlay` item is a very simple class, it contains all the info of your added overlay. + +### Minimap Overlay Parameters +```c# +public bool Visible +public int Handle { get; set; } +public string Txd { get; set; } +public string Txn { get; set; } +public SColor Color { get; set; } +public Vector2 Position { get; set; } +public float Rotation { get; set; } +public SizeF Size { get; set; } +public float Alpha { get; set; } +public bool Centered { get; set; } +``` + +```lua +overlay.Handle +overlay.Txd +overlay.Txn +overlay.Color +overlay.Position +overlay.Rotation +overlay.Size +overlay.Alpha +overlay.Centered +``` \ No newline at end of file diff --git a/docs/Scaleforms/MissionSelector.md b/docs/Scaleforms/MissionSelector.md new file mode 100644 index 00000000..02f82f4d --- /dev/null +++ b/docs/Scaleforms/MissionSelector.md @@ -0,0 +1,353 @@ +--- +layout: default +title: Mission Selector +parent: Scaleforms API +show_buttons: true +show_all_code: false +--- + +# Mission Selector +![image](https://github.com/manups4e/ScaleformUI/assets/4005518/4dff1186-cd1e-4685-b77b-8101fe8859f1) + +The mission selector handler implements the use of the JobSelectionButton, JobSelectionCard and MissionDetailsItem (details below) + +```c# +Main.JobMissionSelection +``` + +```lua +ScaleformUI.Scaleforms.JobMissionSelector +``` + +## Features + +```c# +int[] Votes // up to 9 votes (6 cards + 3 buttons) +int VotedFor +int MaxVotes +int SelectedCard +HudColor VotesColor // defaulted to HudColor.HUD_COLOUR_BLUE +JobSelectionTitle JobTitle +List Cards // 6 cards +List Buttons // 3 buttons +bool Enabled +bool AlreadyVoted +void SetTitle(string title) +void SetVotes(int actual, string label = "") +void AddCard(JobSelectionCard card) +void AddButton(JobSelectionButton button) +void ShowPlayerVote(int idx, string playerName, HudColor color, bool showCheckMark = false, bool flashBG = false) +``` + +```lua +.Votes +.VotedFor +.VotesColor -- default Colours.HUD_COLOUR_BLUE +:SetTitle(title) +:SetVotes(actual, label) +:AddCard(card) +:AddButton(button) +:Enabled(bool) +:AlreadyVoted() +:ShowPlayerVote(idx, playerName, color, showCheckMark, flashBG) +``` + +Example code for the Mission Selector + +```c# +if (ScaleformUI.Main.JobMissionSelection.Enabled) +{ + ScaleformUI.Main.JobMissionSelection.Enabled = false; + return; +} + +long txd = API.CreateRuntimeTxd("test"); +long _paneldui = API.CreateDui("https://i.imgur.com/mH0Y65C.gif", 288, 160); +API.CreateRuntimeTextureFromDuiHandle(txd, "panelbackground", API.GetDuiHandle(_paneldui)); + +ScaleformUI.Main.JobMissionSelection.SetTitle("MISSION SELECTOR"); +ScaleformUI.Main.JobMissionSelection.MaxVotes = 3; +ScaleformUI.Main.JobMissionSelection.SetVotes(0, "VOTES"); +ScaleformUI.Main.JobMissionSelection.Cards = new List(); + +JobSelectionCard card = new JobSelectionCard("Test 1", "~y~Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat", "test", "panelbackground", 12, 15, JobSelectionCardIcon.BASE_JUMPING, HudColor.HUD_COLOUR_FREEMODE, 2, new List() +{ + new MissionDetailsItem("Left Label", "Right Label", 0, HudColor.HUD_COLOUR_FREEMODE), + new MissionDetailsItem("Left Label", "Right Label", (JobIcon)1, HudColor.HUD_COLOUR_GOLD), + new MissionDetailsItem("Left Label", "Right Label", (JobIcon)2, HudColor.HUD_COLOUR_PURPLE), + new MissionDetailsItem("Left Label", "Right Label", (JobIcon)3, HudColor.HUD_COLOUR_GREEN), + new MissionDetailsItem("Left Label", "Right Label", (JobIcon)4, HudColor.HUD_COLOUR_WHITE, true), +}); +ScaleformUI.Main.JobMissionSelection.AddCard(card); + +JobSelectionCard card1 = new JobSelectionCard("Test 2", "~y~Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat", "test", "panelbackground", 12, 15, JobSelectionCardIcon.BASE_JUMPING, HudColor.HUD_COLOUR_FREEMODE, 2, new List() +{ + new MissionDetailsItem("Left Label", "Right Label", (JobIcon)5, HudColor.HUD_COLOUR_FREEMODE), + new MissionDetailsItem("Left Label", "Right Label", (JobIcon)6, HudColor.HUD_COLOUR_GOLD), + new MissionDetailsItem("Left Label", "Right Label", (JobIcon)7, HudColor.HUD_COLOUR_PURPLE), + new MissionDetailsItem("Left Label", "Right Label", (JobIcon)8, HudColor.HUD_COLOUR_GREEN), + new MissionDetailsItem("Left Label", "Right Label", (JobIcon)9, HudColor.HUD_COLOUR_WHITE, true), +}); +ScaleformUI.Main.JobMissionSelection.AddCard(card1); + +JobSelectionCard card2 = new JobSelectionCard("Test 3", "~y~Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat", "test", "panelbackground", 12, 15, JobSelectionCardIcon.BASE_JUMPING, HudColor.HUD_COLOUR_FREEMODE, 2, new List() +{ + new MissionDetailsItem("Left Label", "Right Label", (JobIcon)10, HudColor.HUD_COLOUR_FREEMODE), + new MissionDetailsItem("Left Label", "Right Label", (JobIcon)11, HudColor.HUD_COLOUR_GOLD), + new MissionDetailsItem("Left Label", "Right Label", (JobIcon)12, HudColor.HUD_COLOUR_PURPLE), + new MissionDetailsItem("Left Label", "Right Label", (JobIcon)13, HudColor.HUD_COLOUR_GREEN), + new MissionDetailsItem("Left Label", "Right Label", (JobIcon)14, HudColor.HUD_COLOUR_WHITE, true), +}); +ScaleformUI.Main.JobMissionSelection.AddCard(card2); + +JobSelectionCard card3 = new JobSelectionCard("Test 4", "~y~Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat", "test", "panelbackground", 12, 15, JobSelectionCardIcon.BASE_JUMPING, HudColor.HUD_COLOUR_FREEMODE, 2, new List() +{ + new MissionDetailsItem("Left Label", "Right Label", (JobIcon)15, HudColor.HUD_COLOUR_FREEMODE), + new MissionDetailsItem("Left Label", "Right Label", (JobIcon)16, HudColor.HUD_COLOUR_GOLD), + new MissionDetailsItem("Left Label", "Right Label", (JobIcon)17, HudColor.HUD_COLOUR_PURPLE), + new MissionDetailsItem("Left Label", "Right Label", (JobIcon)18, HudColor.HUD_COLOUR_GREEN), + new MissionDetailsItem("Left Label", "Right Label", (JobIcon)19, HudColor.HUD_COLOUR_WHITE, true), +}); +ScaleformUI.Main.JobMissionSelection.AddCard(card3); + +JobSelectionCard card4 = new JobSelectionCard("Test 5", "~y~Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat", "test", "panelbackground", 12, 15, JobSelectionCardIcon.BASE_JUMPING, HudColor.HUD_COLOUR_FREEMODE, 2, new List() +{ + new MissionDetailsItem("Left Label", "Right Label", (JobIcon)20, HudColor.HUD_COLOUR_FREEMODE), + new MissionDetailsItem("Left Label", "Right Label", (JobIcon)21, HudColor.HUD_COLOUR_GOLD), + new MissionDetailsItem("Left Label", "Right Label", (JobIcon)22, HudColor.HUD_COLOUR_PURPLE), + new MissionDetailsItem("Left Label", "Right Label", (JobIcon)23, HudColor.HUD_COLOUR_GREEN), + new MissionDetailsItem("Left Label", "Right Label", (JobIcon)24, HudColor.HUD_COLOUR_WHITE, true), +}); +ScaleformUI.Main.JobMissionSelection.AddCard(card4); + +JobSelectionCard card5 = new JobSelectionCard("Test 6", "~y~Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat", "test", "panelbackground", 12, 15, JobSelectionCardIcon.BASE_JUMPING, HudColor.HUD_COLOUR_FREEMODE, 2, new List() +{ + new MissionDetailsItem("Left Label", "Right Label", 0, HudColor.HUD_COLOUR_FREEMODE), + new MissionDetailsItem("Left Label", "Right Label", (JobIcon)1, HudColor.HUD_COLOUR_GOLD), + new MissionDetailsItem("Left Label", "Right Label", (JobIcon)2, HudColor.HUD_COLOUR_PURPLE), + new MissionDetailsItem("Left Label", "Right Label", (JobIcon)3, HudColor.HUD_COLOUR_GREEN), + new MissionDetailsItem("Left Label", "Right Label", (JobIcon)4, HudColor.HUD_COLOUR_WHITE, true), +}); +ScaleformUI.Main.JobMissionSelection.AddCard(card5); + +ScaleformUI.Main.JobMissionSelection.Buttons = new List() +{ + new JobSelectionButton("Test1", "description test", new List()) {Selectable = false }, + + new JobSelectionButton("Test2", "description test", new List()) {Selectable = false }, + + new JobSelectionButton("Test3", "description test", new List()) {Selectable = true }, +}; +ScaleformUI.Main.JobMissionSelection.Buttons[0].OnButtonPressed += () => +{ + Screen.ShowSubtitle($"Button Pressed => {ScaleformUI.Main.JobMissionSelection.Buttons[0].Text}"); +}; + +ScaleformUI.Main.JobMissionSelection.Enabled = true; + +await Delay(1000); +ScaleformUI.Main.JobMissionSelection.ShowPlayerVote(2, "PlayerName", HudColor.HUD_COLOUR_GREEN, true, true); +``` + +```lua +local MissionSelectorVisible = false +function CreateMissionSelectorMenu() + + MissionSelectorVisible = not MissionSelectorVisible + + if not MissionSelectorVisible then + ScaleformUI.Scaleforms.JobMissionSelector:Enabled(false) + return + end + + local txd = CreateRuntimeTxd("test") + local _paneldui = CreateDui("https://i.imgur.com/mH0Y65C.gif", 288, 160) + CreateRuntimeTextureFromDuiHandle(txd, "panelbackground", GetDuiHandle(_paneldui)) + + ScaleformUI.Scaleforms.JobMissionSelector:SetTitle("MISSION SELECTOR") + ScaleformUI.Scaleforms.JobMissionSelector.MaxVotes = 3 + ScaleformUI.Scaleforms.JobMissionSelector:SetVotes(0, "VOTED") + ScaleformUI.Scaleforms.JobMissionSelector.Cards = {} + + local card = JobSelectionCard.New("Test 1", "~y~Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat", "test", "panelbackground", 12, 15, JobSelectionCardIcon.BASE_JUMPING, Colours.HUD_COLOUR_FREEMODE, 2, { + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.GTAOMission, Colours.HUD_COLOUR_FREEMODE), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.Deathmatch, Colours.HUD_COLOUR_GOLD), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.RaceFinish, Colours.HUD_COLOUR_PURPLE), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.GTAOSurvival, Colours.HUD_COLOUR_GREEN), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.TeamDeathmatch, Colours.HUD_COLOUR_WHITE, true), + }) + ScaleformUI.Scaleforms.JobMissionSelector:AddCard(card) + + local card1 = JobSelectionCard.New("Test 2", "~y~Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat", "test", "panelbackground", 12, 15, JobSelectionCardIcon.BASE_JUMPING, Colours.HUD_COLOUR_FREEMODE, 2, { + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.GTAOMission, Colours.HUD_COLOUR_FREEMODE), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.Deathmatch, Colours.HUD_COLOUR_GOLD), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.RaceFinish, Colours.HUD_COLOUR_PURPLE), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.GTAOSurvival, Colours.HUD_COLOUR_GREEN), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.TeamDeathmatch, Colours.HUD_COLOUR_WHITE, true), + }) + ScaleformUI.Scaleforms.JobMissionSelector:AddCard(card1) + + local card2 = JobSelectionCard.New("Test 3", "~y~Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat", "test", "panelbackground", 12, 15, JobSelectionCardIcon.BASE_JUMPING, Colours.HUD_COLOUR_FREEMODE, 2, { + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.GTAOMission, Colours.HUD_COLOUR_FREEMODE), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.Deathmatch, Colours.HUD_COLOUR_GOLD), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.RaceFinish, Colours.HUD_COLOUR_PURPLE), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.GTAOSurvival, Colours.HUD_COLOUR_GREEN), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.TeamDeathmatch, Colours.HUD_COLOUR_WHITE, true), + }) + ScaleformUI.Scaleforms.JobMissionSelector:AddCard(card2) + + local card3 = JobSelectionCard.New("Test 4", "~y~Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat", "test", "panelbackground", 12, 15, JobSelectionCardIcon.BASE_JUMPING, Colours.HUD_COLOUR_FREEMODE, 2, { + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.GTAOMission, Colours.HUD_COLOUR_FREEMODE), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.Deathmatch, Colours.HUD_COLOUR_GOLD), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.RaceFinish, Colours.HUD_COLOUR_PURPLE), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.GTAOSurvival, Colours.HUD_COLOUR_GREEN), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.TeamDeathmatch, Colours.HUD_COLOUR_WHITE, true), + }) + ScaleformUI.Scaleforms.JobMissionSelector:AddCard(card3) + + local card4 = JobSelectionCard.New("Test 5", "~y~Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat", "test", "panelbackground", 12, 15, JobSelectionCardIcon.BASE_JUMPING, Colours.HUD_COLOUR_FREEMODE, 2, { + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.GTAOMission, Colours.HUD_COLOUR_FREEMODE), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.Deathmatch, Colours.HUD_COLOUR_GOLD), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.RaceFinish, Colours.HUD_COLOUR_PURPLE), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.GTAOSurvival, Colours.HUD_COLOUR_GREEN), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.TeamDeathmatch, Colours.HUD_COLOUR_WHITE, true), + }) + ScaleformUI.Scaleforms.JobMissionSelector:AddCard(card4) + + local card5 = JobSelectionCard.New("Test 6", "~y~Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat", "test", "panelbackground", 12, 15, JobSelectionCardIcon.BASE_JUMPING, Colours.HUD_COLOUR_FREEMODE, 2, { + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.GTAOMission, Colours.HUD_COLOUR_FREEMODE), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.Deathmatch, Colours.HUD_COLOUR_GOLD), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.RaceFinish, Colours.HUD_COLOUR_PURPLE), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.GTAOSurvival, Colours.HUD_COLOUR_GREEN), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.TeamDeathmatch, Colours.HUD_COLOUR_WHITE, true), + }) + ScaleformUI.Scaleforms.JobMissionSelector:AddCard(card5) + + ScaleformUI.Scaleforms.JobMissionSelector.Buttons = { + JobSelectionButton.New("Button 1", "description test", { + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.GTAOMission, Colours.HUD_COLOUR_FREEMODE), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.Deathmatch, Colours.HUD_COLOUR_GOLD), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.RaceFinish, Colours.HUD_COLOUR_PURPLE), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.GTAOSurvival, Colours.HUD_COLOUR_GREEN), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.TeamDeathmatch, Colours.HUD_COLOUR_WHITE, true), + }), + JobSelectionButton.New("Button 2", "description test", { + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.GTAOMission, Colours.HUD_COLOUR_FREEMODE), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.Deathmatch, Colours.HUD_COLOUR_GOLD), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.RaceFinish, Colours.HUD_COLOUR_PURPLE), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.GTAOSurvival, Colours.HUD_COLOUR_GREEN), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.TeamDeathmatch, Colours.HUD_COLOUR_WHITE, true), + }), + JobSelectionButton.New("Button 3", "description test", { + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.GTAOMission, Colours.HUD_COLOUR_FREEMODE), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.Deathmatch, Colours.HUD_COLOUR_GOLD), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.RaceFinish, Colours.HUD_COLOUR_PURPLE), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.GTAOSurvival, Colours.HUD_COLOUR_GREEN), + MissionDetailsItem.New("Left Label", "Right Label", false, JobIcon.TeamDeathmatch, Colours.HUD_COLOUR_WHITE, true), + }), + } + ScaleformUI.Scaleforms.JobMissionSelector.Buttons[1].Selectable = false + ScaleformUI.Scaleforms.JobMissionSelector.Buttons[2].Selectable = false + ScaleformUI.Scaleforms.JobMissionSelector.Buttons[3].Selectable = true + + ScaleformUI.Scaleforms.JobMissionSelector.Buttons[1].OnButtonPressed = function() + ScaleformUI.Notifications:ShowSubtitle("Button Pressed => " .. ScaleformUI.Scaleforms.JobMissionSelector.Buttons[1].Text) + end + ScaleformUI.Scaleforms.JobMissionSelector:Enabled(true) + + Citizen.Wait(1000) + ScaleformUI.Scaleforms.JobMissionSelector:ShowPlayerVote(3, "PlayerName", Colours.HUD_COLOUR_GREEN, true, true) +end +``` + +### JobSelectionCard + +```c# +string Title +string Description +string Txd +string Txn +int RpMultiplier +int CashMultiplier +JobSelectionCardIcon Icon +HudColor IconColor +int ApMultiplier +List Details // not more than 4!! + +JobSelectionCard(string title, string description, string txd, string txn, int rpMult, int cashMult, JobSelectionCardIcon icon, HudColor iconColor, int apMultiplier, List details) +``` + +```lua +---@param title string +---@param description string +---@param txd string +---@param txn string +---@param rpMult number +---@param cashMult number +---@param icon JobSelectionCardIcon +---@param iconColor Colours +---@param apMultiplier number +---@param details table +JobSelectionCard.New(title, description, txd, txn, rpMult, cashMult, icon, iconColor, apMultiplier, details) +---@field public Title string +---@field public Description string +---@field public Txd string +---@field public Txn string +---@field public RpMultiplier number +---@field public CashMultiplier number +---@field public Icon JobSelectionCardIcon +---@field public IconColor Colours +---@field public ApMultiplier number +---@field public Details table -- not more than 4!! +``` +### JobSelectionButton + + +```c# +string Text +string Description +List // NOT MORE THAN 5 +JobSelectionButtonEvent OnButtonPressed +JobSelectionButton(string text, string description, List details) +``` + +```lua +---@param title string +---@param description string +---@param details table +JobSelectionButton.New(title, description, details) +---@field public Text string +---@field public Description string +---@field public Details table -- NOT MORE THAN 5 +---@field public OnButtonPressed fun(self: JobSelectionButton) +``` +### MissionDetailsItem + + +```c# +JobIcon Icon +string TextLeft +string TextRight +HudColor IconColor +int Type +bool Tick +MissionDetailsItem(string textLeft, string textRight, bool separator) +MissionDetailsItem(string textLeft, string textRight, JobIcon icon, HudColor iconColor = HudColor.NONE, bool tick = false) +``` + +```lua +---@param textLeft string +---@param textRight string +---@param seperator boolean +---@param icon JobIcon +---@param iconColor Colours +---@param tick boolean +MissionDetailsItem.New(textLeft, textRight, seperator, icon, iconColor, tick) + +---@field public Type number +---@field public TextLeft string +---@field public TextRight string +---@field public Icon JobIcon +---@field public IconColor Colours +---@field public Tick boolean +``` diff --git a/docs/Scaleforms/PlayerList.md b/docs/Scaleforms/PlayerList.md new file mode 100644 index 00000000..f5dad2e1 --- /dev/null +++ b/docs/Scaleforms/PlayerList.md @@ -0,0 +1,60 @@ +--- +layout: default +title: Player List +parent: Scaleforms API +show_buttons: true +show_all_code: false +--- + +# Player List +![image](https://github.com/user-attachments/assets/74a0970e-4303-4b3f-aa91-1d80136e8d8a) + +```c# +Main.PlayerListHandler +``` + +```lua +ScaleformUI.Scaleforms.PlayerListHandler +``` + +## Features +To show and draw the player list you simply have to set CurrentPage to > 0 or use NextPage to let the API handle it. + +```c# +public List PlayerRows { get; set; } +public int CurrentPage { get; set; } +public string TitleLeftText { get; set; } +public string TitleRightText { get; set; } +public int TitleIcon { get; set; } +public void SetTitle(string left, string right, int icon) +public void AddRow(PlayerRow row) +public void RemoveRow(PlayerRow row) +public void RemoveRow(int serverId) +public void NextPage() +public void SetHighlight(int idx) +public void DisplayMic(int idx, int unk) +public void UpdateSlot(PlayerRow row) +public void SetIcon(int index, ScoreRightIconType icon, string txt) +``` + +```lua +---@field public Enabled boolean +---@field public Index number +---@field public MaxPages number +---@field public currentPage number +---@field public PlayerRows table +---@field public TitleLeftText string +---@field public TitleRightText string +---@field public TitleIcon number +---@field public X number +---@field public Y number +---@field public Update fun():nil +---@field public NextPage fun():nil +---@field public AddRow fun(row:SCPlayerItem):nil +---@field public RemoveRow fun(index:number):nil +---@field public CurrentPage fun(_c:number?):number +---@field public Dispose fun():nil +---@field public Load fun():nil +---@field public SetTitle fun(title:string, label:string, icon:number):nil +---@field public SetPosition fun(x:number, y:number):nil +``` \ No newline at end of file diff --git a/docs/Scaleforms/index.md b/docs/Scaleforms/index.md new file mode 100644 index 00000000..346bb4e1 --- /dev/null +++ b/docs/Scaleforms/index.md @@ -0,0 +1,10 @@ +--- +layout: default +title: Scaleforms API +show_buttons: false +show_all_code: true +--- + +# ScaleformUI - InGame Scaleforms API + +ScaleformUI provides a **static** user-friendly API to manage different scaleforms within your game. \ No newline at end of file diff --git a/docs/Scaleforms/rankbar.md b/docs/Scaleforms/rankbar.md new file mode 100644 index 00000000..887fe6f1 --- /dev/null +++ b/docs/Scaleforms/rankbar.md @@ -0,0 +1,42 @@ +--- +layout: default +title: Rankbar +parent: Scaleforms API +show_buttons: true +show_all_code: false +--- + +# Rankbar +![image](https://github.com/manups4e/ScaleformUI/assets/4005518/92dab93d-b602-42e3-b8c2-302f26b190e8) + +```c# +Main.RankBarInstance +``` + +```lua +ScaleformUI.Scaleforms.RankbarHandler +``` + +## Features + +```c# +HudColor Color // Set the color of the Rank Bar when displayed +void SetScores(int limitStart, int limitEnd, int previousValue, int currentValue, int currentRank) // Shows the rank bar +/// Floor value of experience e.g. 0 +/// Ceiling value of experience e.g. 800 +/// Previous Experience value +/// New Experience value +/// Current rank +void Remove() +void OverrideAnimationSpeed(int speed = 1000) +void OverrideOnscreenDuration(int duration = 4000) +``` + +Functions available for Lua: +```lua +---@field public SetScores fun(limitStart:number, limitEnd:number, previousValue:number, currentValue:number, currentRank:number):nil +---@field public SetColour fun(rankBarColor:number):nil +---@field public Remove fun():nil +---@field public OverrideAnimationSpeed fun(speed:number):nil +---@field public OverrideOnscreenDuration fun(duration:number):nil +``` \ No newline at end of file diff --git a/docs/Scaleforms/warningscreen.md b/docs/Scaleforms/warningscreen.md new file mode 100644 index 00000000..6ef76b3f --- /dev/null +++ b/docs/Scaleforms/warningscreen.md @@ -0,0 +1,38 @@ +--- +layout: default +title: Warning Screen +parent: Scaleforms API +show_buttons: true +show_all_code: false +--- + +# Warning Screen +![image](https://user-images.githubusercontent.com/4005518/162582803-87963fe6-7ea2-4ef4-896a-65a579f755b3.png) + +The Warning screen is a customizable screen that can be updated on the go and is compatible with instructionalButtons to make the user decide the action they wants to make. + +```c# +Main.Warning +``` + +```lua +ScaleformUI.Scaleforms.Warning +``` + +## Functions + +```c# +ShowWarning(string title, string subtitle, string prompt = "", string errorMsg = "", WarningPopupType type = WarningPopupType.Classic) +ShowWarningWithButtons(string title, string subtitle, string prompt, List buttons, string errorMsg = "", WarningPopupType type = WarningPopupType.Classic) +UpdateWarning(string title, string subtitle, string prompt = "", string errorMsg = "", WarningPopupType type = WarningPopupType.Classic) +Dispose() // used to stop showing the Warning +OnButtonPressed (InstructionalButton button) // this is an event called if one of the instructional buttons available are pressed while the warning is showing +``` + +```lua +ShowWarning(title, subtitle, prompt, errorMsg, warningType) +ShowWarningWithButtons(title, subtitle, prompt, buttons, errorMsg, warningType) +UpdateWarning(title, subtitle, prompt, errorMsg, warningType) +Dispose() -- used to stop showing the Warning +OnButtonPressed = function(button) end -- function called if one of the instructional buttons available are pressed while the warning is showing +``` diff --git a/docs/UIMenu/Events.md b/docs/UIMenu/Events.md new file mode 100644 index 00000000..abdc2993 --- /dev/null +++ b/docs/UIMenu/Events.md @@ -0,0 +1,248 @@ +--- +layout: default +title: Events +parent: UIMenu +show_buttons: true +show_all_code: false +--- + +# Menu Events +Menu events in **ScaleformUI** are specific triggers that allow developers to execute actions in response to user interactions with the menu. These events ensure that the menu system stays dynamic and responsive, improving the user experience. + +## OnIndexChange +Triggered when the user presses up or down, changing the current selection. + +```c# +public event IndexChangedEvent OnIndexChange; +``` + +```lua +--- Triggered when the user presses up or down, changing the current selection. +menu.OnIndexChange = function(menu, newindex) +end +``` + +--- + +## OnListChange +Triggered when the user presses left or right, changing a list position. + +```c# +public event ListChangedEvent OnListChange; +``` + +```lua +--- Triggered when the user presses left or right, changing a list position. +menu.OnListChange = function(menu, list, newindex) +end +``` + +--- + +## OnSliderChange +Triggered when the user presses left or right, changing a slider position. + +```c# +public event SliderChangedEvent OnSliderChange; +``` + +```lua +--- Triggered when the user presses left or right, changing a slider position. +menu.OnSliderChange = function(menu, slider, newindex) +end +``` + +--- + +## OnProgressChange +Triggered when the user changes the value of a progress item. + +```c# +public event OnProgressChanged OnProgressChange; +``` + +```lua +--- Triggered when the user changes the value of a progress item. +menu.OnProgressChange = function(menu, progress, newindex) +end +``` + +--- + +## OnCheckboxChange +Triggered when the user presses enter on a checkbox item. + +```c# +public event CheckboxChangeEvent OnCheckboxChange; +``` + +```lua +--- Triggered when the user presses enter on a checkbox item. +menu.OnCheckboxChange = function(menu, item, checked) +end +``` + +--- + +## OnListSelect +Triggered when the user selects a list item. + +```c# +public event ListSelectedEvent OnListSelect; +``` + +```lua +--- Triggered when the user selects a list item. +menu.OnListSelect = function(menu, list, index) +end +``` + +--- + +## OnSliderSelect +Triggered when the user selects a slider item. + +```c# +public event SliderSelectedEvent OnSliderSelect; +``` + +```lua +--- Triggered when the user selects a slider item. +menu.OnSliderSelect = function(menu, slider, index) +end +``` + +--- + +## OnProgressSelect +Triggered when the user selects a progress item. + +```c# +public event OnProgressSelected OnProgressSelect; +``` + +```lua +--- Triggered when the user selects a progress item. +menu.OnProgressSelect = function(menu, progress, index) +end +``` + +--- + +## OnStatsSelect +Triggered when the user selects a stats item. + +```c# +public event StatItemProgressChange OnStatsItemChanged; +``` + +```lua +--- Triggered when the user selects a stats item. +menu.OnStatsSelect = function(menu, progress, index) +end +``` + +--- + +## OnItemSelect +Triggered when the user selects a simple item. + +```c# +public event ItemSelectEvent OnItemSelect; +``` + +```lua +--- Triggered when the user selects a simple item. +menu.OnItemSelect = function(menu, item, index) +end +``` + +--- + +## OnMenuOpen +Triggered when the menu is opened. + +```c# +public event MenuOpenedEvent OnMenuOpen; +``` + +```lua +--- Triggered when the menu is opened. +menu.OnMenuOpen = function(menu) +end +``` + +--- + +## OnMenuClose +Triggered when the menu is closed. + +```c# +public event MenuClosedEvent OnMenuClose; +``` + +```lua +--- Triggered when the menu is closed. +menu.OnMenuClose = function(menu) +end +``` + +--- + +## OnColorPanelChanged +Triggered when the user changes the index of a color panel. + +```c# +public event ColorPanelChangedEvent OnColorPanelChange; +``` + +```lua +--- Triggered when the user changes the index of a color panel. +menu.OnColorPanelChanged = function(menu, item, index) +end +``` + +--- + +## OnPercentagePanelChanged +Triggered when the user changes the value of a percentage panel. + +```c# +public event PercentagePanelChangedEvent OnPercentagePanelChange; +``` + +```lua +--- Triggered when the user changes the value of a percentage panel. +menu.OnPercentagePanelChanged = function(menu, item, index) +end +``` + +--- + +## OnGridPanelChanged +Triggered when the user changes the value of a grid panel. + +```c# +public event GridPanelChangedEvent OnGridPanelChange; +``` + +```lua +--- Triggered when the user changes the value of a grid panel. +menu.OnGridPanelChanged = function(menu, item, index) +end +``` + +--- + +## ExtensionMethod +Triggered to run a custom method for extending the menu behavior. + +```c# +public event ExtensionMethodEvent ExtensionMethod; +``` + +```lua +--- Triggered to run a custom method for extending the menu behavior. +menu.ExtensionMethod = function(menu) +end +``` diff --git a/docs/UIMenu/Functions.md b/docs/UIMenu/Functions.md new file mode 100644 index 00000000..56967f0a --- /dev/null +++ b/docs/UIMenu/Functions.md @@ -0,0 +1,337 @@ +--- +layout: default +title: Functions +parent: UIMenu +show_buttons: true +show_all_code: false +--- + +# Functions +This section will show you UIMenu public functions and the use you can do with them. Examples are shown in C# and in Lua. + +## Set Menu Offset +Sets the position offset for the menu. + +{: .warning} +> ⚠️ Warning +> +> Position is safezone dependant and positive values will shift the menu to the **right when Left aligned** and to the **left when Right aligned**! + +```c# +void SetMenuOffset(Vector2 position) + +Vector2 position = new Vector2(0, 0); +menu.SetMenuOffset(position); +``` + +```lua +---Sets the position offset for the menu. +---@param x number +---@param y number +menu:SetMenuOffset(x, y) +``` + +## Refresh Menu +Refreshes the menu, optionally keeping the current selection index. + +```c# +void RefreshMenu(bool keepIndex) +menu.RefreshMenu(keepIndex) +``` + +```lua +---Refreshes the menu, optionally keeping the current selection index. +---@param keepIndex boolean +menu:RefreshMenu(keepIndex) +``` + +## Set Banner Sprite +Sets the banner sprite using a dictionary and name. + +```c# +void SetBannerSprite(KeyValuePair spriteInfo) +menu.SetBannerSprite(new KeyValuePair("txtDictionary", "txtName")) +``` + +```lua +---Sets the banner sprite using a dictionary and name. +---@param txtDictionary string +---@param txtName string +menu:SetBannerSprite(txtDictionary, txtName) +``` + +## Set Banner Color +Sets the banner color for the menu. + +```c# +void SetBannerColor(SColor color) +menu.SetBannerColor(color) +``` + +```lua +---Sets the banner color for the menu. +---@param color SColor +menu:SetBannerColor(color) +``` + +## Set Animations +Handles all the menu animations in one place. + +```c# +void SetAnimations(bool enableScrollingAnim, bool enable3DAnim, MenuAnimationType scrollingAnimation, MenuBuildingAnimation buildingAnimation, float fadingTime) +menu.SetAnimations(enableScrollingAnim, enable3DAnim, scrollingAnimation, buildingAnimation, fadingTime) +``` + +```lua +---Handles all the menu animations in one place. +---@param enableScrollingAnim boolean +---@param enable3DAnim boolean +---@param scrollingAnimation MenuAnimationType +---@param buildingAnimation MenuBuildingAnimation +---@param fadingTime number +menu:SetMenuAnimations(enableScrollingAnim, enable3DAnim, scrollingAnimation, buildingAnimation, fadingTime) +``` + +## Add Window +Adds a window to the menu, only if the menu is not itemless. + +```c# +void AddWindow(UIMenuWindow window) +menu.AddWindow(window) +``` + +```lua +---Adds a window to the menu, only if the menu is not itemless. +---@param window table +menu:AddWindow(window) +``` + +## Remove Window At +Removes a window from the menu at a specified index. + +```c# +void RemoveWindowAt(int index) +menu.RemoveWindowAt(index) +``` + +```lua +---Removes a window from the menu at a specified index. +---@param Index number +menu:RemoveWindowAt(Index) +``` + +## Add Item +Adds a new item to the menu. + +```c# +void AddItem(UIMenuItem item) +menu.AddItem(item) +``` + +```lua +--- Adds a new item to the menu. +---@param item UIMenuItem +---@see UIMenuItem +menu:AddItem(item) +``` + +## Add Item At +Adds an item at a specified index in the menu. + +```c# +void AddItemAt(UIMenuItem item, int index) +menu.AddItemAt(item, index) +``` + +```lua +--- Adds an item at a specified index in the menu. +---@param item UIMenuItem +---@param index number +menu:AddItemAt(item, index) +``` + +## Remove Item At +Removes an item from the menu at a specified index. + +```c# +void RemoveItemAt(int index) +menu.RemoveItemAt(index) +``` + +```lua +--- Removes an item from the menu at a specified index. +---@param index number +menu:RemoveItemAt(index) +``` + +## Remove Item +Removes an item from the menu by matching its label. + +```c# +void RemoveItem(UIMenuItem item) +menu.RemoveItem(item) +``` + +```lua +--- Removes an item from the menu by matching its label. +---@param item UIMenuItem +menu:RemoveItem(item) +``` + +## Clear +Removes all items from the menu. + +```c# +void Clear() +menu.Clear() +``` + +```lua +--- Removes all items from the menu. +menu:Clear() +``` + +## Switch To +Switches from the current menu to a new menu. + +```c# +void SwitchTo(UIMenu newMenu, int newMenuCurrentSelection = 1, bool inheritOldMenuParams = true) +menu.SwitchTo(newMenu, newMenuCurrentSelection, inheritOldMenuParams) +``` + +```lua +--- Switches from the current menu to a new menu. +---@param newMenu UIMenu +---@param newMenuCurrentSelection number|nil +---@param inheritOldMenuParams boolean|nil +menu:SwitchTo(newMenu, newMenuCurrentSelection, inheritOldMenuParams) +``` + +## Set Mouse +Configures mouse settings for the menu. + +```c# +void SetMouse(bool enableMouseControls, bool enableEdge, bool isWheelEnabled, bool resetCursorOnOpen, bool leftClickSelect) +menu.SetMouse(enableMouseControls, enableEdge, isWheelEnabled, resetCursorOnOpen, leftClickSelect) +``` + +```lua +--- Configures mouse settings for the menu. +---@param enableMouseControls boolean +---@param enableEdge boolean +---@param isWheelEnabled boolean +---@param resetCursorOnOpen boolean +---@param leftClickSelect boolean +menu:MouseSettings(enableMouseControls, enableEdge, isWheelEnabled, resetCursorOnOpen, leftClickSelect) +``` + +## Filter Menu Items +Filters menu items based on a predicate. + +```c# +void FilterMenuItems(Func predicate) +menu.FilterMenuItems(predicate); +``` + +```lua +--- Filters menu items based on a predicate. +---@param predicate function A function that returns true to keep an item. +---@param fail function A function that executes if no items match the filter. +menu:FilterMenuItems(predicate, fail) +``` + +--- + +## Sort Menu Items +Sorts menu items using a custom comparison function. + +```c# +void SortMenuItems(Comparison compare) +menu.SortMenuItems(compare); +``` + +```lua +--- Sorts menu items using a custom comparison function. +---@param compare function A function to compare two items. +menu:SortMenuItems(compare) +``` + +--- + +## Reset Filter +Resets the filtering/sorting of items, restoring the original order. + +```c# +void ResetFilter() +menu.ResetFilter(); +``` + +```lua +--- Resets the filtering/sorting of items, restoring the original order. +menu:ResetFilter() +``` + +## Update Description +Refreshes the menu description in case of changes without updating via Scaleform. + +```c# +void UpdateDescription() +menu.UpdateDescription(); +``` + +```lua +--- Refreshes the menu description in case of changes without updating via Scaleform. +function UIMenu:UpdateDescription() +``` + +## Instructional Buttons Management + +### AddInstructionButton +Adds an instructional button to the menu. + +```c# +void AddInstructionalButton(InstructionalButton button) +menu.AddInstructionalButton(button); +``` + +```lua +--- Adds an instructional button to the menu. +---@param button InstructionalButton +function UIMenu:AddInstructionButton(button) +``` + +--- + +### RemoveInstructionButton +Removes an instructional button from the menu. + +```c# +void RemoveInstructionalButton(InstructionalButton button) +menu.RemoveInstructionalButton(button); + +void RemoveInstructionalButton(int index) +menu.RemoveInstructionalButton(index); +``` + +```lua +--- Removes an instructional button from the menu. +---@param button table +function UIMenu:RemoveInstructionButton(button) +``` + +--- + +### ClearInstructionalButtons +Clears all instructional buttons from the menu. + +```c# +void ClearInstructionalButtons() +menu.ClearInstructionalButtons(); +``` + +```lua +--- Clears all instructional buttons from the menu. +function UIMenu:ClearInstructionalButtons() + self.InstructionalButtons = {} +end +``` diff --git a/docs/UIMenu/Items/index.md b/docs/UIMenu/Items/index.md new file mode 100644 index 00000000..eda81a69 --- /dev/null +++ b/docs/UIMenu/Items/index.md @@ -0,0 +1,11 @@ +--- +layout: default +title: Menu Items +parent: UIMenu +show_buttons: false +show_all_code: false +--- +# Menu Items +This section will explain each menu item and its functions, parameters, events. +They're very easy to get along with and are very dynamic and versatyle. +These items can also be used in Pause menus and Lobby menus. \ No newline at end of file diff --git a/docs/UIMenu/Items/uimenucheckboxitem.md b/docs/UIMenu/Items/uimenucheckboxitem.md new file mode 100644 index 00000000..93f6ff57 --- /dev/null +++ b/docs/UIMenu/Items/uimenucheckboxitem.md @@ -0,0 +1,62 @@ +--- +layout: default +title: UIMenuCheckboxItem +parent: Menu Items +show_buttons: true +show_all_code: false +--- + +# UIMenuCheckboxItem +![image](https://user-images.githubusercontent.com/4005518/162609521-a5a1f24a-9caf-4f6e-91c2-04e1916557aa.png) + +Shows a CheckBox on its right side and works as a true/false switch. +This item inherits all parameters, functions and events from UIMenuItem, adding new ones for its uses. + +## Constructor + +```c# +UIMenuCheckboxItem(string text, bool check) +UIMenuCheckboxItem(string text, bool check, string description) +UIMenuCheckboxItem(string text, UIMenuCheckboxStyle style, bool check, string description) +UIMenuCheckboxItem(string text, UIMenuCheckboxStyle style, bool check, string description, HudColor mainColor, HudColor highlightColor) +``` + +```lua +function UIMenuCheckboxItem.New(Text, Check, checkStyle, Description, color, highlightColor, textColor, highlightedTextColor) +``` + +## Parameters + +### Checkbox Style +```c# +UIMenuCheckboxStyle Style { get; } +``` + +```lua +local style = item.CheckBoxStyle +``` + +### Checked + +```c# +public bool Checked {get;set;} +item.Checked = true; +``` + +```lua +item:Checked(bool) +``` + +## Events + +### OnCheckboxChange +Triggered everytime a player selects the item after being highlighted, changing the checkbox value. + +```c# +public event CheckboxChangeEvent CheckboxEvent; +``` + +```lua +OnCheckboxChanged = function(menu, item, checked) +end, +``` diff --git a/docs/UIMenu/Items/uimenudynamiclistitem.md b/docs/UIMenu/Items/uimenudynamiclistitem.md new file mode 100644 index 00000000..ec11fad7 --- /dev/null +++ b/docs/UIMenu/Items/uimenudynamiclistitem.md @@ -0,0 +1,58 @@ +--- +layout: default +title: UIMenuDynamicListItem +parent: Menu Items +show_buttons: true +show_all_code: false +--- + +# UIMenuDynamicListItem +![image](https://user-images.githubusercontent.com/4005518/162609798-658d1efa-1358-4f23-9747-1b3cee3c23fb.png) + +This is a runtime handled version of the more static ListItem where you don't input a predefined list to the item, the right label is outputed by the callback code called everytime left/right is inputted. +This item can virtually output infinite values due to its runtime handling. + +{: .warning} +> ⚠️ Warning +> +> This item may change its name in future as it's scheduled for future updates to set [UIMenuListItem](./uimenulistitem.md) as Legacy and Obsolete and this as default List Item. + +## Constructor + +```c# +UIMenuDynamicListItem(string text, string startingItem, DynamicListItemChangeCallback changeCallback) +UIMenuDynamicListItem(string text, string description, string startingItem, DynamicListItemChangeCallback changeCallback) +``` + +```lua +UIMenuDynamicListItem.New(Text, Description, StartingString, callback, color, highlightColor, textColor, highlightedTextColor) +``` + +## Example + +```c# +float dynamicvalue = 0f; +dynamicItem = new UIMenuDynamicListItem("Dynamic List Item", "Try pressing ~INPUT_FRONTEND_LEFT~ or ~INPUT_FRONTEND_RIGHT~", dynamicvalue.ToString("F3"), async (sender, direction) => +{ + if (direction == UIMenuDynamicListItem.ChangeDirection.Left) dynamicvalue -= 0.01f; + else dynamicvalue += 0.01f; + return dynamicvalue.ToString("F3"); +}); +``` + +```lua +local dynamicValue = 0 +local dynamicListItem = UIMenuDynamicListItem.New("Dynamic List Item", "Try pressing ~INPUT_FRONTEND_LEFT~ or ~INPUT_FRONTEND_RIGHT~", tostring(dynamicValue), function(item, direction) + if(direction == "left") then + dynamicValue = dynamicValue -1 + elseif(direction == "right") then + dynamicValue = dynamicValue +1 + end + return tostring(dynamicValue) +end) +``` + +## How does this item work? +This item runtime handled. +The callback you set when instantiating it is the function called everytime left or right is pressed. +Pressing Left/Right will trigger the callback automatically, the callback **MUST** return a string that will be shown in the Right side of the item. \ No newline at end of file diff --git a/docs/UIMenu/Items/uimenuitem.md b/docs/UIMenu/Items/uimenuitem.md new file mode 100644 index 00000000..6da6384b --- /dev/null +++ b/docs/UIMenu/Items/uimenuitem.md @@ -0,0 +1,329 @@ +--- +layout: default +title: UIMenuItem +parent: Menu Items +show_buttons: true +show_all_code: false +nav_order: 1 +--- + +# UIMenuItem + +![UIMenuItem](https://user-images.githubusercontent.com/4005518/162608037-bc6e4c8e-a912-4465-bc8b-cfccedf6948d.png) + +**UIMenuItem** is the father of all other items, this means that every other menu-item has the same functions and features of this item except for some that are disabled for design reason. + +## Constructor + +```c# +public UIMenuItem(string text); +public UIMenuItem(string text, string description); +public UIMenuItem(string text, uint descriptionHash); +public UIMenuItem(string text, string description, HudColor mainColor, HudColor highlightColor); +public UIMenuItem(string text, uint descriptionHash, HudColor mainColor, HudColor highlightColor); +public UIMenuItem(string text, string description, HudColor color, HudColor highlightColor, HudColor textColor, HudColor highlightedTextColor); +public UIMenuItem(string text, uint descriptionHash, HudColor color, HudColor highlightColor, HudColor textColor, HudColor highlightedTextColor); +``` + +```lua +UIMenuItem.New(text, description, color, highlightColor, textColor, highlightedTextColor) +``` + +## Parameters + +### Selected +Sets or gets the selected state of the menu item, and updates the menu labels accordingly. + +```c# +public bool Selected {get;set;} +item.Selected = true; +``` + +```lua +--- Sets or gets the selected state of the menu item, and updates the menu labels accordingly. +item:Selected(bool) +``` + +--- + +### Hovered +Sets or gets the hovered state of the menu item. + +```c# +public bool Hovered {get;set;} +item.Hovered = true; +``` + +```lua +--- Sets or gets the hovered state of the menu item. +item:Hovered(bool) +``` + +--- + +### Enabled +Sets or gets the enabled state of the menu item, and updates the menu labels accordingly. + +```c# +public bool Enabled {get;set;} +item.Enabled = true; +``` + +```lua +--- Sets or gets the enabled state of the menu item, and updates the menu labels accordingly. +item:Enabled(bool) +``` + +--- + +### Description +Sets or gets the description for the menu item. + +```c# +public string Description {get;set;} +item.Description = "This is a description"; +``` + +```lua +--- Sets or gets the description for the menu item. +item:Description(str) +``` + +--- + +### MainColor +Sets or gets the main color for the menu item. + +```c# +public SColor MainColor {get;set;} +item.MainColor = SColor.FromArgb(255, 0, 0); +``` + +```lua +--- Sets or gets the main color for the menu item. +item:MainColor(color) +``` + +--- + +### TextColor +Sets or gets the text color for the menu item. + +```c# +public SColor TextColor {get;set;} +item.TextColor(SColor(0, 255, 0)); -- Green color +``` + +```lua +--- Sets or gets the text color for the menu item. +item:TextColor(color) +``` + +--- + +### HighlightColor +Sets or gets the highlight color for the menu item. + +```c# +public SColor HighlightColor {get;set;} +item.HighlightColor = SColor.FromArgb(0, 0, 255); +``` + +```lua +--- Sets or gets the highlight color for the menu item. +item:HighlightColor(color) +``` + +--- + +### HighlightedTextColor +Sets or gets the text color when the item is highlighted. + +```c# +public SColor HighlightedTextColor {get;set;} +item.HighlightedTextColor = SColor.FromArgb(255, 255, 0); +``` + +```lua +--- Sets or gets the text color when the item is highlighted. +item:HighlightedTextColor(color) +``` + +--- + +### Label +Sets or gets the left label for the menu item. + +```c# +public string Label {get;set;} +item.Label = "Left Label"; +``` + +```lua +--- Sets or gets the left label for the menu item. +item:Label(Text) +``` + +--- + +### RightLabel +Sets (Lua only) or gets the right label for the menu item. + +```c# +public string RightLabel {get; private set;} +var rLabel = item.RightLabel; +``` + +```lua +--- Sets or gets the right label for the menu item. +item:RightLabel(Text) +``` + +--- + +### RightBadge +Sets (Lua only) or gets the right badge for the menu item. + +```c# +public BadgeIcon RightBadge {get;private set;} +var badge = item.RightBadge; +``` + +```lua +--- Sets or gets the right badge for the menu item. +item:RightBadge(Badge) +``` + +--- + +### LeftBadge +Sets (Lua only) or gets the left badge for the menu item. + +```c# +void LeftBadge {get;private set;} +var lBadge = item.LeftBadge; +``` + +```lua +--- Sets or gets the left badge for the menu item. +item:LeftBadge(Badge) +``` + +## Functions + +### BlinkDescription +Sets or retrieves the blinking description for a menu item. If `bool` is provided, it sets the blinking status, otherwise, it returns the current blinking status. + +```c# +public bool BlinkDescription {get;set;} +item.BlinkDescription = true; +``` + +```lua +--- Sets or retrieves the blinking description for a menu item. +function item:BlinkDescription(bool) +``` + +### CustomRightBadge +Sets a custom right badge for a menu item, typically used for visual indicators such as icons. + +```c# +public void SetCustomRightBadge(txd, txn) +item.SetCustomRightBadge("txd", "txn"); +``` + +```lua +--- Sets a custom right badge for a menu item. +function item:CustomRightBadge(txd, txn) +``` + +### CustomLeftBadge +Sets a custom left badge for a menu item, typically used for visual indicators such as icons. + +```c# +public void SetCustomLeftBadge(txd, txn) +item.SetCustomLeftBadge("txd", "txn"); +``` + +```lua +--- Sets a custom left badge for a menu item. +function item:CustomLeftBadge(txd, txn) +``` + +### AddPanel +Adds a panel to a menu item. + +```c# +public void AddPanel(UIMenuPanel panel) +item.AddPanel(panel) +``` + +```lua +--- Adds a panel to a menu item. +function item:AddPanel(Panel) +``` + +### AddSidePanel +Adds a side panel to a menu item, used for additional details or options. + +```c# +public void AddSidePanel(sidePanel) +item.AddSidePanel(sidePanel) +``` + +```lua +--- Adds a side panel to a menu item. +function item:AddSidePanel(sidePanel) +``` + +### RemoveSidePanel +Removes the side panel from a menu item. + +```c# +public void RemoveSidePanel() +item.RemoveSidePanel(); +``` + +```lua +--- Removes the side panel from a menu item. +function item:RemoveSidePanel() +``` + +### RemovePanelAt +Removes a panel from a menu item by index. + +```c# +void RemovePanelAt(Index) +item.RemovePanelAt(index); +``` + +```lua +--- Removes a panel from a menu item by index. +function item:RemovePanelAt(Index) +``` + +## Events + +### ItemActivatedEvent +Triggered everytime a player select the item after highlighting it + +```c# +public event ItemActivatedEvent Activated +``` + +```lua +Activated = function(menu, item) +end +``` + +### ItemHighlightedEvent +Triggered everytime a player highlightings an item + +```c# +public event ItemHighlightedEvent Highlighted +``` + +```lua +Highlighted = function(menu, item) +end +``` \ No newline at end of file diff --git a/docs/UIMenu/Items/uimenulistitem.md b/docs/UIMenu/Items/uimenulistitem.md new file mode 100644 index 00000000..470a1d13 --- /dev/null +++ b/docs/UIMenu/Items/uimenulistitem.md @@ -0,0 +1,98 @@ +--- +layout: default +title: UIMenuListItem +parent: Menu Items +show_buttons: true +show_all_code: false +--- + +# UIMenuListItem + +![image](https://user-images.githubusercontent.com/4005518/162609041-3d969294-4208-47fa-887e-3a9c3fb6b34b.png) + +This item requires a list of values to be given, the menu will then scroll the items left/right. +This item has 2 events, OnListChange called everytime the user goes left/right and OnListSelect called when the user selects the item after highlighting it. +The item inherits all the UIMenuItem functions and adds some of his. + +{: .warning} +> ⚠️ Warning +> +> This item is sheduled to become obsolete and legacy in future updates of the library. It will be replaced by the more runtime friendly [UIMenuDynamicListItem](./uimenudynamiclistitem.md). + + +## Constructor + +```c# +UIMenuListItem(string text, List items, int index) +UIMenuListItem(string text, List items, int index, string description) +UIMenuListItem(string text, List items, int index, string description, HudColor mainColor, HudColor higlightColor) +``` + +```lua +UIMenuListItem.New(Text, Items, Index, Description, mainColor, highlightColor, textColor, highlightedTextColor) +``` + +## Parameters + +### Items +The values given in constructor are saved in the **Items** list. + +```c# +List Items { get; } +var values = listItem.Items; +``` + +```lua +local values = listitem.Items +``` + +### Index +Gets or Sets the current item index to show the corresponding value in the given Items list + +```c# +int Index { get; set; } +``` + +```lua +item:Index(index) +``` + +## Functions + +### ChangeList +This functions updates the current list of values with a new one. +A new starting index can be optionally specified. + +```c# +public void ChangeList(List list, int index) +``` + +```lua +listitem::ChangeList(list) +``` + +## Events + +### OnListChange +Triggered everytime the player goes left or right + +```cs +public event ListChangedEvent OnListChange; +``` + +```lua +OnListChange = function(menu, item, newindex) +end +``` + +### OnListSelect +Triggered everytime the player selects the item after highlighting it. + +```cs +public event ListSelectedEvent OnListSelect; +``` + +```lua +OnListSelect = function(menu, item, newindex) +end +``` \ No newline at end of file diff --git a/docs/UIMenu/Items/uimenuprogressitem.md b/docs/UIMenu/Items/uimenuprogressitem.md new file mode 100644 index 00000000..97b1c533 --- /dev/null +++ b/docs/UIMenu/Items/uimenuprogressitem.md @@ -0,0 +1,54 @@ +--- +layout: default +title: UIMenuProgressItem +parent: Menu Items +show_buttons: true +show_all_code: false +--- + +# UIMenuProgressItem + +![image](https://user-images.githubusercontent.com/4005518/162610832-fca01c29-e27e-46ed-97bb-36dca8d50991.png) + +This item is hydentical to the [UIMenuSliderItem](./uimenuslideritem.md) and shares the same features. + +## Constructor + +```c# +public UIMenuProgressItem(string text, int maxCount, int startIndex) +public UIMenuProgressItem(string text, int maxCount, int startIndex, string description, bool heritage = false) +public UIMenuProgressItem(string text, int maxCount, int startIndex, string description, SColor sliderColor) +``` + +```lua +function UIMenuProgressItem.New(Text, Max, Index, Description, sliderColor, color, highlightColor, textColor, highlightedTextColor, backgroundSliderColor) +``` + +## Events + +The only difference with [UIMenuSliderItem](./uimenuslideritem.md) is the changed events naming convention + +### OnProgressChanged +Triggered when the player changes the progress in the item + +```c# +public event ItemSliderProgressEvent OnProgressChanged; +``` + +```lua +OnProgressChanged = function(menu, item, newindex) +end, +``` + +### OnProgressSelected +Triggered when the player selectes the item after highlighting it +For C# users, the item inherits [UIMenuItem](./uimenuitem.md#itemactivatedevent) Activated event. + +```c# +public event ItemActivatedEvent Activated; +``` + +```lua +OnProgressSelected = function(menu, item, newindex) +end, +``` diff --git a/docs/UIMenu/Items/uimenuseparatoritem.md b/docs/UIMenu/Items/uimenuseparatoritem.md new file mode 100644 index 00000000..fcc13168 --- /dev/null +++ b/docs/UIMenu/Items/uimenuseparatoritem.md @@ -0,0 +1,23 @@ +--- +layout: default +title: UIMenuSeparatorItem +parent: Menu Items +show_buttons: true +show_all_code: false +--- + +# UIMenuSeparatorItem + +![image](https://user-images.githubusercontent.com/4005518/162611905-89fdd3fc-6c14-4d74-b3ba-83320437d2b4.png) + +The separator. An item many people requested. You can decide if it's ignored by the menu or selectable. It has no functions and no events as it's only a separator. + +## Constructor + +```c# +UIMenuSeparatorItem(string title, bool jumpable) +``` + +```lua +UIMenuSeparatorItem.New(Text, jumpable , mainColor, highlightColor, textColor, highlightedTextColor) +``` diff --git a/docs/UIMenu/Items/uimenuslideritem.md b/docs/UIMenu/Items/uimenuslideritem.md new file mode 100644 index 00000000..1ffda333 --- /dev/null +++ b/docs/UIMenu/Items/uimenuslideritem.md @@ -0,0 +1,79 @@ +--- +layout: default +title: UIMenuSliderItem +parent: Menu Items +show_buttons: true +show_all_code: false +--- +# UIMenuSliderItem + +![image](https://user-images.githubusercontent.com/4005518/162610316-5d6decde-bc5b-46ea-925f-5b8c18b2f918.png) + +A slider, a section of a progress item that slides in a predefined space. + +- It comes with Mom and Dad icons too, simply set Heritage value to true! +- This item works with integer values only +- You can specify the slider color. + +## Constructor + +```c# +UIMenuSliderItem(string text) +UIMenuSliderItem(string text, string description) +UIMenuSliderItem(string text, string description, bool heritage) +UIMenuSliderItem(string text, string description, int max, int mult, int startVal, bool heritage) +UIMenuSliderItem(string text, string description, int max, int mult, int startVal, HudColor sliderColor, bool heritage = false) +``` + +```lua +function UIMenuSliderItem.New(Text, Max, Multiplier, Index, Heritage, Description, sliderColor, color, highlightColor, textColor, highlightedTextColor) +``` + +## Parameters + +### SliderColor +Gets or Sets the slider color after initialization or on runtime. + +```c# +HudColor SliderColor { get; set; } +``` + +```lua +sliderItem:SliderColor(color) +``` + +### CurrentValue +Gets or Sets the current value or position of the slider. + +```c# +int Value { get; set; } +``` + +```lua +sliderItem:Index(Index) +``` + +## Events + +### OnSliderChanged + +```c# +ItemSliderEvent OnSliderChanged(UIMenuSliderItem item, int newIndex) +``` + +```lua +sliderItem.OnSliderChanged = function(menu, item, newindex) +end +``` + +### OnSliderSelected +For C# users, the item inherits [UIMenuItem](./uimenuitem.md#itemactivatedevent) Activated event. + +```c# +public event ItemActivatedEvent Activated +``` + +```lua +sliderItem.OnSliderSelected = function(menu, item, newindex) +end +``` \ No newline at end of file diff --git a/docs/UIMenu/Items/uimenustatsitem.md b/docs/UIMenu/Items/uimenustatsitem.md new file mode 100644 index 00000000..0a251051 --- /dev/null +++ b/docs/UIMenu/Items/uimenustatsitem.md @@ -0,0 +1,40 @@ +--- +layout: default +title: UIMenuStatsItem +parent: Menu Items +show_buttons: true +show_all_code: false +--- + +# UIMenuStatsItem + +![image](https://user-images.githubusercontent.com/4005518/162611147-6ad025a7-f018-44b9-909f-f7f2996cf016.png) + +This item is logically hydentical to the [UIMenuProgressItem](./uimenuprogressitem.md) + +## Constructor + +```c# +public UIMenuStatsItem(string text) : this(text, "", 0, SColor.HUD_Freemode) +public UIMenuStatsItem(string text, string subtitle, int value, SColor color) : base(text, subtitle) +``` + +```lua +function UIMenuStatsItem.New(Text, Description, Index, barColor, type, mainColor, highlightColor, textColor, highlightedTextColor) +``` + + +## Events +This item events are hydentical to the [UIMenuProgressItem](./uimenuprogressitem.md) one but with different names. + +```c# +public event ItemActivatedEvent Activated; +public event StatChanged OnStatChanged; +``` + +```lua +OnStatsChanged = function(menu, item, newindex) +end, +OnStatsSelected = function(menu, item, newindex) +end, +``` \ No newline at end of file diff --git a/docs/UIMenu/Panels/index.md b/docs/UIMenu/Panels/index.md new file mode 100644 index 00000000..cc7cea17 --- /dev/null +++ b/docs/UIMenu/Panels/index.md @@ -0,0 +1,11 @@ +--- +layout: default +title: Menu Panels +parent: UIMenu +show_buttons: true +show_all_code: false +--- + +# Menu Panels + +Menu panels are optional components that can be added to every menu item allowing extended features like color, percentages, grids and more. \ No newline at end of file diff --git a/docs/UIMenu/Panels/uimenucolorpanel.md b/docs/UIMenu/Panels/uimenucolorpanel.md new file mode 100644 index 00000000..3027ef6b --- /dev/null +++ b/docs/UIMenu/Panels/uimenucolorpanel.md @@ -0,0 +1,55 @@ +--- +layout: default +title: UIMenuColorPanel +parent: Menu Panels +show_buttons: true +show_all_code: false +--- + +# UIMenuColorPanel + +![image](https://user-images.githubusercontent.com/4005518/162625225-d415d474-7ed2-45f1-92e3-9a75f4acd00e.png) +The first of the panels we are gonna see now is the Color panel. +It comes in 3 different color templates: +* Makeup colors (64 colors for make up palette) +* Hair colors (64 colors for hair palette) +* Custom colors (customizable number of colors decided by the developer) + +## Constructor + +```c# +UIMenuColorPanel(string title, ColorPanelType ColorType, int startIndex = 0) // for the predefined palettes +UIMenuColorPanel(string title, List colors, int startIndex = 0) // for the customizable colors +``` + +```lua +UIMenuColorPanel.New(title, colorType, startIndex, colors) -- colors is nil if using predefined palettes +``` + +The optional `colors` parameter is a list of SColor instances allowing devs to input HUD colors and / or custom ARGB colors in the same list. + +## Parameters + +### CurrentSelection +Gets or Sets the panel current color selection + +```c# +int CurrentSelection{ get; set; } +``` + +```lua +colorPanel:CurrentSelection(new_value) +``` + +## Events + +### ColorPanelChangedEvent + +```c# +ColorPanelChangedEvent OnColorPanelChange(UIMenuItem parentItem, UIMenuColorPanel panel, int newValue) +``` + +```lua +colorPanel.OnColorPanelChanged = function(item, panel, newindex) +end +``` \ No newline at end of file diff --git a/docs/UIMenu/Panels/uimenugridpanel.md b/docs/UIMenu/Panels/uimenugridpanel.md new file mode 100644 index 00000000..0c7d8db1 --- /dev/null +++ b/docs/UIMenu/Panels/uimenugridpanel.md @@ -0,0 +1,49 @@ +--- +layout: default +title: UIMenuGridPanel +parent: Menu Panels +show_buttons: true +show_all_code: false +--- + +# UIMenuGridPanel + +![image](https://user-images.githubusercontent.com/4005518/162626688-4af59182-8f4d-4798-922b-f1065da67f2d.png) + +* This panel comes 2 variants: full / horizontal. +* It's value is a Vector2 in Lua and a PointF in C#, both X and Y go from 0.0 to 1.0 this means that a value of 0.5 is the center of the grid. + +## Constructor +```c# +UIMenuGridPanel(string TopText, string LeftText, string RightText, string BottomText, PointF circlePosition) // full grid +UIMenuGridPanel(string LeftText, string RightText, PointF circlePosition) // half grid +``` + +```lua +UIMenuGridPanel.New(topText, leftText, rightText, bottomText, circlePosition, gridType) -- set gridType to 0 for the full grid or 1 for the horizontal grid +``` + +## Parameters + +### Circle Position +Gets or Sets the current position of the circle in the grid. + +```c# +PointF CirclePosition { get; set; } +``` +Lua: +```lua +gridPanel.:CirclePosition(position) +``` + +## Events + +### GridPanelChangedEvent +```c# +GridPanelChangedEvent OnGridPanelChange(UIMenuItem item, UIMenuGridPanel panel, PointF newPosition) +``` + +```lua +gridPanel.OnGridPanelChanged = function(item, panel, newPosition) +``` + diff --git a/docs/UIMenu/Panels/uimenupercentagepanel.md b/docs/UIMenu/Panels/uimenupercentagepanel.md new file mode 100644 index 00000000..bfa4b0b6 --- /dev/null +++ b/docs/UIMenu/Panels/uimenupercentagepanel.md @@ -0,0 +1,49 @@ +--- +layout: default +title: UIMenuPercentagePanel +parent: Menu Panels +show_buttons: true +show_all_code: false +--- + +# UIMenuPercentagePanel + +![image](https://user-images.githubusercontent.com/4005518/162625751-100d9360-b0c3-4376-9657-729722298a05.png) + +This panel is a progressive panel value is float and goes from `0.0` to `100.0`. + +## Constructor + +```c# +public UIMenuPercentagePanel(string title, string MinText = "0%", string MaxText = "100%", float initialValue = 0) +``` + +```lua +UIMenuPercentagePanel.New(title, minText, maxText, initialValue) +``` + +## Parameters + +### Percentage +Gets or Sets the panel current percentage. + +```c# +float Percentage { get; set; } +``` + +```lua +percPanel:Percentage(value) +``` + +## Events + +### + +```c# +PercentagePanelChangedEvent OnPercentagePanelChange(UIMenuItem item, UIMenuPercentagePanel panel, float value) +``` + +```lua +percPanel.OnPercentagePanelChange = function(item, panel, value) +end +``` \ No newline at end of file diff --git a/docs/UIMenu/Panels/uimenustatisticspanel.md b/docs/UIMenu/Panels/uimenustatisticspanel.md new file mode 100644 index 00000000..74d5bc21 --- /dev/null +++ b/docs/UIMenu/Panels/uimenustatisticspanel.md @@ -0,0 +1,58 @@ +--- +layout: default +title: UIMenuStatisticsPanel +parent: Menu Panels +show_buttons: true +show_all_code: false +--- + +### UIMenuStatisticsPanel + +![image](https://user-images.githubusercontent.com/4005518/162627026-10065394-a185-463b-a3d2-cdff6720a0bd.png) + +This panel is not interactable by user input, it will only show given infos. + +## Constructor + +```c# +UIMenuStatisticsPanel() +``` +Lua: +```lua +UIMenuStatisticsPanel.New(items) +``` + +## Functions + +### Add Statistics + +```c# +public void AddStatistics(string Name, float val) +``` + +```lua +statsPanel:AddStatistic(name, value) +``` + +## Functions + +### Get Percentage +Retrieve the current percentage from one of the listed statistics. +```c# +public float GetPercentage(int ItemId) +``` + +```lua +statsPanel:GetPercentage(id) -- returns a statistic value +``` + +### Set Percentage +Sets or updates a statistic value + +```c# +public void SetPercentage(int ItemId, float number) +``` + +```lua +statsPanel:UpdateStatistic(id, value) +``` \ No newline at end of file diff --git a/docs/UIMenu/Panels/uimenuvehiclecolourpickerpanel.md b/docs/UIMenu/Panels/uimenuvehiclecolourpickerpanel.md new file mode 100644 index 00000000..577e6c94 --- /dev/null +++ b/docs/UIMenu/Panels/uimenuvehiclecolourpickerpanel.md @@ -0,0 +1,87 @@ +--- +layout: default +title: UIMenuVehicleColourPickerPanel +parent: Menu Panels +show_buttons: true +show_all_code: false +--- + +# UIMenuColourPickerPanel + +![image](https://github.com/user-attachments/assets/a57a3c76-6bc4-45a2-9d53-e4c4a56c0ffd) + +An _under menu_ version of the same side panel. + +## Constructor + +```c# +UIMenuColourPickePanel(ColorPickerType panelType) +``` + +```lua +UIMenuVehicleColourPickerPanel.New() +``` + +## Parameters + +### Current Value +Gets or Sets the current picker value + +```c# +public int Value {get;set;} +``` + +```lua +panel:Value(val) +``` + +### Color +Returns the SColor instance of the current selected value + +```c# +public SColor Color {get;} +``` + +```lua +panel:Color() +``` + +## Events + +### PickerSelect + +```c# +VehicleColorPickerSelectEvent(UIMenuItem menu, UIVehicleColourPickerPanel panel, int index, SColor color) +``` + +```lua +PickerSelect = function(value, color) +end +``` + +### PickerHovered + +```c# +VehicleColorPickerHoverEvent(int index, SColor color) +``` + +```lua +PickerHovered = function(value, color) +end +``` + +### PickerRollout + +```c# +// not an error, same delegate, different name +VehicleColorPickerHoverEvent(int index, SColor color); +panel.OnColorRollOut += (index, color) => +{ + // code here +} +``` + +```lua +PickerRollOut = function(value, color) +end +``` \ No newline at end of file diff --git a/docs/UIMenu/Parameters.md b/docs/UIMenu/Parameters.md new file mode 100644 index 00000000..515c5c06 --- /dev/null +++ b/docs/UIMenu/Parameters.md @@ -0,0 +1,316 @@ +--- +layout: default +title: Parameters +parent: UIMenu +show_buttons: true +show_all_code: false +--- +# Parameters +This section will show you **UIMenu** public parameters and the use you can do with them. +Examples are shown in C# and in Lua. + +## Title +The title of the menu is shown onto the banner texture. +You can set it in constructor and get/set it using: + +```c# +string Title {get;set;} +menu.Title +``` + +```lua +---Getter / Setter for the menu title. +---@param title string +---@return string | nil +menu:Title(title) -- if empty it returns the current title. +``` + +## Subtitle +The Subtitle is shown right after the banner and is always sided by the item count. +You can set it in constructor and get/set it using: + +```c# +string Subtitle {get;set;} +menu.Subtitle +``` + +```lua +---Getter / Setter for the subtitle. +---@param sub string +---@return string | nil +menu:Subtitle(subtitle) +``` + +## Description Font +Getter / Setter for the description font. + +```c# +ItemFont DescriptionFont { get; set; } +menu.DescriptionFont +``` + +```lua +---Getter / Setter for the description font. +---@param fontTable ItemFont +---@return ItemFont +menu:DescriptionFont(fontTable) +``` + +## Counter Color +Getter / Setter for the counter color. + +```c# +SColor CounterColor { get; set; } +menu.CounterColor +``` + +```lua +---Getter / Setter for the counter color. +---@param color SColor +---@return any +menu:CounterColor(color) +``` + +## Subtitle Color +Getter / Setter for the subtitle color. + +```c# +HudColour SubtitleColor { get; set; } +menu.SubtitleColor +``` + +```lua +---Getter / Setter for the subtitle color. +---@param color HudColours +---@return any +menu:SubtitleColor(color) +``` + +## Menu Alignment +Getter / Setter for the menu alignment. + +```c# +MenuAlignment MenuAlignment { get; set; } +menu.MenuAlignment +``` + +```lua +---Getter / Setter for the Menu Alignment. +---@param align MenuAlignment +---@return MenuAlignment | nil +menu:MenuAlignment(align) +``` + +## Disable Game Controls +Enable/disable non-menu game controls. + +```c# +bool DisableGameControls { get; set; } +menu.DisableGameControls +``` + +```lua +---Enable/disable non-menu game controls. +---@param bool? boolean +---@return boolean | nil +menu:DisableGameControls(bool) +``` + +## Instructional Buttons +Enable/disable instructional buttons. + +```c# +bool HasInstructionalButtons { get; set; } +menu.HasInstructionalButtons +``` + +```lua +---Enable/disable instructional buttons. +---@param enabled boolean|nil +---@return boolean +menu:HasInstructionalButtons(enabled) +``` + +## Can Player Close Menu +Sets if the menu can be closed by the player. + +```c# +bool CanPlayerCloseMenu { get; set; } +menu.CanPlayerCloseMenu +``` + +```lua +---Sets if the menu can be closed by the player. +---@param playerCanCloseMenu boolean|nil +---@return boolean +menu:CanPlayerCloseMenu(playerCanCloseMenu) +``` + +## Mouse Edge Enabled +Sets if the camera can be rotated when the mouse cursor is near the edges of the screen. + +```c# +bool MouseEdgeEnabled { get; set; } +menu.MouseEdgeEnabled +``` + +```lua +---Sets if the camera can be rotated when the mouse cursor is near the edges of the screen. +---@param enabled boolean|nil +---@return boolean +menu:MouseEdgeEnabled(enabled) +``` + +## Mouse Controls Enabled +Enables or disables mouse controls for the menu. + +```c# +bool MouseControlsEnabled { get; set; } +menu.MouseControlsEnabled +``` + +```lua +---Enables or disables mouse controls for the menu. +---@param enabled boolean|nil +---@return boolean +menu:MouseControlsEnabled(enabled) +``` + +## Animation Enabled +Enable or disable scrolling animation. + +```c# +bool AnimationEnabled { get; set; } +menu.AnimationEnabled +``` + +```lua +---Enable or disable scrolling animation. +---@param enable boolean|nil +---@return boolean +menu:AnimationEnabled(enable) +``` + +## 3D Animations Enabled +Enable or disable 3D animations. + +```c# +bool Enabled3DAnimations { get; set; } +menu.Enabled3DAnimations +``` + +```lua +---Enable or disable 3D animations. +---@param enable boolean|nil +---@return boolean +menu:Enabled3DAnimations(enable) +``` + +## Animation Type +Sets the menu's scrolling animation type while the menu is visible. + +```c# +MenuAnimationType AnimationType { get; set; } +menu.AnimationType +``` + +```lua +---Sets the menu's scrolling animation type while the menu is visible. +---@param menuAnimationType MenuAnimationType|nil +---@return number MenuAnimationType +---@see MenuAnimationType +menu:AnimationType(menuAnimationType) +``` + +## Building Animation +Enables or disables the menu's building animation type. + +```c# +MenuBuildingAnimation BuildingAnimation { get; set; } +menu.BuildingAnimation +``` + +```lua +---Enables or disables the menu's building animation type. +---@param buildingAnimationType MenuBuildingAnimation|nil +---@return MenuBuildingAnimation +---@see MenuBuildingAnimation +menu:BuildingAnimation(buildingAnimationType) +``` + +## Scrolling Type +Decides how the menu behaves on scrolling and overflowing. + +```c# +MenuScrollingType ScrollingType { get; set; } +menu.ScrollingType +``` + +```lua +---Decides how the menu behaves on scrolling and overflowing. +---@param scrollType MenuScrollingType|nil +---@return MenuScrollingType +---@see MenuScrollingType +menu:ScrollingType(scrollType) +``` + +## Current Selection +Gets or sets the currently selected item index in the menu. + +```c# +int CurrentSelection { get; set; } +menu.CurrentSelection +``` + +```lua +---Gets or sets the currently selected item index in the menu. +---@param value number|nil +---@return number +menu:CurrentSelection(value) +``` + +## Max Items On Screen +Gets or sets the maximum number of items visible on the screen. + +```c# +int MaxItemsOnScreen { get; set; } +menu.MaxItemsOnScreen +``` + +```lua +---Gets or sets the maximum number of items visible on the screen. +---@param max number|nil +---@return number +menu:MaxItemsOnScreen(max) +``` + + +## Visible +This is maybe the **most important parameter of the menu**. +Gets or sets the visibility state of the menu drawing it or stopping the draw. + +```c# +bool Visible { get; set; } +menu.Visible +``` + +```lua +---Gets or sets the visibility state of the menu. +---@param bool boolean|nil +---@return boolean +menu:Visible(bool) +``` + +## Is Mouse Over The Menu +Checks if the mouse is currently over the menu. + +```c# +bool IsMouseOverTheMenu() +menu.IsMouseOverTheMenu() +``` + +```lua +---Checks if the mouse is currently over the menu. +---@return boolean +menu:IsMouseOverTheMenu() +``` diff --git a/docs/UIMenu/Side Panels/index.md b/docs/UIMenu/Side Panels/index.md new file mode 100644 index 00000000..b0755239 --- /dev/null +++ b/docs/UIMenu/Side Panels/index.md @@ -0,0 +1,11 @@ +--- +layout: default +title: Side Panels +parent: UIMenu +show_buttons: false +show_all_code: true +--- + +# Side Panels + +Side panels are optional components that can be added to every menu item allowing extended features. \ No newline at end of file diff --git a/docs/UIMenu/Side Panels/uimenufreemodedetailsitem.md b/docs/UIMenu/Side Panels/uimenufreemodedetailsitem.md new file mode 100644 index 00000000..b6330405 --- /dev/null +++ b/docs/UIMenu/Side Panels/uimenufreemodedetailsitem.md @@ -0,0 +1,23 @@ +--- +layout: default +title: UIMenuFreemodeDetailsItem +parent: UIMissionDetailsPanel +show_buttons: true +show_all_code: false +--- + +# UIMenuFreemodeDetailsItem + +The item used to fill the MissionDetailPanel and other components in Pause Menus / Lobby Menus info panel. + +## Constructor + +```c# +UIFreemodeDetailsItem(string textLeft, string textRight, bool separator) +UIFreemodeDetailsItem(string textLeft, string textRight, BadgeIcon icon, HudColor iconColor = HudColor.HUD_COLOUR_FREEMODE, bool tick = false) +``` + +```lua +-- If icon and iconColor are specified, then separator will be ignored, also icon is a Badge.. the same used for normal UIMenuItems +UIMenuFreemodeDetailsItem.New(textLeft, textRight, seperator, icon, iconColor, tick) +``` diff --git a/docs/UIMenu/Side Panels/uimissiondetailspanel.md b/docs/UIMenu/Side Panels/uimissiondetailspanel.md new file mode 100644 index 00000000..253f7bd3 --- /dev/null +++ b/docs/UIMenu/Side Panels/uimissiondetailspanel.md @@ -0,0 +1,59 @@ +--- +layout: default +title: UIMissionDetailsPanel +parent: Side Panels +show_buttons: true +show_all_code: false +--- + +# UIMissionDetailsPanel + +![image](https://user-images.githubusercontent.com/4005518/162627871-fad1dac4-7055-4187-819c-e21dfd8d865f.png) + +## Constructor + +```c# +public UIMissionDetailsPanel(PanelSide side, string title, bool inside, string txd = "", string txn = "") +public UIMissionDetailsPanel(PanelSide side, string title, HudColor color, string txd = "", string txn = "") +``` + +```lua +UIMissionDetailsPanel.New(side, title, color, inside, txd, txn) +``` + +This panel is a bit more complex as it needs 1 more item to work, for each item in the side panel we must initialize a new [UIMenuFreemodeDetailsItem](./uimenufreemodedetailsitem.md) + +## Parameters + +### Title +Gets or Sets the panel title. + +```c# +string Title { get; set; } +``` + +```lua +:UpdatePanelTitle(title) +``` + +### Update panel background + +```c# +UpdatePanelPicture(string txd, string txn) +``` + +```lua +:UpdatePanelPicture(txd, txn) +``` + +### Add / Remove Item + +```c# +AddItem(UIFreemodeDetailsItem item) +RemoveItem(int idx) +``` + +```lua +:AddItem(newitem) +:RemoveItemAt(index) +``` \ No newline at end of file diff --git a/docs/UIMenu/Side Panels/uivehiclecolourpickerpanel.md b/docs/UIMenu/Side Panels/uivehiclecolourpickerpanel.md new file mode 100644 index 00000000..43aee086 --- /dev/null +++ b/docs/UIMenu/Side Panels/uivehiclecolourpickerpanel.md @@ -0,0 +1,36 @@ +--- +layout: default +title: UIVehicleColourPickerPanel +parent: Side Panels +show_buttons: true +show_all_code: false +--- + +# UIVehicleColourPickerPanel + +![image](https://user-images.githubusercontent.com/4005518/162627553-770a84a0-7b60-469a-a5a2-88c991d3a5d8.png) + +Since the classic color panel is not enough to show all the vehicle colors available, i decided to make a new side panel only for them. + +## Constructor +```c# +public UIVehicleColourPickerPanel(PanelSide side, string title) +public UIVehicleColourPickerPanel(PanelSide side, string title, HudColor BgColor) +``` + +```lua +UIVehicleColorPickerPanel.New(side, title, color) +``` + +## Parameters +This panel is exactly the same as [UIMenuColourPickerPanel]({{ site.baseurl }}/UIMenu/Panels/uimenuvehiclecolourpickerpanel/) + +```c# +string Title { get; set; } +VehicleColorPickerSelectEvent OnVehicleColorPickerSelect(UIMenuItem item, UIVehicleColourPickerPanel panel, int colorIndex) +``` + +```lua +:UpdatePanelTitle(title) +PickerSelect = function(item, panel, colorIndex) +``` diff --git a/docs/UIMenu/Windows/index.md b/docs/UIMenu/Windows/index.md new file mode 100644 index 00000000..8d1ee136 --- /dev/null +++ b/docs/UIMenu/Windows/index.md @@ -0,0 +1,11 @@ +--- +layout: default +title: Windows +parent: UIMenu +show_buttons: false +show_all_code: true +--- + +# Windows + +UIMenu features some window features to extend menu functionality without adding extra panels. \ No newline at end of file diff --git a/docs/UIMenu/Windows/uimenudetailswindow.md b/docs/UIMenu/Windows/uimenudetailswindow.md new file mode 100644 index 00000000..064b5848 --- /dev/null +++ b/docs/UIMenu/Windows/uimenudetailswindow.md @@ -0,0 +1,44 @@ +--- +layout: default +title: UIMenuDetailsWindow +parent: Windows +show_buttons: true +show_all_code: false +--- + +# UIMenuDetailsWindow + +![image](https://github.com/user-attachments/assets/0a01a12d-7dd5-4335-9c76-a149b58c1eb9) + +A pie chart with detail labels. +Pie chart can be replaced with a custom texture. + +## Constructor + +```c# +UIMenuDetailsWindow(string top, string mid, string bot, UIDetailImage leftDetail = null) +UIMenuDetailsWindow(string top, string mid, string bot, bool statWheelEnabled, List details) +``` + +```lua +UIMenuDetailsWindow.New(...) +``` + +## Functions + +```c# +public void UpdateLabels(string top, string mid, string bot, UIDetailImage leftDetail = null) +public void AddStatsListToWheel(List stats) +public void AddStatSingleToWheel(UIDetailStat stat) +public void UpdateStatsToWheel() // refresh +public void UpdateStatsToWheel(List stats) +public void RemoveStatToWheel(UIDetailStat stat) +public void RemoveStatToWheel(int id) +``` + +```lua +UpdateLabels(top, mid, bot, leftDetail) +UIMenuDetailsWindow:AddStatsListToWheel(stats) +UIMenuDetailsWindow:AddStatSingleToWheel(stat) +UIMenuDetailsWindow:UpdateStatsToWheel() +``` \ No newline at end of file diff --git a/docs/UIMenu/Windows/uimenuheritagewindow.md b/docs/UIMenu/Windows/uimenuheritagewindow.md new file mode 100644 index 00000000..7c3cb96d --- /dev/null +++ b/docs/UIMenu/Windows/uimenuheritagewindow.md @@ -0,0 +1,43 @@ +--- +layout: default +title: UIMenuHeritageWindow +parent: Windows +show_buttons: true +show_all_code: false +--- + +# UIMenuHeritageWindow + +![image](https://github.com/user-attachments/assets/a9a32bad-df40-4c39-b12e-cdff939ed2fc) + +Heritage window is a preview of characters used in char creators to preview character heritage parents. + +## Constructor + +```c# +UIMenuHeritageWindow(int mom, int dad) +``` + +```lua +UIMenuHeritageWindow.New(Mom, Dad) +``` + +## Features + +### Mom and Dad values + +```c# +public int Mom { get; } +public int Dad { get; } + +public void Index(int mom, int dad) +``` + +```lua +window.Mom +window.Dad + +window:Index(Mom, Dad) +``` + + diff --git a/docs/UIMenu/index.md b/docs/UIMenu/index.md new file mode 100644 index 00000000..d87aab24 --- /dev/null +++ b/docs/UIMenu/index.md @@ -0,0 +1,80 @@ +--- +layout: default +title: UIMenu +show_buttons: false +show_all_code: true +--- +# UIMenu +**UIMenu** is the UI basic menus main class, it creates the base menu for you to add items to. + +![UIMenu banner](https://user-images.githubusercontent.com/4005518/162590980-a84456c2-5aee-4481-a3f3-3626752f74ce.png) + +Below you can see examples of Menu initialization. + +## C# +- Initialization example: + +```c# +UIMenu mainMenu = new UIMenu("Banner Title", "SUBTITLE", new PointF(0, 0)); +``` + +- Possible constructors: + +```c# +public UIMenu(string title, string subtitle, bool glare = false, bool alternativeTitle = false, float fadingTime, MenuAlignment menuAlignment) + +public UIMenu(string title, string subtitle, PointF offset, bool glare = false, bool alternativeTitle = false, float fadingTime, MenuAlignment menuAlignment) + +public UIMenu(string title, string subtitle, PointF offset, KeyValuePair customBanner, bool glare = false, bool alternativeTitle = false, float fadingTime, MenuAlignment menuAlignment) + +public UIMenu(string title, string subtitle, PointF offset, string spriteLibrary, string spriteName, bool glare = false, bool alternativeTitle = false, float fadingTime, MenuAlignment menuAlignment) + +public UIMenu(string title, string subtitle, string description, PointF offset, string spriteLibrary, string spriteName, bool glare = false, bool alternativeTitle = false, float fadingTime, MenuAlignment menuAlignment) +``` + +C# contructors come in multiple overloads, full list of parameters is: +- **title**: Title that appears on the big banner. Set to "" if you are using a custom banner. +- **subtitle**: Subtitle that appears in capital letters in a small black bar. +- **description**: screen width max long description like on GTA:O +- **offset**: PointF object with X and Y data for offsets. Applied to all menu elements. +- **spriteLibrary**: Sprite library name for the banner. +- **spriteName**: Sprite name for the banner. +- **glare**: Add menu Glare scaleform?. +- **alternativeTitle**: Set the alternative type to the title?. +- **fadingTime**: Set fading time for the menu and the items, set it to 0.0 to disable it. + + + +## Lua + +- Initialization example: + +```lua +local mainMenu = UIMenu.New("Banner Title", "SUBTITLE", 0, 0) +``` + +- Constructor: + +```lua +function UIMenu.New(title, subTitle, x, y, glare, txtDictionary, txtName, alternativeTitleStyle, fadeTime, longdesc, align) +``` + + +Full list of parameters is: + +- **title** [string]: -- Menu title +- **subTitle** [string]: -- Menu subtitle +- **x** [number or nil]: -- Menu Offset X position +- **y** [number or nil]: -- Menu Offset Y position +- **glare** [boolean or nil]: -- Menu glare effect +- **txtDictionary** [string or nil]: -- Custom texture dictionary for the menu banner background (default: commonmenu) +- **txtName** [string or nil]: -- Custom texture name for the menu banner background (default: interaction_bgd) +- **alternativeTitleStyle** [boolean or nil]: -- Use alternative title style (default: false) +- **fadeTime** [number or nil]: -- 0.1 by default, the higher the slowest. Values are in seconds where 0.1 means 100ms. 0.0 to disable fading. +- **longdesc** [string or nil]: -- screen width max long description like on GTA:O +- **align** [MenuAlignment or nil]: -- Menu alignment can be LEFT or RIGHT and it's safe bounds responsive (center will be added in future updates) + +## Description +![description image](https://user-images.githubusercontent.com/4005518/162612416-63b1a6f8-e74f-4ed6-8ac2-39c5b0cadd46.png) +The menu will show a description for each item that has one, the description is bounded to the selected item and will change when you select a different item. +It supports emojis, blips, and input icons. \ No newline at end of file diff --git a/docs/_config.yml b/docs/_config.yml new file mode 100644 index 00000000..b260faaf --- /dev/null +++ b/docs/_config.yml @@ -0,0 +1,101 @@ +# Welcome to Jekyll! +# +# This config file is meant for settings that affect your whole blog, values +# which you are expected to set up once and rarely edit after that. If you find +# yourself editing this file very often, consider using Jekyll's data files +# feature for the data you need to update frequently. +# +# For technical reasons, this file is *NOT* reloaded automatically when you use +# 'bundle exec jekyll serve'. If you change this file, please restart the server process. +# +# If you need help with YAML syntax, here are some quick references for you: +# https://learn-the-web.algonquindesign.ca/topics/markdown-yaml-cheat-sheet/#yaml +# https://learnxinyminutes.com/docs/yaml/ +# +# Site settings +# These are used to personalize your new site. If you look in the HTML files, +# you will see them accessed via {{ site.title }}, {{ site.email }}, and so on. +# You can create any custom variable you would like, and they will be accessible +# in the templates via {{ site.myvariable }}. + +title: ScaleformUI +description: >- # this means to ignore newlines until "baseurl:" + Write an awesome description for your new site here. You can edit this + line in _config.yml. It will appear in your document head meta (for + Google search results) and in your feed.xml site description. +baseurl: "/ScaleformUI" # the subpath of your site, e.g. /blog +url: "https://manups4e.github.io/ScaleformUI" # the base hostname & protocol for your site, e.g. http://example.com +twitter_username: jekyllrb +github_username: jekyll + +# Build settings +#remote_theme: just-the-docs/just-the-docs@v0.10.1 +theme: just-the-docs +plugins: + - jekyll-feed + +search_enabled: true +search: + # Split pages into sections that can be searched individually + # Supports 1 - 6, default: 2 + heading_level: 2 + # Maximum amount of previews per search result + # Default: 3 + previews: 3 + # Maximum amount of words to display before a matched word in the preview + # Default: 5 + preview_words_before: 5 + # Maximum amount of words to display after a matched word in the preview + # Default: 10 + preview_words_after: 10 + # Set the search token separator + # Default: /[\s\-/]+/ + # Example: enable support for hyphenated search words + tokenizer_separator: /[\s/]+/ + # Display the relative url in search results + # Supports true (default) or false + rel_url: true + # Enable or disable the search button that appears in the bottom right corner of every page + # Supports true or false (default) + button: false + # Focus the search input by pressing `ctrl + focus_shortcut_key` (or `cmd + focus_shortcut_key` on macOS) + focus_shortcut_key: 'k' +# Enable or disable the side/mobile menu globally +# Nav menu can also be selectively enabled or disabled using page variables or the minimal layout +nav_enabled: true + +# Heading anchor links appear on hover over h1-h6 tags in page content +# allowing users to deep link to a particular heading on a page. +# +# Supports true (default) or false +heading_anchors: true + +color_scheme: dark + +callouts: + warning: + title: Warning + color: yellow + +show_buttons: true +show_all_code: false + +# Exclude from processing. +# The following items will not be processed, by default. +# Any item listed under the `exclude:` key here will be automatically added to +# the internal "default list". +# +# Excluded items can be processed by explicitly listing the directories or +# their entries' file path in the `include:` list. +# +# exclude: +# - .sass-cache/ +# - .jekyll-cache/ +# - gemfiles/ +# - Gemfile +# - Gemfile.lock +# - node_modules/ +# - vendor/bundle/ +# - vendor/cache/ +# - vendor/gems/ +# - vendor/ruby/ diff --git a/docs/_includes/code-block.html b/docs/_includes/code-block.html new file mode 100644 index 00000000..145a3c78 --- /dev/null +++ b/docs/_includes/code-block.html @@ -0,0 +1,35 @@ +
+
+ + + +
+ +
+ {% assign code_blocks = page.content | split: "\n\n" %} + {% assign snippets = "" %} + + {% for block in code_blocks %} + {% if block contains "```c#" %} + {% capture snippet %} + {{ block | remove: "```c#" | remove: "```" }} + {% endcapture %} + {% assign snippets = snippets | push: { lang: "c#", code: snippet } %} + {% elsif block contains "```lua" %} + {% capture snippet %} + {{ block | remove: "```lua" | remove: "```" }} + {% endcapture %} + {% assign snippets = snippets | push: { lang: "lua", code: snippet } %} + {% endif %} + {% endfor %} + + {% for snippet in snippets %} + + {% endfor %} +
+
+ \ No newline at end of file diff --git a/docs/_includes/footer_custom.html b/docs/_includes/footer_custom.html new file mode 100644 index 00000000..e69de29b diff --git a/docs/_includes/header_custom.html b/docs/_includes/header_custom.html new file mode 100644 index 00000000..3d95bc5b --- /dev/null +++ b/docs/_includes/header_custom.html @@ -0,0 +1,75 @@ +
+ + +
+ + \ No newline at end of file diff --git a/docs/breadcrumbshandler.md b/docs/breadcrumbshandler.md new file mode 100644 index 00000000..e0bc375c --- /dev/null +++ b/docs/breadcrumbshandler.md @@ -0,0 +1,21 @@ +--- +layout: default +title: Breadcrumbs Handler +show_buttons: true +show_all_code: false +--- + +# Breadcrumbs Handler + +It's a very basic utility used internally to keep track of menu navigation. + +```c# +// MenuBase is the basic menu parent for UIMenu, RadialMenu, RadioMenu in C#. +public static bool SwitchInProgress { get; internal set; } +public static MenuBase PreviousMenu; +``` + +```lua +BreadcrumbsHandler:PreviousMenu() +BreadcrumbsHandler.SwitchInProgress +``` \ No newline at end of file diff --git a/docs/getting-started.markdown b/docs/getting-started.markdown new file mode 100644 index 00000000..5e9dbff4 --- /dev/null +++ b/docs/getting-started.markdown @@ -0,0 +1,64 @@ +--- +layout: default +title: Getting Started +permalink: /getting-started/ +nav_order: 2 +--- + +## Requirements +* Grand Theft Auto V +* FiveM +* Visual Studio or FxDK for C# +* Visual Sudio code or any editor of your choice or FxDK for Lua +* ScaleformUI + +## How to install ScaleformUI + +### Streaming the Scaleforms. +FiveM and streamed scaleforms are a strange match, if you would place the streamed gfxs along with your resource and restart it.. weird things happen!! +So to avoid bad things, i prepared a zip called ScaleformUI_Assets containing a ready to start empty script to stream your scaleforms separated from any script at all. This way even if you restart your script 100 times, the scaleforms won't go 🍌🍌🍌. +Simply unzip ScaleformUI_Assets and place the resource wherever you want in your resources folder and start it before you start any other ScaleformUI dependant script. + +### C# +1. Download the latest release of ScaleformUI_Csharp, unzip it and place it in your resources folder. +2. It contains the ScaleformUI library and ExamleMenu script. If you want to use the library directly, simply take ScaleformUI.dll and delete the rest. +3. Add ScaleformUI.dll to your references in your Visual Studio /FxDK project and in your script's folder specifying it in the resource manifest's `files {}` section. + +### Lua +1. Download the latest release of ScaleformUI_Lua, unzip it and place it in your resources folder. +2. It contains the ScaleformUI.lua file, the πŸ’– of your API and example.lua. If you don't want the example menu, simply delete the file and remove it from the manifest. +3. Remember to start the ScaleformUI script after you started the Assets to ensure the scaleforms are loaded correctly on client joining! + +## How to use it? +### C# +Simply use the reference in the project and on compilation it should copy the dll in the output folder along with your client.net.dll, copy the dll if you didn't do that before and add the reference in the resource's manifest `files {}` section, you're good to go!🍾πŸ₯‚πŸŽ‰ + +### Lua +There are 2 ways you can use the ScaleformUI.lua library. +1. First option: Place your ScaleformUI.lua in each resource that uses it and start it before any other client file. +2. Second option: Leave it in its own ScaleformUI resource and start it before the other resources. When you want to use it in any resource simply add `"@ScaleformUI_Lua/ScaleformUI.lua",` in the resource manifest in the client_scripts section before anything else. + +I personally suggest the **second option** for 2 main reasons: the first is that whenever you need to update the API you do it only once in its own resource, the second reason is that this way you don't risk to have multiple instances of the API at the same time for each script.. less memory used, happy players, happy server scripter, happy me! πŸ₯³πŸ₯³ + +--- + +**Now for the fun part.** +## How do i make a menu? + +You can create a menu by using the **UIMenu** class, a Pause Menu using **TabView** class or a Lobby Screen using **MainView** class. +The **UIMenu** class is the main class that handles the menu and all the items the menu contains. +Once the menu is declared you need to add items to it, there are different types of items, +* **UIMenuItem**: for basic items +* **UIMenuListItem**: for list items (soon to be deprecated) +* **UIMenuDynamicListItem**: for list items and runtime execution (dynamic lists, soon to be default list item) +* **UIMenuCheckboxItem**: for true / false statements +* **UIMenuSliderItem**: for sliding issues +* **UIMenuProgressItem**: for progress choices like a volume up/down +* **UIMenuSeparatorItem**: a separator between items +* **UIMenuStatsItem**: **special** item similar to progress item used especially in char creation menus. + +Each item has its own features but all of them are an inheritance of UIMenuItem, the basic item where all begins. +The menu doesn't stop with the **items**. Each item can define a number of **Panels** that will be displayed below or besides the menu. +And along with the items, the menu can contain **windows** like the **Heritage** window, or the **Statistics** window! + +How the items, the panels and the windows interact with the menu we'll see it in the related pages of the wiki, but if you're impatient you can go check the example menus! They contain almost all the features and a showcase of how all the items are coded to work in the menu. \ No newline at end of file diff --git a/docs/help b/docs/help new file mode 100644 index 00000000..73bd69b0 --- /dev/null +++ b/docs/help @@ -0,0 +1,7 @@ +### + +```c# +``` + +```lua +``` \ No newline at end of file diff --git a/docs/hud/AdvancedNotification.md b/docs/hud/AdvancedNotification.md new file mode 100644 index 00000000..7d861202 --- /dev/null +++ b/docs/hud/AdvancedNotification.md @@ -0,0 +1,20 @@ +--- +layout: default +title: Advanced Notification +parent: Notifications +show_buttons: true +show_all_code: false +--- + +# Advanced Notification +![image](https://user-images.githubusercontent.com/4005518/162585237-6dc9a537-fc8d-42db-b44a-5ba53ac777cb.png) + +## Usage + +```c# +ShowAdvancedNotification(string title, string subtitle, string text, string iconSet = "Default", string icon = "Default", HudColor bgColor = HudColor.NONE, Color flashColor = new Color(), bool blink = false, NotificationType type = NotificationType.Default, bool showInBrief = true, bool sound = true) +``` + +```lua +ShowAdvancedNotification(title, subtitle, text, iconSet, icon, bgColor, flashColor, blink, type, sound) +``` \ No newline at end of file diff --git a/docs/hud/DrawText3D.md b/docs/hud/DrawText3D.md new file mode 100644 index 00000000..ec3f63e6 --- /dev/null +++ b/docs/hud/DrawText3D.md @@ -0,0 +1,21 @@ +--- +layout: default +title: DrawText3D +parent: Notifications +show_buttons: true +show_all_code: false +--- + +# DrawText3D +![image](https://user-images.githubusercontent.com/4005518/162587792-0db6a761-03da-4f1c-8132-8de068b16897.png) + +## Usage + +```c# +DrawText3D(string text, Vector3 coord, Color color, Font font = Font.ChaletComprimeCologne, float scale = 17f) +DrawText3D(Camera camera, string text, Vector3 coord, Color color, Font font = Font.ChaletComprimeCologne, float scale = 17f) +``` + +```lua +:DrawText3D(coords, color, text, font, size) +``` \ No newline at end of file diff --git a/docs/hud/FloatingHelpNotification.md b/docs/hud/FloatingHelpNotification.md new file mode 100644 index 00000000..0060590c --- /dev/null +++ b/docs/hud/FloatingHelpNotification.md @@ -0,0 +1,20 @@ +--- +layout: default +title: Floating Help Notification +parent: Notifications +show_buttons: true +show_all_code: false +--- + +# Floating Help Notification +![image](https://user-images.githubusercontent.com/4005518/162587568-b8e7937c-33c5-445f-9a58-70169e059a4d.png) + +## Usage + +```c# +ShowFloatingHelpNotification(string msg, Vector3 coords, int time = -1) +``` + +```lua +:ShowFloatingHelpNotification(msg, coords) +``` diff --git a/docs/hud/HelpNotification.md b/docs/hud/HelpNotification.md new file mode 100644 index 00000000..9fd5e847 --- /dev/null +++ b/docs/hud/HelpNotification.md @@ -0,0 +1,21 @@ +--- +layout: default +title: Help Notification +parent: Notifications +show_buttons: true +show_all_code: false +--- + +# Help Notification +![image](https://user-images.githubusercontent.com/4005518/162587464-ef6a72bd-807b-4c49-af03-2bac78474c14.png) + +## Usage +### C# +```c# +ShowHelpNotification(string helpText) // this needs to be called per frame +ShowHelpNotification(string helpText, int time) // this doesn't need to be called per frame! +``` +### Lua +```lua +:ShowHelpNotification(helpText, time) +``` diff --git a/docs/hud/Markers.md b/docs/hud/Markers.md new file mode 100644 index 00000000..34e83c52 --- /dev/null +++ b/docs/hud/Markers.md @@ -0,0 +1,27 @@ +--- +layout: default +title: Markers +parent: Notifications +show_buttons: true +show_all_code: false +--- + +# Markers +![image](https://user-images.githubusercontent.com/4005518/162584296-72fb5a66-49af-42e6-92b6-55e7ee726b5b.png) + +Markers are quite easy to handle. + +## Usage + +```c# +new Marker(MarkerType type, Vector3 position, float distance, Color color, bool placeOnGround = false, bool bobUpDown = false, bool rotate = false, bool faceCamera = false) +new Marker(MarkerType type, Vector3 position, Vector3 scale, float distance, Color color, bool placeOnGround = false, bool bobUpDown = false, bool rotate = false, bool faceCamera = false) +``` + +```lua +Marker.New(type, position, scale, distance, color, placeOnGround, bobUpDown, rotate, faceCamera, checkZ) +``` + +## Properties +- **boolean IsInMarker** +- **boolean IsInRange** \ No newline at end of file diff --git a/docs/hud/ShowNotifications.md b/docs/hud/ShowNotifications.md new file mode 100644 index 00000000..ea468db0 --- /dev/null +++ b/docs/hud/ShowNotifications.md @@ -0,0 +1,20 @@ +--- +layout: default +title: ShowNotification +parent: Notifications +show_buttons: true +show_all_code: false +--- + +# ShowNotification +![image](https://user-images.githubusercontent.com/4005518/162584466-8080e803-315d-4015-8119-520c4aa7493f.png) + +```c# +ShowNotification(string msg, bool blink = false, bool showBriefing = true) +ShowNotification(string msg, NotificationColor color, bool blink = false, bool showBriefing = true) +``` + +```lua +:ShowNotification(msg, blink, showBrief) +:ShowNotificationWithColor(msg, color, blink, showBrief) +``` \ No newline at end of file diff --git a/docs/hud/StatsNotification.md b/docs/hud/StatsNotification.md new file mode 100644 index 00000000..7e3fc163 --- /dev/null +++ b/docs/hud/StatsNotification.md @@ -0,0 +1,20 @@ +--- +layout: default +title: Stats Notification +parent: Notifications +show_buttons: true +show_all_code: false +--- + +# Stats Notification +![image](https://user-images.githubusercontent.com/4005518/162587660-1e896e5d-7cbb-45b7-8f07-c2f95565819a.png) + +## Usage + +```c# +ShowStatNotification(int newProgress, int oldProgress, string title, bool blink = false, bool showBrief = true) +``` + +```lua +:ShowStatNotification(newProgress, oldProgress, title, blink, showBrief) +``` \ No newline at end of file diff --git a/docs/hud/VSNotification.md b/docs/hud/VSNotification.md new file mode 100644 index 00000000..ff504f03 --- /dev/null +++ b/docs/hud/VSNotification.md @@ -0,0 +1,21 @@ +--- +layout: default +title: VS Notification +parent: Notifications +show_buttons: true +show_all_code: false +--- + +# VS Notification +![image](https://user-images.githubusercontent.com/4005518/162587714-73608b0e-62a3-404d-a888-521ac70e53a6.png) + +## Usage + +```c# +ShowVSNotification(Ped otherPed, HudColor color1, HudColor color2) +ShowVSNotification(Ped otherPed1, Ped otherPed2, HudColor color1, HudColor color2) +``` + +```lua +:ShowVSNotification(ped1, ped2, color1, color2) +``` \ No newline at end of file diff --git a/docs/hud/index.md b/docs/hud/index.md new file mode 100644 index 00000000..d189bd6a --- /dev/null +++ b/docs/hud/index.md @@ -0,0 +1,18 @@ +--- +layout: default +title: Notifications +show_buttons: false +show_all_code: true +--- + +# Notifications + +This section will show the **Notifications** class and all its methods useful to help developers. + +```c# +ScaleformUI.Notifications +``` + +```lua +ScaleformUI.Notifications +``` diff --git a/docs/index.markdown b/docs/index.markdown new file mode 100644 index 00000000..a3dbb42e --- /dev/null +++ b/docs/index.markdown @@ -0,0 +1,42 @@ +--- +# Feel free to add content and custom Front Matter to this file. +# To modify the layout, see https://jekyllrb.com/docs/themes/#overriding-theme-defaults + +layout: default +page: default +title: Home +nav_order: 1 +permalink: / +--- + +## What is ScaleformUI? +**ScaleformUI** is a scaleform based library to help developers quickly and easily build Rockstar-like menus and pause menus, handle notifications, markers, and use some of the most used in-game HUD features as well. + +{: .warning} +> ⚠️ Warning +> +> This documentation will explain the API and show examples in C#, Lua and possibly in future also JS (TypeScript). +> In Lua many functions return a value when no parameter is given or sent nil, so make sure to check the source code too when in doubt! + +## Where do I begin? +Take a look at our [Getting Started](/getting-started) page. (add permalink to getting started) + +## Features +- Support for simple buttons, checkboxes and lists. +- Support for custom banners from game sprites and your own textures. +- Easy nested menus for fast and painless nested menu system. +- Controller support. +- Mouse controls. +- Support for all screen resolutions. +- Item descriptions. +- Rebindable keys and controls. +- Badges to decorate your items. +- Event-based callbacks for C#. +- Easy and painless PauseMenu creation. +- Custom instructional buttons. +- Custom warning screen. +- Custom big message and midsize message. +- Timer bars easy and for everyone! + +## Special Thanks +Thanks to @PhilippRendel for helping out on Lua and making it look a lot more easy to use, thanks man. \ No newline at end of file diff --git a/docs/menuhandler.md b/docs/menuhandler.md new file mode 100644 index 00000000..e19dadce --- /dev/null +++ b/docs/menuhandler.md @@ -0,0 +1,36 @@ +--- +layout: default +page: default +title: Menu Handler +show_buttons: true +show_all_code: false +--- + +# Menu Handler + +With The Gary update, MenuPool no longer exists and in its ashes, MenuHandler was born. + +MenuHandler handles the currently visible menu, and draws it for you, it also handle the switching between menus. +It doesn't need to be instantiated as it's ready to work as soon as you start ScaleformUI! + +MenuHandler gives you informations about the currently visible menu or pause menu. + +Here's what you can find inside it: + +```c# +MenuBase CurrentMenu // returns the currently open menu, null if no menu is open +PauseMenuBase CurrentPauseMenu // returns the currently open pause menu, null if no menu is open +bool IsAnyMenuOpen // return true if any MenuBase menu is currently visible +bool IsAnyPauseMenuOpen // return true if any PauseMenuBase menu is currently visible +async Task SwitchTo(this MenuBase currentMenu, MenuBase newMenu, int newMenuCurrentSelection = 0, bool inheritOldMenuParams = false, dynamic data = null); // the unique method to switch from a menu to another +void CloseAndClearHistory() // Closes whatever menu is visible and clears the BreadcrumbHandler. +``` + +```lua +._currentMenu -- returns the currently open menu, null if no menu is open +._currentPauseMenu -- returns the currently open pause menu, null if no menu is open +:IsAnyMenuOpen() -- [bool] return true if any MenuBase menu is currently visible +:IsAnyPauseMenuOpen() -- [bool] return true if any PauseMenuBase menu is currently visible +:SwitchTo(currentMenu, newMenu, newMenuCurrentSelection, inheritOldMenuParams, data) -- the unique method to switch from a menu to another +:CloseAndClearHistory() -- Closes whatever menu is visible and clears the BreadcrumbHandler +``` \ No newline at end of file