Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #appendto Clonk
- local menuid_sampleselect;
- func ChooseNoteSampleMenu()
- {
- var samplemenu =
- {
- ID = 5001,
- Player = GetOwner(),
- Decoration = GUI_MenuDeco,
- Left = "0%",
- Top = "0%",
- Right = "100%",
- Bottom = "100%",
- Margin = ["2em", "2em"],
- BackgroundColor = RGBa(0,0,0,255),
- Text = "$SampleSelect$",
- catselect =
- {
- ID = 5002,
- Left = "+0.2em",
- Top = "+1em",
- Right = "40%",
- Bottom = "100%-0.2em",
- BackgroundColor = RGBa(30,30,30,255),
- Style = GUI_VerticalLayout,
- },
- sampleselect =
- {
- ID = 5003,
- Left = "40%+0.2em",
- Top = "+1em",
- Right = "100%-0.1em",
- Bottom = "100%-0.2em",
- BackgroundColor = RGBa(20,20,20,255),
- Style = GUI_VerticalLayout,
- },
- };
- var index = 0;
- for (var entry in GetProperties(g_samples))
- {
- index++;
- var catentry =
- {
- // Main Properties
- ID = 10000 + index,
- Priority = index,
- Bottom = "+2em",
- BackgroundColor = { Std = 0, Hover = RGBa(0,128,255,255) },
- // Caption
- icon =
- {
- Symbol = Crate,
- Right = "+2em"
- },
- text =
- {
- Text = entry,
- Left = "+2.5em",
- Style = GUI_TextVCenter
- },
- // Events
- OnClick = GuiAction_Call(this, "MenuSelectCategory", [entry]),
- OnMouseIn = GuiAction_SetTag("Hover"),
- OnMouseOut = GuiAction_SetTag("Std")
- };
- GuiAddSubwindow(catentry, samplemenu.catselect);
- }
- menuid_sampleselect = GuiOpen(samplemenu);
- }
- func MenuSelectCategory(data, int player, int ID, int subwindowID, object target)
- {
- Log("Entry: %v", data);
- var sampleselect =
- {
- Left = "40%+0.2em",
- Top = "+1em",
- Right = "100%-0.1em",
- Bottom = "100%-0.2em",
- BackgroundColor = RGBa(20,20,90,255),
- Style = GUI_VerticalLayout,
- };
- var index = 0;
- for (var entry in GetProperties(g_samples[data[0]]))
- {
- Log("Entry in Menu is %v", entry);
- index++;
- var sampleentry =
- {
- ID = 15000 + index,
- Priority = index,
- Bottom = "+2em",
- BackgroundColor = { Std = 0, Hover = RGBa(0,128,255,255) },
- // Caption
- icon =
- {
- Symbol = Amethyst,
- Right = "+2em"
- },
- text =
- {
- Text = entry,
- Left = "+2.5em",
- Style = GUI_TextVCenter
- },
- // Events
- OnClick = GuiAction_Call(this, "MenuSelectSample", [entry]),
- OnMouseIn = GuiAction_SetTag("Hover"),
- OnMouseOut = GuiAction_SetTag("Std")
- };
- GuiAddSubwindow(sampleentry, sampleselect);
- }
- GuiUpdate(sampleselect, menuid_sampleselect, 5003);
- }
- func MenuSelectSample(data, int player, int ID, int subwindowID, object target)
- {
- Log("Sample Selected %v", data);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement