Quantcast

Jump to content

» «
Photo

[.NET] NativeUI

V WIP
196 replies to this topic
unknown modder
  • unknown modder

    Bon Jon Bovi

  • Members
  • Joined: 04 Jul 2012
  • United-Kingdom

#61

Posted 28 July 2015 - 11:40 PM

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


ISOFX
  • ISOFX

    Trick

  • Members
  • Joined: 31 May 2015
  • United-Kingdom

#62

Posted 28 July 2015 - 11:45 PM

 

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) :)


frodzet
  • frodzet

    Snitch

  • Members
  • Joined: 24 May 2015
  • Denmark

#63

Posted 29 July 2015 - 12:11 PM Edited by frodzet, 29 July 2015 - 12:13 PM.

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. 


Guad
  • Guad

    Punk-ass Bitch

  • Members
  • Joined: 08 May 2015
  • Spain

#64

Posted 29 July 2015 - 04:04 PM

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.


frodzet
  • frodzet

    Snitch

  • Members
  • Joined: 24 May 2015
  • Denmark

#65

Posted 29 July 2015 - 06:35 PM Edited by frodzet, 29 July 2015 - 06:51 PM.

 

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) :-)


frodzet
  • frodzet

    Snitch

  • Members
  • Joined: 24 May 2015
  • Denmark

#66

Posted 29 July 2015 - 09:25 PM

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 :-)

  • Williambob likes this

Guad
  • Guad

    Punk-ass Bitch

  • Members
  • Joined: 08 May 2015
  • Spain

#67

Posted 29 July 2015 - 10:30 PM

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);

  • Williambob likes this

frodzet
  • frodzet

    Snitch

  • Members
  • Joined: 24 May 2015
  • Denmark

#68

Posted 30 July 2015 - 12:48 AM Edited by frodzet, 30 July 2015 - 01:06 AM.

 

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.


GeorgeZhang
  • GeorgeZhang

    I'm New

  • Members
  • Joined: 04 Jul 2015
  • None

#69

Posted 30 July 2015 - 09:13 AM Edited by GeorgeZhang, 30 July 2015 - 11:44 AM.

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"


Guad
  • Guad

    Punk-ass Bitch

  • Members
  • Joined: 08 May 2015
  • Spain

#70

Posted 30 July 2015 - 11:52 AM

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

GeorgeZhang
  • GeorgeZhang

    I'm New

  • Members
  • Joined: 04 Jul 2015
  • None

#71

Posted 30 July 2015 - 02:12 PM

 

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


Guad
  • Guad

    Punk-ass Bitch

  • Members
  • Joined: 08 May 2015
  • Spain

#72

Posted 30 July 2015 - 02:44 PM

 

 

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


alex8b
  • alex8b

    Square Civilian

  • Members
  • Joined: 12 Jun 2015
  • Sweden

#73

Posted 31 July 2015 - 01:29 PM

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


frodzet
  • frodzet

    Snitch

  • Members
  • Joined: 24 May 2015
  • Denmark

#74

Posted 31 July 2015 - 02:17 PM

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


alex8b
  • alex8b

    Square Civilian

  • Members
  • Joined: 12 Jun 2015
  • Sweden

#75

Posted 31 July 2015 - 03:23 PM

 

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... :/


frodzet
  • frodzet

    Snitch

  • Members
  • Joined: 24 May 2015
  • Denmark

#76

Posted 31 July 2015 - 03:59 PM

 

 

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? :-)


GeorgeZhang
  • GeorgeZhang

    I'm New

  • Members
  • Joined: 04 Jul 2015
  • None

#77

Posted 31 July 2015 - 05:54 PM Edited by GeorgeZhang, 01 August 2015 - 08:56 AM.

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?


Guad
  • Guad

    Punk-ass Bitch

  • Members
  • Joined: 08 May 2015
  • Spain

#78

Posted 31 July 2015 - 06:20 PM Edited by Guad, 31 July 2015 - 06:21 PM.

 

 

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.


frodzet
  • frodzet

    Snitch

  • Members
  • Joined: 24 May 2015
  • Denmark

#79

Posted 31 July 2015 - 11:58 PM

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


ardaozkal
  • ardaozkal

    I made YoloNet (formerly danknet)!

  • New Members
  • Joined: 02 Aug 2015
  • Turkey

#80

Posted 02 August 2015 - 12:27 AM

Looks awesome! Will take a while to recode ~6000 lines of code with this, but that's what the community wants :) http://strawpoll.me/5094464/r


ISOFX
  • ISOFX

    Trick

  • Members
  • Joined: 31 May 2015
  • United-Kingdom

#81

Posted 02 August 2015 - 04:47 PM

Recreated my Particle Effects menu on the menu base, Thanks for this :D credited for this as well.

https://www.gta5-mod...cle-effects-net(Waiting Approval Atm)


Guad
  • Guad

    Punk-ass Bitch

  • Members
  • Joined: 08 May 2015
  • Spain

#82

Posted 02 August 2015 - 08:11 PM

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.


frodzet
  • frodzet

    Snitch

  • Members
  • Joined: 24 May 2015
  • Denmark

#83

Posted 02 August 2015 - 08:32 PM

 

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 :-)


GeorgeZhang
  • GeorgeZhang

    I'm New

  • Members
  • Joined: 04 Jul 2015
  • None

#84

Posted 03 August 2015 - 09:27 AM Edited by GeorgeZhang, 03 August 2015 - 09:53 AM.

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??


Guad
  • Guad

    Punk-ass Bitch

  • Members
  • Joined: 08 May 2015
  • Spain

#85

Posted 03 August 2015 - 01:25 PM

 

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


GTA Imperium
  • GTA Imperium

    Crackhead

  • Members
  • Joined: 12 Jan 2015
  • None

#86

Posted 06 August 2015 - 12:48 AM

Would awesome to have this base in C++:).


GeorgeZhang
  • GeorgeZhang

    I'm New

  • Members
  • Joined: 04 Jul 2015
  • None

#87

Posted 07 August 2015 - 04:22 PM

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?


Guad
  • Guad

    Punk-ass Bitch

  • Members
  • Joined: 08 May 2015
  • Spain

#88

Posted 07 August 2015 - 06:26 PM

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.


GeorgeZhang
  • GeorgeZhang

    I'm New

  • Members
  • Joined: 04 Jul 2015
  • None

#89

Posted 08 August 2015 - 10:50 AM

 

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?


dehan
  • dehan

    Player Hater

  • Members
  • Joined: 29 Aug 2009

#90

Posted 08 August 2015 - 02:21 PM

Any way to disable backspace/right click making the menu close, Guad?





10 user(s) are reading this topic

0 members, 10 guests, 0 anonymous users