forked from Florian-1801/RageUIx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexemple.lua
154 lines (125 loc) · 5.61 KB
/
exemple.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Florian.
--- DateTime: 22/04/2022 14:58
---
local MainMenu = RageUI.CreateMenu("Title", "SUBTITLE", nil, nil, "rageui", "demo_banner" )
local SubMenu = RageUI.CreateSubMenu(MainMenu, "Title", "SubTitle")
local Checked = false
local GridX, GridY = 0.5, 0.5
local ListIndex = 1
local ItemPanels = {
percentage = 0.5,
slider = {
ind = 5,
min = 0,
max = 50
}
}
MainMenu.EnableMouse = true
local ListTable = {
{name = "Object 1", label = "object_1", value = 1},
{name = "Object 2", label = "object_2", value = 1},
{name = "Object 3", label = "object_2", value = 1}
}
function RageUI.PoolMenus:Example()
MainMenu:IsVisible(function(Items)
Items:Heritage(1, 2)
Items:AddButton("Render Sprite", "This is a render sprite", { IsDisabled = false }, function(onSelected)
Items:RenderSprite("rageui", "demo_rendersprite",435, 145, 430, 200, 100)
end)
Items:AddSeparator("↓ This is the default Line ↓")
Items:AddLine()
Items:AddSeparator("↓ This is the colored Line with RGB ↓")
Items:AddLine(255, 0, 0)
Items:AddButton("This is a simple button", "Simple button with RightLabel", { IsDisabled = false, RightLabel = "→" }, function(onSelected)
if onSelected then
print("Button selected")
end
end)
Items:AddList("List", { 1, 2, 3 }, ListIndex, 1, nil, { IsDisabled = false }, function(Index, onSelected, onListChange)
if (onListChange) then
ListIndex = Index
print(ListIndex)
end
end)
for _, v in pairs(ListTable) do
Items:AddList(v.name, { 1, 2, 3, 4, 5 }, v.value, 1, nil, { IsDisabled = false }, function(Index, onSelected, onListChange)
Items:AddInfo("Info for ListTable", {"Name :", "Label :", "Actual value (ListIndex) :"}, {v.name, v.label, v.value})
if (onListChange) then
v.value = Index
end
end)
end
Items:AddSeparator("Separator")
Items:CheckBox("Hello", "Descriptions", Checked, { Style = 1 }, function(onSelected, IsChecked)
if (onSelected) then
Checked = IsChecked
print(Checked)
end
end)
Items:AddButton("Popup", "To create a Popup", { IsDisabled = false }, function(onSelected)
if onSelected then
Items:Popup({message = "This is a popup"})
end
end)
Items:AddButton("CharPopup", "To create a Char Popup", { IsDisabled = false }, function(onSelected)
if onSelected then
Items:CharPopup({message = "This is a popup", title = "Title", subtitle = "Subtitle", picture = "CHAR_ARTHUR",}) -- you can add other option you just have to look the code
end
end)
Items:AddButton("Grid Pannel", "This is a Panels:Grid", { IsDisabled = false }, function(onSelected)
if onSelected then
Items:CharPopup({message = "This is a popup", title = "Title", subtitle = "Subtitle", picture = "CHAR_ARTHUR",}) -- you can add other option you just have to look the code
end
end)
Items:AddButton("Close Menu", "To close the current menu", { IsDisabled = false }, function(onSelected)
if onSelected then
Items:CloseCurrentMenu()
end
end)
Items:AddButton("Close All Opened Menu", "To close all of opened menu", { IsDisabled = false }, function(onSelected)
if onSelected then
Items:CloseAllMenu()
end
end)
Items:AddButton("Submenu", nil, { IsDisabled = false }, function(onSelected)
end, SubMenu)
Items:AddButton("Show info", nil, { IsDisabled = false }, function(onSelected)
Items:AddInfo("Info title", {"Info left text 1", "Info left text 2"}, {"Info right text 1", "Info right text 2"})
end)
end, function(Panels)
Panels:Grid(GridX, GridY, "Top", "Bottom", "Left", "Right", function(X, Y, CharacterX, CharacterY)
GridX = X
GridY = Y
print(GridX, GridY)
end, 12)
end)
SubMenu:IsVisible(function(Items)
-- Items
SubMenu.EnableMouse = true
Items:AddButton("This is a submenu", "This is a submenu", { IsDisabled = false }, function(onSelected)
Items:AddInfo("Infos for SubMenu", {"Percentage", "SliderPanel"}, {ItemPanels.percentage * 100 .. " %", ItemPanels.slider.ind})
end)
Items:AddButton("Statistic Panel", false, { IsDisabled = false }, function(onSelected)
if (onSelected) then
end
end)
end, function() -- Panels
Panels:Percentage(ItemPanels.percentage, "Percentage", "0 %", "100 %", function(Percentage, onSelected)
if (onSelected) then
ItemPanels.percentage = Percentage
end
end, 1)
Panels:SliderPanel(ItemPanels.slider.ind, ItemPanels.slider.min, "Slider Panel", ItemPanels.slider.max, function(Value, onSelected)
if (onSelected) then
ItemPanels.slider.ind = Value
end
end, 1)
Panels:StatisticPanel(ItemPanels.percentage, "Percentage", 2)
Panels:StatisticPanelAdvanced("Percentage", ItemPanels.percentage, { 0, 255, 0, 255}, (1 - ItemPanels.percentage), { 255, 0, 0, 255 }, { 255, 255, 255, 255}, 2)
end)
end
Keys.Register("E", "E", "Test", function()
RageUI.Visible(MainMenu, not RageUI.Visible(MainMenu))
end)