Skip to content
View in the app

A better way to browse. Learn more.

LCPDFR.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Rage Native UI

Featured Replies

Hi All,

So the newest version of Secondary Callouts will include multiple audio options the officer themselves can say.  I was originally planning on having these be static (only said with specific callouts) but I want to make them more interactive- make the player choose what's best to say.

I'm trying to use the Rage Native UI but I can't get my menu to even show up in game.  Any ideas as to why?  I'm trying to learn it, but I want to be able to see what changes I'm making as I make them so I can figure it out!

FYI this is in my namespace of my callouts- is that an acceptable place to put it?

Thanks!

Spoiler

    public static class Menu
    {
        private static UIMenu mainMenu;
        private static UIMenu newMenu;

        private static NativeMenuItem SaveOfficer;
        private static NativeMenuItem LeaveOfficer;

        private static MenuPool _menuPool;

        public static void Main()
        {
            Game.FrameRender += Process;

            _menuPool = new MenuPool();

            mainMenu = new UIMenu("Secondary Callouts", "~b~Callout Menu");

            _menuPool.Add(mainMenu);

            mainMenu.AddItem(SaveOfficer = new NativeMenuItem("Save the Officer!", "Choose this to save the officer and bring him to the hospital."));

            var menuItem = new NativeMenuItem("Go to the Audio menu.");
            mainMenu.AddItem(menuItem);
            SaveOfficer.SetLeftBadge(NativeMenuItem.BadgeStyle.Star);
            SaveOfficer.SetRightBadge(NativeMenuItem.BadgeStyle.Tick);

            LeaveOfficer = new NativeMenuItem("Spawn Car");
            mainMenu.AddItem(LeaveOfficer);

            mainMenu.RefreshIndex();

            mainMenu.OnItemSelect += OnItemSelect;

            newMenu = new UIMenu("Audio Menu", "~b~Select the audio needed!");
            _menuPool.Add(newMenu);
            newMenu.RefreshIndex();
            mainMenu.BindMenuToItem(newMenu, menuItem);

            while (true)
                GameFiber.Yield();
        }

        public static void OnItemSelect(UIMenu sender, NativeMenuItem selectedItem, int index)
        {
            if (sender != mainMenu) return; // We only want to detect changes from our menu.
            // You can also detect the button by using index

            if (selectedItem == SaveOfficer)   // We check wich item has been selected and do different things for each.
            {
                Game.DisplayNotification("Save Officer!");
            }
            else if (selectedItem == LeaveOfficer)
            {
                Game.DisplayNotification("Leave Officer");
            }
        }

        public static void Process(object sender, GraphicsEventArgs e)
        {
            if (Game.IsKeyDown(Keys.F5) && !_menuPool.IsAnyMenuOpen()) // Our menu on/off switch.
                mainMenu.Visible = !mainMenu.Visible;

            _menuPool.ProcessMenus();       // Procces all our menus: draw the menu and procces the key strokes and the mouse. 
        }
    }

 

Edited by fiskey111

 

 

You have to remove
while (true)
    GameFiber.Yield();

from the method Main(). In the example it's there because otherwise RPH will reach the end of Main and unload the plugin.

That should work, and I recommend you to change the name Main to something more descriptive, like Initialize.

Edited by alexguirre

  • Author
36 minutes ago, alexguirre said:

You have to remove
while (true)
    GameFiber.Yield();

from the method Main(). In the example it's there because otherwise RPH will reach the end of Main and unload the plugin.

That should work, and I recommend you to change the name Main to something more descriptive, like Initialize.

Ah, gotcha.

I did that and it still isn't loading though!  I'm going to recheck everything now to make sure I didn't screw anything up!

 

 

1 minute ago, fiskey111 said:

Ah, gotcha.

I did that and it still isn't loading though!  I'm going to recheck everything now to make sure I didn't screw anything up!

Weird, maybe you are having some crash that you didn't notice because LSPDFR handled it?

  • Author
11 minutes ago, alexguirre said:

Weird, maybe you are having some crash that you didn't notice because LSPDFR handled it?

I'm not sure.  Am I allowed to have it in the namespace for my Callouts?

 

 

  • Author
4 minutes ago, alexguirre said:

Yes

Hm.  I don't know then- I'm not seeing any error messages, and I even switched the key around.  I'll play around with it and see if I can figure it out!  Thank you!

 

 

3 hours ago, fiskey111 said:

Hm.  I don't know then- I'm not seeing any error messages, and I even switched the key around.  I'll play around with it and see if I can figure it out!  Thank you!

Are you calling the Main method to initialize the menu anywhere in your plugin? Maybe you forgot to do it.

 

EDIT: update to RAGENativeUI 1.3 that has been released today, I think that the only change you will have to do is change NativeMenuItem to UIMenuItem

Edited by alexguirre

  • Author
5 hours ago, alexguirre said:

Are you calling the Main method to initialize the menu anywhere in your plugin? Maybe you forgot to do it.

 

EDIT: update to RAGENativeUI 1.3 that has been released today, I think that the only change you will have to do is change NativeMenuItem to UIMenuItem

Ha wow I'm an idiot... I was so excited to see if it worked I didn't even call it...  I just called it and it worked!  Thank you!!

And great- thanks!

 

 

  • 8 months later...

I'm late to the party here, but I am trying to get the example ragenativeUI menu to load into my lspdfr plugins callout, but I am getting a game freeze when I accept one of the callouts using my plugin. I'm working with Albo on this but he is studying for exams I believe, so I wondered if anyone here could help me out. I'm sure it is a quick fix. I have a .rar ready to send to a helpful somebody

  • Author
5 hours ago, Markadaliah said:

I'm late to the party here, but I am trying to get the example ragenativeUI menu to load into my lspdfr plugins callout, but I am getting a game freeze when I accept one of the callouts using my plugin. I'm working with Albo on this but he is studying for exams I believe, so I wondered if anyone here could help me out. I'm sure it is a quick fix. I have a .rar ready to send to a helpful somebody

If your game is freezing when you're calling it I would assume it's from not yielding the gamefiber you create it in.  I would try that!

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.