Sign in to follow this  
.Neø

NativeUI - Examples Request

Recommended Posts

Hey there,

 

is there som usable example for the NativeUI? If i use that i get an error

Share this post


Link to post
Share on other sites

http://prntscr.com/lvt24o

 

const misc = require('../cMisc');
const NativeUI = require('../nativeui');
const Menu = NativeUI.Menu;
const UIMenuItem = NativeUI.UIMenuItem;
const UIMenuListItem = NativeUI.UIMenuListItem;
const UIMenuCheckboxItem = NativeUI.UIMenuCheckboxItem;
const UIMenuSliderItem = NativeUI.UIMenuSliderItem;
const BadgeStyle = NativeUI.BadgeStyle;
const Point = NativeUI.Point;
const ItemsCollection = NativeUI.ItemsCollection;
const Color = NativeUI.Color;
const ListItem = NativeUI.ListItem;

mp.events.add({
	"cXMenu-Open" : () => {
		mp.gui.cursor.visible = false;
		mp.gui.chat.show(false);

		const ui = new Menu("Test UI", "Test UI Subtitle", new Point(50, 50));
		ui.AddItem(new UIMenuListItem(
			"List Item",
			"Fugiat pariatur consectetur ex duis magna nostrud et dolor laboris est do pariatur amet sint.",
			new ItemsCollection(["Item 1", "Item 2", "Item 3"])
		));
		ui.AddItem(new UIMenuSliderItem(
			"Slider Item",
			["Fugiat", "pariatur", "consectetur", "ex", "duis", "magna", "nostrud", "et", "dolor", "laboris"],
			5,
			"Fugiat pariatur consectetur ex duis magna nostrud et dolor laboris est do pariatur amet sint.",
			true
		));
		ui.AddItem(new UIMenuCheckboxItem(
			"Checkbox Item",
			false,
			"Fugiat pariatur consectetur ex duis magna nostrud et dolor laboris est do pariatur amet sint."
		));

		ui.ItemSelect.on(item => {
			if (item instanceof UIMenuListItem) {
				console.log(item.SelectedItem.DisplayText, item.SelectedItem.Data);
			} else if (item instanceof UIMenuSliderItem) {
				console.log(item.Text, item.Index, item.IndexToItem(item.Index));
			} else {
				console.log(item.Text);
			}
		});

		ui.SliderChange.on((item, index, value) => {
		    console.log(item.Text, index, value);
		});
	},
	"cRadial-Open" : (inject) => {
		misc.prepareToCef(1);
		misc.openCef("package://RP/Browsers/Menu_Radial/Menu.html");
		misc.injectCef(inject);
	},
});

@rootcause @Blue Dadjun

Share this post


Link to post
Share on other sites

Hey @.Neø I managed to solve this by setting webpack to ignore anything as an external library and moved NativeUI into a seperate folder.

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.