--Global vars menuOpened listOpened currentInList -1 keyList centrex g

  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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
--Global vars:
menuOpened = 0;
listOpened = 0;
currentInList = -1;
keyList = {};
centrex = getconfig_i("GlobalConfig", "wwidth")/2;
centrey = getconfig_i("GlobalConfig", "wheight")/2;
ITEM_LISTBOX = gui_addListBox(10, 100, 630, 428, "", -1);
gui_hideElement(ITEM_LISTBOX);
consoleWindow = gui_addWindow(0,0, 2*centrex, 600 , "Console");
mainMenuWindow = gui_addWindow(centrex-100,centrey-120,centrex+100, centrey+120 , "Menu");
gravityMenuWindow = gui_addWindow(centrex-100,centrey-120,centrex+100, centrey+120 , "Gravity Settings");
localMenuWindow = gui_addWindow(centrex-100,centrey-120,centrex+100, centrey+120 , "Location Settings");
weatherMenuWindow = gui_addWindow(centrex-100,centrey-120,centrex+100, centrey+120 , "Weather Settings");
lightingMenuWindow = gui_addWindow(centrex-100,centrey-120,centrex+100, centrey+120 , "Lighting Settings");
soundMenuWindow = gui_addWindow(centrex-100,centrey-120,centrex+100, centrey+120 , "Sound Settings");
objectMenuWindow = gui_addWindow(centrex-100,centrey-120,centrex+100, centrey+120 , "Object Settings");
MAIN_MENU_GRAVITI_SET = gui_addButton(20,20,180,40,"Gravity", mainMenuWindow);
MAIN_MENU_LOCATION_SET = gui_addButton(20,45,180,65, "Location", mainMenuWindow);
MAIN_MENU_WEATHER_SET = gui_addButton(20,70,180,90, "Weather", mainMenuWindow);
MAIN_MENU_LIGHTING_SET = gui_addButton(20,95,180,115, "Lighting", mainMenuWindow);
MAIN_MENU_SOUND_SET = gui_addButton(20,120,180,140, "Sound", mainMenuWindow);
MAIN_MENU_OBJECT_SET = gui_addButton(20,145,180,165, "Objects", mainMenuWindow);
MAIN_MENU_CLOSE = gui_addButton(20,170,180,190, "Close", mainMenuWindow);
GRAVITY_MENU_CLOSE = gui_addButton(20,200,180,220,"Close", gravityMenuWindow);
GRAVITY_ENABLE_CHECKBOX = gui_addCheckBox(20,50,180,60, "Gravity", gravityMenuWindow);
GRAVITY_SPIN = gui_addSpinBox(20,20,180,40, "Gravity level", gravityMenuWindow);
LOCATION_MENU_CLOSE = gui_addButton(20,200,180,220, "Close", localMenuWindow);
LOCATION_MENU_SAVE = gui_addButton(20,20,180,40, "Save", localMenuWindow);
LOCATION_MENU_LOAD = gui_addButton(20,45,180,65, "Load", localMenuWindow);
--
WEATHER_MENU_CLOSE = gui_addButton(20,200,180,220,"Close", weatherMenuWindow);
WEATHER_MENU_SET_DAY = gui_addButton(20,20,180,40,"Day",weatherMenuWindow);
WEATHER_MENU_SET_NIGHT = gui_addButton(20,45,180,65,"Night", weatherMenuWindow);
WEATHER_MENU_SET_ANGLES = gui_addButton(20,70,180,90,"Angles", weatherMenuWindow);
WEATHER_MENU_SPIN_THETA = gui_addSpinBox(105,95,180,115,"ThetaAngl",weatherMenuWindow);
WEATHER_MENU_SPIN_PHI = gui_addSpinBox(20,95,95,115,"PhiAngl",weatherMenuWindow);
LIGHTING_MENU_CLOSE = gui_addButton(20,200,180,220, "Close", lightingMenuWindow);
LIGHTING_MENU_SET_MAX = gui_addButton(20,20,180,40, "Max Light", lightingMenuWindow);
LIGHTING_MENU_SET_LIGHT = gui_addButton(105,45,180,65, "Lightning", lightingMenuWindow);
LIGHTING_MENU_SET_SUN_HEIGHT = gui_addButton(105,70,180,90, "Sun Hight", lightingMenuWindow);
LIGHTING_MENU_SPIN_LIGHT_LVL = gui_addSpinBox(20,45,95,65, "Lightning level", lightingMenuWindow);
LIGHTING_MENU_SPIN_SUN_HEIGHT= gui_addSpinBox(20,70,95,90, "Sun Hight", lightingMenuWindow);
SOUND_MENU_CLOSE = gui_addButton(20,200,180,220, "Close", soundMenuWindow);
SOUND_MENU_SPIN_VOL = gui_addSpinBox(20,20,180,40, "Sound level", soundMenuWindow);
SOUND_MENU_CHECK_MUTE = gui_addCheckBox(20,50,180,60,"Sound", soundMenuWindow);
OBJECT_MENU_CLOSE = gui_addButton(20,200,180,220, "Close", objectMenuWindow);
OBJECT_MENU_SAVE = gui_addButton(20,45,180,65, "Save Changes", objectMenuWindow);
OBJECT_MENU_LOAD = gui_addButton(20,70,180,95, "Load Changes", objectMenuWindow);
OBJECT_MENU_SPIN_MAX = gui_addSpinBox(125,20,180,40, "max", objectMenuWindow);
OBJECT_MENU_TEXT_1 =gui_addStaticText(20,20,115,40,"Max Object Number",objectMenuWindow);
gui_hideElement(consoleWindow);
gui_hideElement(mainMenuWindow);
gui_hideElement(gravityMenuWindow);
gui_hideElement(localMenuWindow);
gui_hideElement(weatherMenuWindow);
gui_hideElement(lightingMenuWindow);
gui_hideElement(soundMenuWindow);
gui_hideElement(objectMenuWindow);
modelList = getModelList();
countInList = 0;
for i,line in ipairs(modelList) do
gui_addItemToList(ITEM_LISTBOX, line);
keyList[countInList] = i-1;
countInList = countInList +1;
print(i, line);
end
if countInList > 0 then
currentInList = 0;
gui_setListActive(ITEM_LISTBOX, currentInList);
end;
function keyboardEvent ( id )
if id == 0x49 then
if menuOpened==1 then
gui_hideElement(mainMenuWindow);
gui_hideElement(gravityMenuWindow);
gui_hideElement(localMenuWindow);
gui_hideElement(weatherMenuWindow);
gui_hideElement(lightingMenuWindow);
gui_hideElement(soundMenuWindow);
gui_hideElement(objectMenuWindow);
menuOpened = 0;
gui_removeFocus(1);
receiverEnable(1);
print ("GUI CLOSED");
else
gui_showElement(mainMenuWindow);
gui_setFocus(mainMenuWindow);
menuOpened = 1;
receiverDisable();
print ("GUI OPENED");
end
elseif id == 174 then
vol = get_volume();
set_volume(vol-1);
elseif id == 81 then
currentInList = currentInList-1;
if currentInList<0 and countInList>0 then currentInList = 0; end;
gui_setListActive(ITEM_LISTBOX, currentInList);
elseif id == 87 then
currentInList = currentInList+1;
if currentInList>countInList-1 and countInList>0 then currentInList = 0; end;
gui_setListActive(ITEM_LISTBOX, currentInList);
elseif id == 175 then
vol = get_volume();
set_volume(vol-1);
elseif id == 9 then
if listOpened==1 then
gui_hideElement(ITEM_LISTBOX);
listOpened = 0;
else
gui_showElement(ITEM_LISTBOX);
listOpened = 1;
end
end
end
function mouseEvent ( id )
if id == 0 then
addObject(keyList[currentInList]);
end
end
function event ( id )
if id == MAIN_MENU_GRAVITI_SET then
gui_hideElement(mainMenuWindow);
gui_showElement(gravityMenuWindow);
gui_setFocus(gravityMenuWindow);
elseif id == MAIN_MENU_LOCATION_SET then
gui_hideElement(mainMenuWindow);
gui_showElement(localMenuWindow);
gui_setFocus(localMenuWindow);
elseif id == MAIN_MENU_WEATHER_SET then
gui_hideElement(mainMenuWindow);
gui_showElement(weatherMenuWindow);
gui_setFocus(weatherMenuWindow);
elseif id == MAIN_MENU_LIGHTING_SET then
gui_hideElement(mainMenuWindow);
gui_showElement(lightingMenuWindow);
gui_setFocus(lightingMenuWindow);
elseif id == MAIN_MENU_SOUND_SET then
gui_hideElement(mainMenuWindow);
gui_showElement(soundMenuWindow);
gui_setFocus(soundMenuWindow);
elseif id == MAIN_MENU_OBJECT_SET then
gui_hideElement(mainMenuWindow);
gui_showElement(objectMenuWindow);
gui_setFocus(objectMenuWindow);
elseif id == MAIN_MENU_CLOSE then
gui_hideElement(mainMenuWindow);
elseif id == GRAVITY_MENU_CLOSE or LOCATION_MENU_CLOSE or
WEATHER_MENU_CLOSE or LIGHTING_MENU_CLOSE or
SOUND_MENU_CLOSE or OBJECT_MENU_CLOSE
then
gui_hideElement(gravityMenuWindow);
gui_hideElement(localMenuWindow);
gui_hideElement(weatherMenuWindow);
gui_hideElement(lightingMenuWindow);
gui_hideElement(soundMenuWindow);
gui_hideElement(objectMenuWindow);
gui_showElement(mainMenuWindow);
gui_setFocus(mainMenuWindow);
else
print("other")
end
end
--gui_showElement(consoleWindow);
--gui_showElement(mainMenuWindow);