Advertisement
Guest User

Untitled

a guest
Jun 5th, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.69 KB | None | 0 0
  1.  
  2. #appendto Clonk
  3.  
  4. local menuid_sampleselect;
  5.  
  6. func ChooseNoteSampleMenu()
  7. {
  8. var samplemenu =
  9. {
  10. ID = 5001,
  11. Player = GetOwner(),
  12. Decoration = GUI_MenuDeco,
  13.  
  14. Left = "0%",
  15. Top = "0%",
  16. Right = "100%",
  17. Bottom = "100%",
  18.  
  19. Margin = ["2em", "2em"],
  20.  
  21. BackgroundColor = RGBa(0,0,0,255),
  22.  
  23. Text = "$SampleSelect$",
  24.  
  25. catselect =
  26. {
  27. ID = 5002,
  28. Left = "+0.2em",
  29. Top = "+1em",
  30. Right = "40%",
  31. Bottom = "100%-0.2em",
  32.  
  33. BackgroundColor = RGBa(30,30,30,255),
  34. Style = GUI_VerticalLayout,
  35. },
  36.  
  37. sampleselect =
  38. {
  39. ID = 5003,
  40. Left = "40%+0.2em",
  41. Top = "+1em",
  42. Right = "100%-0.1em",
  43. Bottom = "100%-0.2em",
  44.  
  45. BackgroundColor = RGBa(20,20,20,255),
  46. Style = GUI_VerticalLayout,
  47. },
  48.  
  49. };
  50.  
  51. var index = 0;
  52. for (var entry in GetProperties(g_samples))
  53. {
  54. index++;
  55.  
  56. var catentry =
  57. {
  58. // Main Properties
  59. ID = 10000 + index,
  60. Priority = index,
  61. Bottom = "+2em",
  62. BackgroundColor = { Std = 0, Hover = RGBa(0,128,255,255) },
  63.  
  64. // Caption
  65. icon =
  66. {
  67. Symbol = Crate,
  68. Right = "+2em"
  69. },
  70. text =
  71. {
  72. Text = entry,
  73. Left = "+2.5em",
  74. Style = GUI_TextVCenter
  75. },
  76.  
  77. // Events
  78. OnClick = GuiAction_Call(this, "MenuSelectCategory", [entry]),
  79. OnMouseIn = GuiAction_SetTag("Hover"),
  80. OnMouseOut = GuiAction_SetTag("Std")
  81. };
  82.  
  83. GuiAddSubwindow(catentry, samplemenu.catselect);
  84. }
  85.  
  86. menuid_sampleselect = GuiOpen(samplemenu);
  87. }
  88.  
  89. func MenuSelectCategory(data, int player, int ID, int subwindowID, object target)
  90. {
  91. Log("Entry: %v", data);
  92.  
  93. var sampleselect =
  94. {
  95. Left = "40%+0.2em",
  96. Top = "+1em",
  97. Right = "100%-0.1em",
  98. Bottom = "100%-0.2em",
  99.  
  100. BackgroundColor = RGBa(20,20,90,255),
  101. Style = GUI_VerticalLayout,
  102. };
  103.  
  104. var index = 0;
  105.  
  106. for (var entry in GetProperties(g_samples[data[0]]))
  107. {
  108. Log("Entry in Menu is %v", entry);
  109. index++;
  110. var sampleentry =
  111. {
  112. ID = 15000 + index,
  113. Priority = index,
  114.  
  115. Bottom = "+2em",
  116. BackgroundColor = { Std = 0, Hover = RGBa(0,128,255,255) },
  117.  
  118. // Caption
  119. icon =
  120. {
  121. Symbol = Amethyst,
  122. Right = "+2em"
  123. },
  124. text =
  125. {
  126. Text = entry,
  127. Left = "+2.5em",
  128. Style = GUI_TextVCenter
  129. },
  130.  
  131. // Events
  132. OnClick = GuiAction_Call(this, "MenuSelectSample", [entry]),
  133. OnMouseIn = GuiAction_SetTag("Hover"),
  134. OnMouseOut = GuiAction_SetTag("Std")
  135. };
  136.  
  137. GuiAddSubwindow(sampleentry, sampleselect);
  138. }
  139.  
  140. GuiUpdate(sampleselect, menuid_sampleselect, 5003);
  141.  
  142.  
  143. }
  144.  
  145. func MenuSelectSample(data, int player, int ID, int subwindowID, object target)
  146. {
  147. Log("Sample Selected %v", data);
  148. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement