Quantcast

Jump to content

» «
Photo

NativeUI Tutorials

16 replies to this topic
ISOFX
  • ISOFX

    Trick

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

#1

Posted 01 September 2015 - 01:00 PM Edited by ISOFX, 01 September 2015 - 01:14 PM.

I Have Realized that some people don't know how to do some things like me, this is only for people who use NativeUI, for those who don't know what NativeUI is, its a Rockstar themed menu base, so it looks exactly like the way Rockstars menus look. Hope this helps!

 

Download NativeUI - By Guad

Download My Template - By ISOFX

 

Simple Buttons - 

var ButtonName = new UIMenuItem("Button Text", "Button Description.");
MenuName.AddItem(ButtonName);

Adding a Function to a Button - 

In "private void OnItemSelect(UIMenu sender, UIMenuItem selectedItem, int index)" Add the following code inside the void - 

if (sender == mainMenu) // change the sender to your menu.
{
    switch (index)
    {
    case 0:
       UI.Notify("Add Your Own Function.");
       break;
    }
}

Adding a Sub menu - 

1. At the top of your script where it says "private UIMenu mainMenu;" Write "private UIMenu Sub1;"

2. From your main menu, add a normal button with no function.

3. Under "RefreshIndex();" add "mainMenu.BindMenuToItem(SubMenu1(), ButtonYourBindingTo);"

4. Add the following code under "private UIMenu StartUpMenu()"

Step 4 Code - 

   private UIMenu SubMenu1()
   {
        Sub1 = new UIMenu("TITLE", "~b~SUB HEADER");
        _menuPool.Add(Sub1);
        

        Sub1.OnItemSelect += OnItemSelect;
        Sub1.OnCheckboxChange += OnCheckboxChange;
        Sub1.OnListChange += new ListChangedEvent(OnListChange);
        Sub1.OnListChange += new ListChangedEvent(OnListChange);
        Sub1.RefreshIndex();

        return Sub1;
    } 

5. Add Buttons etc, and make sure you change the sender to, Sub1 when adding functions.

 

Fade Text - 

ButtonName.Enabled = false;

Add a List - 

1. Add the following to the top of your code where it says "private UIMenu mainMenu;"

private List<object> List1;
private UIMenuListItem List1Item;

2. In the menu you want the list in add the following - 

List1 = new List<object> { "Item 1", "Item 2", "Item 3" };
List1Item = new UIMenuListItem("Your Text ", List1, 0);
MenuName.AddItem(List1Item);

3. In "private void OnListChange(UIMenu sender, UIMenuListItem list, int index)" add the following code

if (sender == mainMenu) //change sender to your menu.
{
  if (list == List1Item)
  {
       switch (index)
       {
        case 0:
           UI.Notify("Function in this case.");     
           break;
       }
   }
}

Adding a Checkbox - 

1. Add the following code below "private UIMenu mainMenu;"

private UIMenuCheckboxItem CheckboxOne;
bool CheckboxOneActive = false; 

2. In "public void OnCheckboxChange(UIMenu sender, UIMenuCheckboxItem checkbox, bool Checked)" Add the following code:

if (sender == mainMenu && checkbox == CheckboxOne) // Change sender to your menu
{
   switch (Checked)
   {
        case true:
             CheckboxOneActive = true;
             break;
        case false:
             CheckboxOneActive = false;
             break;
    }
}

3. In "private void OnTick(object sender, EventArgs e)" Add the following code:

if (CheckboxOneActive)
{
   UI.Notify("Your functions in this if statement.");
}

4. Done!

 

Hope This Helps!

Will be updating this regularly for people who need more help, if you need anything else here , just comment on what it is. :)

  • Rented and ChOcOsKiZo like this

FowardElement
  • FowardElement

    Player Hater

  • Members
  • Joined: 02 May 2015
  • United-States

#2

Posted 02 September 2015 - 03:54 AM

Thanks, this is awesome!

FowardElement
  • FowardElement

    Player Hater

  • Members
  • Joined: 02 May 2015
  • United-States

#3

Posted 03 September 2015 - 05:33 PM

Do you know how to make a button that is unselectable and the text for it is centered? Im trying to make a "Settings" or "Options" spacer for my menu. Thanks

ISOFX
  • ISOFX

    Trick

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

#4

Posted 03 September 2015 - 08:47 PM Edited by ISOFX, 03 September 2015 - 08:49 PM.

Do you know how to make a button that is unselectable and the text for it is centered? Im trying to make a "Settings" or "Options" spacer for my menu. Thanks

This is the only way i found:

var Yourbutton = new UIMenuItem("                         " + "Button", "Description");
yourMenu.AddItem(Yourbutton);

This centers the text, it does work, but its not the best way, ask on the coding section,

 

And to fade the text to show its unavailable you do this:

yourButton.Enabled = false;

Hope this helped! :)


FowardElement
  • FowardElement

    Player Hater

  • Members
  • Joined: 02 May 2015
  • United-States

#5

Posted 03 September 2015 - 09:14 PM

Thats a clever way to do that! Thanks

YossiBz
  • YossiBz

    Square Civilian

  • Members
  • Joined: 13 Jun 2010

#6

Posted 06 November 2015 - 07:45 PM

if i want a list choose for example i want to teleport submarine part #2

and i have a list and i want to click to teleport and not to change


HeshamAlking
  • HeshamAlking

    Player Hater

  • Members
  • Joined: 19 Oct 2015
  • United-States

#7

Posted 07 November 2015 - 03:49 PM Edited by HeshamAlking, 07 November 2015 - 03:52 PM.

what kind of button 

 

var what i write here exactly? = new UIMenuItem("Button Text", "Button Description.");
yourMenu.AddItem
(what i write here exactly? );


jaky2008
  • jaky2008

    =A= Angels Of Death MC RIP

  • Members
  • Joined: 13 May 2009
  • United-Kingdom

#8

Posted 07 November 2015 - 10:59 PM Edited by jaky2008, 09 November 2015 - 09:43 PM.

I've made a sub-menu that I want to load once I press on a button from the mainMenu... how can that be done? Can we only navigate menus using the "index" aka integers? I don't understand how to use that, it would be way better if I could navigate menu's using whatever button you specifically click on as opposed to all buttons from the mainMenu. 


h3adshotzz
  • h3adshotzz

    Player Hater

  • New Members
  • Joined: 28 Dec 2015
  • United-Kingdom

#9

Posted 02 January 2016 - 02:15 AM

ive built it in visual studio but where is the mod saved to in the folder? sorry if this is a dumb question im new to this. great tutorial by the way :) i subbed on youtube


ISOFX
  • ISOFX

    Trick

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

#10

Posted 02 January 2016 - 06:13 PM

ive built it in visual studio but where is the mod saved to in the folder? sorry if this is a dumb question im new to this. great tutorial by the way :) i subbed on youtube

 

When you build it the build tab shows you the location of the created file. If you have anymore problems add me on skype.

Skype: isofxyt


Azorah
  • Azorah

    C# Developer

  • Members
  • Joined: 21 Feb 2016
  • England

#11

Posted 21 February 2016 - 01:22 PM

Very very helpful :)


123iamking
  • 123iamking

    Who am I?

  • Members
  • Joined: 21 Jan 2011
  • None

#12

Posted 24 April 2016 - 10:36 AM

This is so awesome, man ;)


123iamking
  • 123iamking

    Who am I?

  • Members
  • Joined: 21 Jan 2011
  • None

#13

Posted 28 April 2016 - 01:18 PM

Anyway, Is the the same as the UI in Alexander Blade's Native Trainer?


extractor404
  • extractor404

    Player Hater

  • Members
  • Joined: 07 Aug 2016
  • Sweden

#14

Posted 07 August 2016 - 04:16 PM

Hi, I'm sorry if this is kind of late, but I'm just getting started with NativeUI.

I strongly believe it's possible to make a checkbox and have the player have invincibility/god mode whenever it's checked, and when it's unchecked/blank, the invincibility disappears. (Essentially a toggle).

I've searched wide and far for an answer and I've tried many "solutions" myself, but none have worked. Any help on that "issue"?


unknown modder
  • unknown modder

    Bon Jon Bovi

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

#15

Posted 09 August 2016 - 04:55 PM

Hi, I'm sorry if this is kind of late, but I'm just getting started with NativeUI.

I strongly believe it's possible to make a checkbox and have the player have invincibility/god mode whenever it's checked, and when it's unchecked/blank, the invincibility disappears. (Essentially a toggle).

I've searched wide and far for an answer and I've tried many "solutions" myself, but none have worked. Any help on that "issue"?

Use the CheckboxEvent event in the UIMenuCheckboxItem to toggle the invincibility when the checkbox is toggled

Item.CheckboxEvent += (sender, bToggle) => Game.Player.Character.IsInvincible = bToggle;

extractor404
  • extractor404

    Player Hater

  • Members
  • Joined: 07 Aug 2016
  • Sweden

#16

Posted 12 August 2016 - 12:34 PM

 

Hi, I'm sorry if this is kind of late, but I'm just getting started with NativeUI.

I strongly believe it's possible to make a checkbox and have the player have invincibility/god mode whenever it's checked, and when it's unchecked/blank, the invincibility disappears. (Essentially a toggle).

I've searched wide and far for an answer and I've tried many "solutions" myself, but none have worked. Any help on that "issue"?

Use the CheckboxEvent event in the UIMenuCheckboxItem to toggle the invincibility when the checkbox is toggled

Item.CheckboxEvent += (sender, bToggle) => Game.Player.Character.IsInvincible = bToggle;

Appreciate the response. We (me and my team of scripters) got it working in a different way. Thank you anyway, now I know that is a way if we decide to change it! :)


LeeC2202
  • LeeC2202

    Mark Chump

  • Members
  • Joined: 24 Oct 2015
  • United-Kingdom

#17

Posted 16 October 2016 - 11:36 PM

How can I dynamically change the List contents of a UIMenuListItem?

 

I have two List items, one that is a list of Dictionary Keys in a Dictionary<string, List<dynamic>>, the second is the List of items from the List<dynamic>. If I change the first item, I want the second item's List to change to whatever I pull from the corresponding Dictionary value.

 

Nothing I have tried works and we don't have access to a UIMenuListItem.Items property.

 

Is this one of those situations where I have to bodge a solution, by using a standard UIMenuItem for the second List and simply change the caption on a Left & Right control input? Or is there a proper way to dynamically alter the list contents?





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users