comparison CyborgMMO7.lua @ 48:40892c6b6075

Fixed settings initialization, and added the minimap buttton position to the saved data.
author madcatzinc@35b17cf1-18cd-47ff-9ca3-31d6b526ef09
date Fri, 03 May 2013 19:39:43 +0000
parents 3a3dc5e4405a
children fb81254bd7b8
comparison
equal deleted inserted replaced
47:1a29be548897 48:40892c6b6075
42 local r = 80 42 local r = 80
43 local dx = r * math.cos(angle) 43 local dx = r * math.cos(angle)
44 local dy = r * math.sin(angle) 44 local dy = r * math.sin(angle)
45 CyborgMMO_MiniMapButton:ClearAllPoints() 45 CyborgMMO_MiniMapButton:ClearAllPoints()
46 CyborgMMO_MiniMapButton:SetPoint("CENTER", "Minimap", "CENTER", dx, dy) 46 CyborgMMO_MiniMapButton:SetPoint("CENTER", "Minimap", "CENTER", dx, dy)
47 if SettingsLoaded then
48 Settings.MiniMapButtonAngle = angle
49 end
47 end 50 end
48 51
49 52
50 function CyborgMMO_MiniMapButtonOnUpdate() 53 function CyborgMMO_MiniMapButtonOnUpdate()
51 local xpos,ypos = GetCursorPosition() 54 local xpos,ypos = GetCursorPosition()
327 CyborgMMO_SetupModeCallbacks(3) 330 CyborgMMO_SetupModeCallbacks(3)
328 331
329 Settings = data.Settings 332 Settings = data.Settings
330 if not Settings then 333 if not Settings then
331 Settings = {} 334 Settings = {}
332 Settings.Cyborg = 0.75
333 Settings.Plugin = 0.75
334 Settings.MiniMapButton = true 335 Settings.MiniMapButton = true
335 Settings.CyborgButton = true 336 Settings.CyborgButton = true
336 data.Settings = Settings 337 data.Settings = Settings
337 end 338 end
338 SettingsLoaded = true 339 if not Settings.Cyborg then
340 Settings.Cyborg = 0.75
341 end
342 if not Settings.Plugin then
343 Settings.Plugin = 0.75
344 end
345 if not Settings.MiniMapButtonAngle then
346 Settings.MiniMapButtonAngle = math.rad(150)
347 end
339 348
340 -- Reload Slider values: 349 -- Reload Slider values:
341 CyborgMMO_SetOpenButtonSize(Settings.Cyborg) 350 CyborgMMO_SetOpenButtonSize(Settings.Cyborg)
342 CyborgMMO_SetMainPageSize(Settings.Plugin) 351 CyborgMMO_SetMainPageSize(Settings.Plugin)
343 352
344 CyborgMMO_SetMiniMapButton(Settings.MiniMapButton) 353 CyborgMMO_SetMiniMapButton(Settings.MiniMapButton)
354 CyborgMMO_MiniMapButtonReposition(Settings.MiniMapButtonAngle)
345 CyborgMMO_SetCyborgHeadButton(Settings.CyborgButton) 355 CyborgMMO_SetCyborgHeadButton(Settings.CyborgButton)
346 356
347 local xmin,ymin = Minimap:GetLeft(),Minimap:GetBottom() 357 SettingsLoaded = true
348 local angle = math.rad(150)
349 CyborgMMO_MiniMapButtonReposition(angle)
350 end 358 end
351 end 359 end
352 360
353 function CyborgMMO_SetDefaultSettings() 361 function CyborgMMO_SetDefaultSettings()
354 CyborgMMO_OpenButtonPageOpenMainForm:ClearAllPoints() 362 CyborgMMO_OpenButtonPageOpenMainForm:ClearAllPoints()
427 end 435 end
428 436
429 function CyborgMMO_SetMainPageSize(percent) 437 function CyborgMMO_SetMainPageSize(percent)
430 CyborgMMO_MainPage:SetScale(percent) 438 CyborgMMO_MainPage:SetScale(percent)
431 CyborgMMO_OptionPagePluginSizeSlider:SetValue(percent) 439 CyborgMMO_OptionPagePluginSizeSlider:SetValue(percent)
432 if BindingsLoaded then 440 if SettingsLoaded then
433 Settings.Plugin = percent 441 Settings.Plugin = percent
434 end 442 end
435 end 443 end
436 444
437 function CyborgMMO_SetOpenButtonSize(percent) 445 function CyborgMMO_SetOpenButtonSize(percent)