|
1 | 1 | -- @Author: Webster |
2 | 2 | -- @Date: 2015-09-16 18:12:29 |
3 | 3 | -- @Last Modified by: Webster |
4 | | --- @Last Modified time: 2015-09-16 19:14:07 |
| 4 | +-- @Last Modified time: 2016-01-07 13:14:17 |
5 | 5 |
|
6 | | --- 只有存在文件的情况下才会开启 |
7 | | -local isEnable = IsFileExist(JH.GetAddonInfo().szDataPath .. "EnableButton") |
8 | | -if isEnable then |
9 | | - local Container = Station.Lookup("Normal/TopMenu/WndContainer_List") |
10 | | - if Container then |
11 | | - if not Container:Lookup("JH_Window") then |
12 | | - local wnd = Container:AppendContentFromIni(JH.GetAddonInfo().szRootPath .. "0Base/ui/JH_Button.ini", "JH_Window") |
13 | | - if wnd then |
14 | | - Container:FormatAllContentPos() |
| 6 | +JH.RegisterEvent("FIRST_LOADING_END", function() |
| 7 | + local isEnable = IsFileExist(JH.GetAddonInfo().szDataPath .. "EnableButton") |
| 8 | + if isEnable or JH.bDebugClient then |
| 9 | + local Container = Station.Lookup("Normal/TopMenu/WndContainer_List") |
| 10 | + if Container then |
| 11 | + if not Container:Lookup("JH_Window") then |
| 12 | + local wnd = Container:AppendContentFromIni(JH.GetAddonInfo().szRootPath .. "0Base/ui/JH_Button.ini", "JH_Window") |
| 13 | + if wnd then |
| 14 | + Container:FormatAllContentPos() |
| 15 | + end |
15 | 16 | end |
16 | | - end |
17 | | - local wnd = Container:Lookup("JH_Window") |
18 | | - if wnd then |
19 | | - local btn = wnd:Lookup("Btn_JH") |
20 | | - RegisterEvent("RELOAD_UI_ADDON_BEGIN", function() |
21 | | - -- free(ui) |
22 | | - btn.OnLButtonClick = nil |
23 | | - btn.OnRButtonClick = nil |
24 | | - end) |
25 | | - btn.OnLButtonClick = JH.TogglePanel |
26 | | - btn.OnRButtonClick = function() |
27 | | - PopupMenu(JH.GetPlayerAddonMenu()[1]) |
| 17 | + local wnd = Container:Lookup("JH_Window") |
| 18 | + if wnd then |
| 19 | + local btn = wnd:Lookup("Btn_JH") |
| 20 | + RegisterEvent("RELOAD_UI_ADDON_BEGIN", function() |
| 21 | + -- free(ui) |
| 22 | + btn.OnLButtonClick = nil |
| 23 | + btn.OnRButtonClick = nil |
| 24 | + end) |
| 25 | + btn.OnLButtonClick = JH.TogglePanel |
| 26 | + btn.OnRButtonClick = function() |
| 27 | + PopupMenu(JH.GetPlayerAddonMenu()[1]) |
| 28 | + end |
28 | 29 | end |
29 | 30 | end |
30 | 31 | end |
31 | | -end |
32 | | - |
| 32 | +end) |
0 commit comments