Guad/NativeUI

Menu not work when using example code

HongLouMusic opened this issue · 3 comments

[06:34:22] [DEBUG] Loading API from .\ScriptHookVDotNet2.dll ...
[06:34:22] [DEBUG] Loading API from .\ScriptHookVDotNet3.dll ...
[06:34:22] [DEBUG] Loading scripts from E:\Steam\steamapps\common\Grand Theft Auto V\scripts ...
[06:34:22] [DEBUG] Loading assembly ModeBase.dll ...
[06:34:22] [INFO] Found 2 script(s) in ModeBase.dll resolved to API 2.10.11.
[06:34:22] [DEBUG] Loading assembly NativeUI.dll ...
[06:34:22] [WARNING] Unable to resolve API version 2.10.12.
[06:34:22] [WARNING] Unable to resolve API version 2.10.12.
[06:34:22] [WARNING] Unable to resolve API version 2.10.12.
[06:34:22] [WARNING] Unable to resolve API version 2.10.12.
[06:34:22] [WARNING] Unable to resolve API version 2.10.12.
[06:34:22] [WARNING] Unable to resolve API version 2.10.12.
[06:34:22] [DEBUG] Instantiating script MenuExample ...
[06:34:22] [WARNING] Unable to resolve API version 2.10.12.
[06:34:22] [ERROR] Failed to instantiate script MenuExample because constructor threw an exception: System.IO.FileNotFoundException: Could not load file or assembly 'ScriptHookVDotNet2, Version=2.10.12.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'ScriptHookVDotNet2, Version=2.10.12.0, Culture=neutral, PublicKeyToken=null'
at NativeUI.UIMenu..ctor(String title, String subtitle, Point offset, String spriteLibrary, String spriteName)
at NativeUI.UIMenu..ctor(String title, String subtitle)
at MenuExample..ctor()

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

[06:34:22] [DEBUG] Instantiating script RandomAttackers ...
[06:34:22] [INFO] Started script RandomAttackers.

I already put ScriptHookVDotNet2.dll ScriptHookVDotNet3.dll NativeUI.dll and ScriptHookV.dll in the root directory of my gta, but still not work.

`public MenuExample()
{
_menuPool = new MenuPool();
GTA.UI.ShowSubtitle("Native UI is Running", 5000);
var mainMenu = new UIMenu("Native UI", "bNATIVEUI SHOWCASE"); //I feel this line caused the problem, code becfore this worked ok

    _menuPool.Add(mainMenu);
    AddMenuKetchup(mainMenu);
    AddMenuFoods(mainMenu);
    AddMenuCook(mainMenu);
    AddMenuAnotherMenu(mainMenu);
    _menuPool.RefreshIndex();

    Tick += (o, e) => _menuPool.ProcessMenus();
    KeyDown += (o, e) =>
    {
        if (e.KeyCode == Keys.F5 && !_menuPool.IsAnyMenuOpen()) // Our menu on/off switch
        {
            mainMenu.Visible = !mainMenu.Visible;
            GTA.UI.ShowSubtitle("Key I Pressed!", 2500);
        }
            
    };
}`

That's my constructor.

I fixed it, it's better to let people know they need to put NativeUI.dll in scripts.