Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Forum Support

    3. Suggestions

[.NET] NativeUI


Guad
 Share

Recommended Posts

unknown modder

Hello Again, sorry for asking so many questions but can someone help me with this code, it doesnt seem to work.

Thanks :D

http://pastebin.com/D7D52tmb

Whats not working. It wont compile, it throws an error when you run it - in which case post error logs(scripthookvdotnet), the menu doesnt show, the menu shows but options dont work etc

Link to comment
Share on other sites

 

Hello Again, sorry for asking so many questions but can someone help me with this code, it doesnt seem to work.

Thanks :D

http://pastebin.com/D7D52tmb

Whats not working. It wont compile, it throws an error when you run it - in which case post error logs(scripthookvdotnet), the menu doesnt show, the menu shows but options dont work etc

 

Oh no i was so stupid i got the sub menu parts wrong but i got it all working perfectly :) but now im going to learn how to use check boxes from the example menu. :) btw @Guad Nice Menu Base! (BEST) :)

Link to comment
Share on other sites

Suggestion:

 

New feature: when you hover over your screen's edge, the camera will rotate and the cursor will change sprites.

 

should be disabled by default :-) The feature only occurs at a few of GTA's own menus.

Edited by frodzet
Link to comment
Share on other sites

Suggestion:

 

New feature: when you hover over your screen's edge, the camera will rotate and the cursor will change sprites.

 

should be disabled by default :-) The feature only occurs at a few of GTA's own menus.

 

Well you can disable it yourself if you wish to.

Link to comment
Share on other sites

 

Suggestion:

 

New feature: when you hover over your screen's edge, the camera will rotate and the cursor will change sprites.

 

should be disabled by default :-) The feature only occurs at a few of GTA's own menus.

 

Well you can disable it yourself if you wish to.

 

Oh, i'm aware of that :-) Just saying being disabled by default would make more sense :-)

 

Nevermind! I just figured it is actually on my default, it's just that the screen turns even when the mouse is hovering an item in the menu (this should not be the case) :-)

Edited by frodzet
Link to comment
Share on other sites

Is it possible to prevent the menu from going back one step when pressing P and instead open the pause menu? :-) I've tried to suppress the key, but can't seem to get it working :-)

 

Thanks :-)

Link to comment
Share on other sites

Is it possible to prevent the menu from going back one step when pressing P and instead open the pause menu? :-) I've tried to suppress the key, but can't seem to get it working :-)

 

Thanks :-)

 

myMenu.ResetKey(MenuControls.Back);

myMenu.SetKey(MenuControls.Back, GTA.Control.PhoneCancel);

Link to comment
Share on other sites

 

Is it possible to prevent the menu from going back one step when pressing P and instead open the pause menu? :-) I've tried to suppress the key, but can't seem to get it working :-)

 

Thanks :-)

 

myMenu.ResetKey(MenuControls.Back);

myMenu.SetKey(MenuControls.Back, GTA.Control.PhoneCancel);

 

 

Alright, so is there a way that i can override the Menu so that the pause menu opens on P (or any other keypress for that matter)? :-) Because i want to be able to set a marker on the map while the menu is open so that when i exit the pause menu i'm back at the same place in my menu as before :-) Else i would have to first close the menu, set a marker, then open the menu and go to my TeleportToMarkerButton.

Edited by frodzet
Link to comment
Share on other sites

GeorgeZhang

is it possible to make a picture attach to an item (much like how the item descriptions work)?

it would be even more amazing

 

EDIT:also, is it possible to add support for "foreach" method to MenuPool? 'cause when i was trying to get all menus in _menupool with "foreach", it says " NativeUI.MenuPool does not contain a public definition for GetEnumerator"

Edited by GeorgeZhang
Link to comment
Share on other sites

is it possible to make a picture attach to an item (much like how the item descriptions work)?

it would be even more amazing

 

EDIT:also, is it possible to add support for "foreach" method to MenuPool? 'cause when i was trying to get all menus in _menupool with "foreach", it says " NativeUI.MenuPool does not contain a public definition for GetEnumerator"

For the picture, you can call Sprite.DrawTexture in a loop.

 

And for the menupool use the ToList() method

Link to comment
Share on other sites

GeorgeZhang

 

is it possible to make a picture attach to an item (much like how the item descriptions work)?

it would be even more amazing

 

EDIT:also, is it possible to add support for "foreach" method to MenuPool? 'cause when i was trying to get all menus in _menupool with "foreach", it says " NativeUI.MenuPool does not contain a public definition for GetEnumerator"

For the picture, you can call Sprite.DrawTexture in a loop.

 

And for the menupool use the ToList() method

 

ok thanks. btw, i am still having trouble changing controls, like i cannot set control keys to numpad keys, i use this code:

mainmenu.ResetKey(UIMenu.MenuControls.Up);mainmenu.SetKey(UIMenu.MenuControls.Up, Keys.NumPad8);

please help

Link to comment
Share on other sites

 

 

is it possible to make a picture attach to an item (much like how the item descriptions work)?

it would be even more amazing

 

EDIT:also, is it possible to add support for "foreach" method to MenuPool? 'cause when i was trying to get all menus in _menupool with "foreach", it says " NativeUI.MenuPool does not contain a public definition for GetEnumerator"

For the picture, you can call Sprite.DrawTexture in a loop.

 

And for the menupool use the ToList() method

 

ok thanks. btw, i am still having trouble changing controls, like i cannot set control keys to numpad keys, i use this code:

mainmenu.ResetKey(UIMenu.MenuControls.Up);mainmenu.SetKey(UIMenu.MenuControls.Up, Keys.NumPad8);

please help

 

If you're using Keys, you need to have a menuPool.ProcessKey(key.KeyCode) in your OnKeyDown event

Link to comment
Share on other sites

Bug:

If an item in the list is double then there are problems with displaying 0.0 and 0.1 (-0.1). It shows something like E323483480984092238489023+32423423423

Link to comment
Share on other sites

Bug:

If an item in the list is double then there are problems with displaying 0.0 and 0.1 (-0.1). It shows something like E323483480984092238489023+32423423423

 

It's something on your side, not something related to NativeUI. As you can see in the picture below, lists accepts double values:

 

tDVjEi2.jpg

Link to comment
Share on other sites

 

Bug:

If an item in the list is double then there are problems with displaying 0.0 and 0.1 (-0.1). It shows something like E323483480984092238489023+32423423423

 

It's something on your side, not something related to NativeUI. As you can see in the picture below, lists accepts double values:

 

It's because of the way I generate the list. I iterate and add 0.1. But it should apply rounding when displays it anyway... :/

Link to comment
Share on other sites

 

 

Bug:

If an item in the list is double then there are problems with displaying 0.0 and 0.1 (-0.1). It shows something like E323483480984092238489023+32423423423

 

It's something on your side, not something related to NativeUI. As you can see in the picture below, lists accepts double values:

 

It's because of the way I generate the list. I iterate and add 0.1. But it should apply rounding when displays it anyway... :/

 

You're sure you are iterating using the right type? :-)

Link to comment
Share on other sites

GeorgeZhang

ok i have another problem; when i set my own key, the menu will process the key multiple times, for instance i have four layers of menu and when i select the item in mainmenu it jumped straight to 4th. menu... tested, only happens when i set my own key, thanks for all your help!

 

EDIT: how to i set a "game sprite" to the banner? also is there a way to make the menu only takes keyboard commands but not mouse buttons?

Edited by GeorgeZhang
Link to comment
Share on other sites

 

 

Bug:

If an item in the list is double then there are problems with displaying 0.0 and 0.1 (-0.1). It shows something like E323483480984092238489023+32423423423

 

It's something on your side, not something related to NativeUI. As you can see in the picture below, lists accepts double values:

 

It's because of the way I generate the list. I iterate and add 0.1. But it should apply rounding when displays it anyway... :/

 

 

The list just calls the ToString method of your dynamic item. You can do it yourself by rounding it, calling ToString and then add it to the list.

Edited by Guad
Link to comment
Share on other sites

Can i ask why OnItemSelect has an index identifier while OnCheckChange does not? :-)

Dunno, but you can always access your checkbox item's Parent property, which returns the menu, and then access CurrentSelection.

Link to comment
Share on other sites

 

Can i ask why OnItemSelect has an index identifier while OnCheckChange does not? :-)

Dunno, but you can always access your checkbox item's Parent property, which returns the menu, and then access CurrentSelection.

 

 

Yeah, i figured :-) Just wondering why the behavior of those two events are working differently :-)

Link to comment
Share on other sites

GeorgeZhang

ok i have another problem; when i set my own key, the menu will process the key multiple times, for instance i have four layers of menu and when i select the item in mainmenu it jumped straight to 4th. menu... tested, only happens when i set my own key, thanks for all your help!

 

EDIT: how to i set a "game sprite" to the banner? also is there a way to make the menu only takes keyboard commands but not mouse buttons?

please help me

 

EDIT: ok i figured out how to fix the key:

if (e.KeyCode == Keys.F9)   _pool.ProcessKey(Keys.F9);

but still, how to set the banner to game sprite??

Edited by GeorgeZhang
Link to comment
Share on other sites

 

ok i have another problem; when i set my own key, the menu will process the key multiple times, for instance i have four layers of menu and when i select the item in mainmenu it jumped straight to 4th. menu... tested, only happens when i set my own key, thanks for all your help!

 

EDIT: how to i set a "game sprite" to the banner? also is there a way to make the menu only takes keyboard commands but not mouse buttons?

please help me

 

EDIT: ok i figured out how to fix the key:

if (e.KeyCode == Keys.F9)   _pool.ProcessKey(Keys.F9);

but still, how to set the banner to game sprite??

 

 

myMenu.SetBannerType(new Sprite("yourSpriteLibrary", "yourSpriteName", new Point(0,0), new Size(0,0));

also you should have set it to _pool.ProcessKey(e.KeyCode); at the beginning of your OnKeyDown event handler

Link to comment
Share on other sites

GeorgeZhang

Hello I have a question, i thought you might know how to use UI.DrawTexture? What is the param "filename"? Where can I find textures to draw, like radar blips or weapon icons?

Link to comment
Share on other sites

Hello I have a question, i thought you might know how to use UI.DrawTexture? What is the param "filename"? Where can I find textures to draw, like radar blips or weapon icons?

You can use NativeUI.Sprite.DrawTexture(string filename, Point position, Size size)

filename parameter is the path to your custom texture, you can place your picture in the scripts folder and pass "scripts\\mypic.png" as the filename.

You can also use pictures embedded in your project. For that drag your picture to your project in the project solution, and select it's property as "Embedded Resource". then call once string myPicturePath = NativeUI.Sprite.WriteFileFromResources(Assembly.GetExecutingAssembly(), "myNamespace.mypic.png"); and then use it in DrawTexture. Note that you have to include your default namespace in WriteFileFromResources. You can view it in Properties.

 

As for what textures, that's up to you.

Link to comment
Share on other sites

GeorgeZhang

 

Hello I have a question, i thought you might know how to use UI.DrawTexture? What is the param "filename"? Where can I find textures to draw, like radar blips or weapon icons?

You can use NativeUI.Sprite.DrawTexture(string filename, Point position, Size size)

filename parameter is the path to your custom texture, you can place your picture in the scripts folder and pass "scripts\\mypic.png" as the filename.

You can also use pictures embedded in your project. For that drag your picture to your project in the project solution, and select it's property as "Embedded Resource". then call once string myPicturePath = NativeUI.Sprite.WriteFileFromResources(Assembly.GetExecutingAssembly(), "myNamespace.mypic.png"); and then use it in DrawTexture. Note that you have to include your default namespace in WriteFileFromResources. You can view it in Properties.

 

As for what textures, that's up to you.

 

The first one worked. but the second one crashed the game...I guess it's my problem. What about ingame textures?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 24 Users Currently Viewing
    0 members, 0 Anonymous, 24 Guests

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.