Giter Site home page Giter Site logo

scaleformui's Introduction

Hi, I'm Leonardo Emanuele. Hobbyst coder, huge "The Legend of Zelda" fan and FiveM scripter.

๐Ÿ’ป Languages I have used

C# LUA ActionScript React Java SQL

๐Ÿ—œ Some of the technologies I have worked with

Android Eclipse Git GitHub MySQL MariaDB Zoom PayPal Jquery Linux MacOS Windows

Metrics

Manups4e's github stats Top Langs

Profile views

scaleformui's People

Contributors

ali-exacute avatar andyyy7666 avatar aprobeni avatar asaayu avatar ash2148 avatar chaixshot avatar frflo avatar hellyet avatar local9 avatar lxk3y avatar manups4e avatar mathu-lmn avatar matthias18771 avatar morji789 avatar mycroft-studios avatar nirosten avatar philippredel avatar quadrupleturbo avatar saturn745 avatar sup2ak avatar therkysmart avatar wrenchrb avatar zedsku avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scaleformui's Issues

Escape key both close menus and open default pause menu

I think i am getting a bit annoying with all of my new issues :D
But i really love this resource

ANYWAY ,

Not sure if this is intended or not but,
when Lobby menu or custom pause menu is opened, if you press backspace or right mouse click , it will close as it should , but whenever you use ESC key , it will both close it and open GTA default pause menu

it works fine on default menus, but not on lobby and pause menus

[feat] Use C# Options design for menu and other items

An example with TimerBars, which could open up other areas. Some items wouldn't make much sense using this but a Menu could gain some benefits from it.

// In TimerBarPool
public void AddTimerBar(Action<TextTimerBar> timerBar)
{
    TextTimerBar item = new();
    timerBar?.Invoke(item);
    _bars.Add(item);
}

Use;

_timerBarPool = new TimerBarPool();
_timerBarPool.AddTimerBar(bar =>
{
    bar.Label = "Timer Bar";
    bar.Caption = "Caption";
    bar.CaptionColor = Color.FromArgb(255, 128, 100, 255);
});

Glitching on some menu changes

ok so , i just did send my pull request about 1 hour ago : #17

After more testing , if you change some values in the menu, it will cause the menu to , re render i think ?
as it will blink for a frame or two

it is very noticeable and annoying

FIX :
after separating pool:ProcessControl() and pool:Draw() to 2 different threads , the problem was solved

Desktop.2022.05.27.-.11.22.30.02-1.mp4

Wiki improvements

Wiki contains already lots of functions, but there are still some hidden features that you cannot find direct solution. So i'm requesting some wiki improvements, when creators have time. This will also reduce the amount of issues!

Support for adding GtaO style Rank HUD

Sorry, but this is only way to get this message to the awesome creation team, THIS IS NOT AN ISSUE, this is suggestion!!

Support for adding Gta V online styled rank/rank up hud, screenshot below:

image

This would be awesome adding if it is possible to do. Btw this is awesome project, it saved my project i love you : ))))!!!!!!!
And i am sorry, THIS IS NOT AN ISSUE!!

Menu makes game freeze when populated with 70+ items

I'm not sure if it's just my problem but when I populate a menu with 100 items (a car shop) it freezes the game for a few seconds before opening. This freeze starts from 70 items and only increases from there. Is there anything I could be doing wrong?

How to replicate:

Just create a main menu and add 70 or more items (UIMenuItem.New)

running in Lua btw

Changing PlayerListScoreboard location?

Is it even possible to change ScaleformUI.Scaleforms.PlayerListScoreboard location on screen, like u can do with the menu.

image
It wont really be able to look at from that position lmao.

[bug] Notification timing parameter not working as expected in

I've been using the ScaleformUI.Notifications:ShowHelpNotification function in my project, and overall it works well. However, I've noticed that the last parameter, which is supposed to set the duration of the notification, doesn't seem to work correctly.

Specifically, when I pass in a value of 200000 milliseconds, as in ScaleformUI.Notifications:ShowHelpNotification('TEXT', 200000) the notification does display for a while, but it never stays on the screen for the full duration. In fact, it seems like the maximum duration it ever shows for is around 5000 milliseconds.

I've tried different values for the timing parameter, but the behavior is always the same: the notification disappears much earlier than expected.

OnPauseMenuTabChanged method not working

The OnPauseMenuTabChanged method doesn't seem to be working for me. Here's the full code that I've tried:

local function CreateCareersMenu ()
  local careersMenu = TabView.New(t('careers_menu_title'), t('careers_menu_subtitle'))

  -- Add the menu to the pool
  pool:AddPauseMenu(careersMenu)

  -- Civilian Career
  local civilianTab = SubmenuTab.New(t('careers_menu_submenu_civilian_title'):upper())
  careersMenu:AddTab(civilianTab)
  local civilian_select = TabLeftItem.New(t('careers_menu_submenu_civilian_select'), LeftItemType.Info)
  civilianTab:AddLeftItem(civilian_select)
  civilian_select.TextTitle = t('careers_menu_submenu_civilian_title')
  civilian_select:AddItem(BasicTabItem.New(t('careers_menu_submenu_civilian_content')))

  -- Police Career
  local policeTab = SubmenuTab.New(t('careers_menu_submenu_police_title'):upper())
  careersMenu:AddTab(policeTab)
  local police_select = TabLeftItem.New(t('careers_menu_submenu_police_select'), LeftItemType.Info)
  policeTab:AddLeftItem(police_select)
  police_select.TextTitle = t('careers_menu_submenu_police_title')
  police_select:AddItem(BasicTabItem.New(t('careers_menu_submenu_police_content')))

  -- Medical Career
  local medicalTab = SubmenuTab.New(t('careers_menu_submenu_medical_title'):upper())
  careersMenu:AddTab(medicalTab)
  local medical_select = TabLeftItem.New(t('careers_menu_submenu_medical_select'), LeftItemType.Info)
  medicalTab:AddLeftItem(medical_select)
  medical_select.TextTitle = t('careers_menu_submenu_medical_title')
  medical_select:AddItem(BasicTabItem.New(t('careers_menu_submenu_medical_content')))

  -- Criminal Career
  local criminalTab = SubmenuTab.New(t('careers_menu_submenu_criminal_title'):upper())
  careersMenu:AddTab(criminalTab)
  local criminal_select = TabLeftItem.New(t('careers_menu_submenu_criminal_select'), LeftItemType.Info)
  criminalTab:AddLeftItem(criminal_select)
  criminal_select.TextTitle = t('careers_menu_submenu_criminal_title')
  criminal_select:AddItem(BasicTabItem.New(t('careers_menu_submenu_criminal_content')))

  careersMenu.OnPauseMenuTabChanged = function(menu, tab, tabIndex)
    print('[OnPauseMenuTabChanged]: ' .. tabIndex)
  end

  careersMenu.OnLeftItemSelect = function(menu, item, index)
    if (index == 1) then
      careersMenu:Visible(false)
      pool:CloseAllMenus()
      StartCriminalCareer()
    end
  end

  careersMenu:Visible(true)
  careersMenu:CanPlayerCloseMenu(false)
  careersMenu:FocusLevel(1)
end

[LUA] UIMenu instructional buttons disappear after closing ShowWarningWithButtons

Example video of the issue

If a ShowWarningWithButtons is opened while a UIMenu is showing, the instructional buttons for the UIMenu will not shown to the user after the warning is closed.

Reproduction:
Open a UIMenu with instructional buttons.
Open a warning screen while the menu is open.
Close the warning screen.
The original UIMenu instructional buttons are now missing until the menu is opened again or the user navigates to a child menu

[LUA] Update example to show correct list index handling

As Lua starts its index at 1 and not 0, some of the example code is leading to confusion when being used. We should review the code in place for List Items and check the starting index value is 1 as per Lua indexing, and that any examples follow suit.

  • Check UIMenuListItem index handling on creation to make sure the correct value is being used
  • Update example.lua to have the correct starting index values

[PauseMenu] Error when trying to add SubmenuTab

I am developing two menus - one for account creation and one for career selection. The account creation menu works perfectly, but I encounter an error when trying to implement similar functionality in the career selection menu.

Here's the working code for the account creation menu:

private static void CreateMenu()
{
    TabView pauseMenu = new TabView("User Account", "Here you can manage, create or select an account to use on GTA Americas.", "", "", "");
    pauseMenu.CanPlayerCloseMenu = false;
    pauseMenu.FocusLevel = 1;

    SubmenuTab multiItemTab = new SubmenuTab("CREATE");
    pauseMenu.AddTab(multiItemTab);

    TabLeftItem second = new TabLeftItem("Information", LeftItemType.Info);
    TabLeftItem fourth = new TabLeftItem("Account Details", LeftItemType.Settings);

    second.UpdateBackground("scaleformui", "pauseinfobg", LeftItemBGType.Full);
    fourth.UpdateBackground("scaleformui", "pausesetsbg", LeftItemBGType.Resized);

    multiItemTab.AddLeftItem(second);
    multiItemTab.AddLeftItem(fourth);

    second.RightTitle = "Welcome";
    second.AddItem(new BasicTabItem("Content Text"));

    SettingsItem usernameItem = new SettingsItem("Username", "");
    SettingsItem passwordItem = new SettingsItem("Password", "~c~**********");
    SettingsItem confirmItem = new SettingsItem("Confirm Password", "~c~**********");
    SettingsItem emailItem = new SettingsItem("Email", "");
    SettingsItem createItem = new SettingsItem("Create Account", "")

    createItem.OnActivate += (item) =>
    {
        pauseMenu.Visible = false;
        CreateAccount();
    };

    fourth.AddItem(usernameItem);
    fourth.AddItem(passwordItem);
    fourth.AddItem(confirmItem);
    fourth.AddItem(emailItem);
    fourth.AddItem(createItem);

    pauseMenu.Visible = true;
}

For the career selection menu, I'm using similar code, but it results in an error. I've attached a screenshot of the error below.

image

Additionally, I noticed that removing the following lines from the account creation menu also results in an error. However, removing or adding these lines in the career selection menu does not change the error that I'm encountering.

infoItem.UpdateBackground("scaleformui", "pauseinfobg", LeftItemBGType.Full);
accountItem.UpdateBackground("scaleformui", "pausesetsbg", LeftItemBGType.Resized);

Here is the Careers Menu code:

private static void CreateCareersMenu()
{
    TabView pauseMenu = new TabView("Careers", "Start by selecting your first career path.", "", "", "");
    pauseMenu.CanPlayerCloseMenu = false;
    pauseMenu.FocusLevel = 1;

    /*
     * Welcome
     */
    TextTab welcomeTab = new TextTab("WELCOME", "Welcome");
    welcomeTab.AddItem(new BasicTabItem("Content.\n\n"));
    pauseMenu.AddTab(welcomeTab);

    /*
     * Create
     */
    SubmenuTab createTab = new SubmenuTab("CREATE");
    pauseMenu.AddTab(createTab);

    TabLeftItem infoItem = new TabLeftItem("Information", LeftItemType.Info);
    TabLeftItem accountItem = new TabLeftItem("Account Details", LeftItemType.Settings);

    infoItem.UpdateBackground("scaleformui", "pauseinfobg", LeftItemBGType.Full);
    accountItem.UpdateBackground("scaleformui", "pausesetsbg", LeftItemBGType.Resized);

    createTab.AddLeftItem(infoItem);
    createTab.AddLeftItem(accountItem);

    pauseMenu.Visible = true;
}

Any assistance in resolving this issue would be greatly appreciated. Thank you!

Menu not opening on latest release (2.3.0)

Latest release that includes New Lobby Menus, have a very small issue on CreateMenu (as it is older than what it is already inside github (not release)

just wanted to tell you about this, so people dont get confused on using the latest version !

To be exact :
Capture

This part is the issue, as it is trying to add sub1 as a submenu to sub1 again !
(and sub2 is not even used at all)

I am not sure what is the intended use but this will fix the error and menu will show up correctly and also will use sub2 aswell

local sub1 = UIMenu.New("Ciao", "ciao", 50, 50, true, nil, nil, true)
local sub2 = UIMenu.New("Ciao", "ciao", 50, 50, true, nil, nil, true)

exampleMenu:AddSubMenu(sub1, "test", "test")
exampleMenu:AddSubMenu(sub2, "test", "test")

[LUA] Crash on high number of UIMenuCheckboxItem

When i try to create a high number of UIMenuCheckboxItem fivem crash and the reason is a high time to respond from CitizenCrash

the code generating the element (it's sync generation)

function createSpecifi(data, menu)

    for index, value in ipairs(data) do      

        local itemchecked= UIMenuCheckboxItem.New(value.nom, false ,0,"Desactiver le composant",1,117,0,0)

        itemchecked.OnCheckboxChanged=function (menu,item,checked)

            local id=item.Base._itemData.data.id

            if(checked) then

                table.insert(underReplace,id)

            else

                for key, value in ipairs(underReplace) do

                    if(value==id) then

                        table.remove(underReplace,key)

                    end

                end    

            end

        end

        itemchecked:ItemData({data=value})

        menu:AddItem(itemchecked)

    end 

end

Open & close spam breaks menu

Can produce a video if need be, but here's the reproduction steps:

  1. Draw a marker anywhere in the game world
  2. Create a menu
  3. Add logic to that marker, that when you're standing inside of it you can click 'E' or another key to open the menu
  4. Make sure that you do if IsControlJustPressed(1, 86) and not MenuHandler:IsAnyMenuOpen() then inside of the thread for the marker
  5. Stand inside of the marker and spam 'E' and backspace

It would appear that during the open and close menu spam that the MenuHandler thinks that its open, when in reality nothing shows on the screen. Then, you cannot open the menu from the blip because of not MenuHandler:IsAnyMenuOpen()

[bug] Lua port current issues...

  • Changing description with Description method doesn't work as intended

  • Changing Checkbox state while already in menu needs to be duplicated to work correctly

  • CloseAllMenus function doesn't work and will cause overwrite or duplicates on last opened menu when you open a new menu (needs testing) fixed thanks to @QuadrupleTurbo

  • building Async is currently kinda useless as it could take a lot of time (2sec) to build up a ~50 item menu with some animations , possibly make it moveable to next index but not to last index untill its built ( tldr : while building can go down , but cant go up past # 1 index) (Also need a way to fix the animation glitch that this introduce)

  • if current menu is on MaxItemsOnScreen number (like 8), if you go to a new menu and back out , item selection will disappear

  • add missing BigFeedHandler as in C# library

  • fix statistics panel not updating values

  • when cursor is active OnItemSelect is fired for items the cursor is not over the item a8fee81

Let me know if i missed anything

[LUA] Conflict with Other Menus

After updating to the latest version, I have encountered an issue with the menu banner not moving to the right as it used to. The banner remains in its initial left position at all times. Additionally, I suspect this menu is conflicting with other menus in my server. The title of this menu library overlaps with the title of another menu, causing visibility issues with the options. The options are not displayed properly, and it becomes challenging to navigate through them.

Furthermore, when I use the arrow keys on the keyboard to navigate within the menu, the navigation appears to be inverted. For example, when I press the up arrow key, the selection moves downward, and vice versa.

image


In version 3.0.0, I have a video demonstrating how it was before. However, I encountered issues with one menu (character customization) where the options were getting duplicated, and some texts were appearing from other menus.

https://cdn.discordapp.com/attachments/982938924496355389/1105963321951273050/2023-05-10_17-57-20.mp4

Proper way to handle menus?

What's the proper way to handle menus? Recreating them every time they are used? Or toggling menu:Visible(not menu:Visible())?

Instructional Buttons

whenever the menu is executed, if it has instructional buttons, after closing, some thread, probably the instructional buttons handle, in memory, keep running, increasing the script tick time.

I believe it has a direct relationship with the buttons, because when I remove all references and create a menu without them, after closing it, the ms returns to the previous idle value.

How to reproduce:
run resmon before opening a menu, it could be example menu, pay attention to the ms time, open and close the menu a few times and compare with previous resmon value

Add support for RightLabel and LeftBadge in submenus

Currently, this functionality is only available for regular "items," but not for submenus. In the example below, I would like to add badge icons and align the values to the right for improved visual appeal and easier navigation.

Current:
image

[bug] Warning not displaying texts

Im having issues to create a simple warning, any idea if im doing something wrong?

RegisterCommand('warning', function()
    ScaleformUI.Scaleforms.Warning:ShowWarning("This is the title", "This is the subtitle", "This is the prompt.. you have 6 seconds left", "This is the error message, ScaleformUI Ver. 3.0")
end)

Result:

image

[LUA] Error on ShowFloatingHelpNotification

image

  Notifications:ShowFloatingHelpNotification(
      "My test floating notification :3",
      GetEntityCoords(GetPlayerPed(-1)),
      3000
  )

Coords is correct, I don't know why it rising an error.

[NuGet] Prep project for NuGet packaging.

  • Change project type to newer version to allow packaging
  • Check changes do not affect current systems
  • Create a new readme for NuGet page to inform users of the assets they need to download
  • Deploy to NuGet for testing
  • Confirm all checks

Multiple Source - Same Target

Was building an admin menu using this when I occured an issue that you cant add same menu as many submenus for example an online players options which shows all the onlineplayers as submenus which gets directed to a single menu on click which has the options

[PauseMenu C#] Issue with RightLabel & text visibility issue

When I use the following code snippet to prompt the user for an email and then set the RightLabel to the entered email, it doesn't display the expected email string. Instead, it shows some random symbols.

emailItem.OnActivate += async (item) =>
{
    email = await Utils.Input.Keyboard("Email:", email, true, 20, null, pauseMenu);
    emailItem.RightLabel = email;
};

There's another intermittent issue concerning the text color and background color of the menu items. Occasionally, when hovering over a menu item, both the text color and background color turn white, making it impossible to read.

image

UIMenu:MouseControlsEnabled doesn't stop mouse clicks from activating items

Issue

Using UIMenu:MouseControlsEnabled to disable the mouse input for a UIMenu instance doesn't stop mouse clicks from activating the currently highlighted item.

Steps to Reproduce

  1. Create a menu with at least 1 item in it.
	local menu = UIMenu.New('Menu', 'Subtitle')
	local testButton = UIMenuItem.New('Test', 'Description')

	testButton.Activated = function(menu, item)
		print('boom!')
	end

	menu:AddItem(testButton)

	menu:MouseControlsEnabled(false)
	menu:Visible(true)
  1. Once the menu is on screen and the option is highlighted, click the left mouse button.
  2. Observe boom! being printed in the F8 console.

Expected Behavior

UIMenu:MouseControlsEnabled should prevent mouse buttons from interacting with the menu.

Additional Notes

With mouse controls enabled, clicking menu items with the mouse might occasionally crash the game. This is best reproduced with at least 3 menu items to click between.

Menu header CounterPretext

The CounterPretext variable is present in the UIMenu script for both CSharp and Lua, but is unusable as of now.
It might be useful to add support for it to allow updating the color of the counter.

/// <summary>
/// String to pre-attach to the counter string. Useful for color codes.
/// </summary>
public string CounterPretext { get; set; }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.