SLMain.lua 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. SLBridge = {}
  2. SLBridge.LUAEvent = {}
  3. function SLBridge:onLUAEvent(eventID, eventData)
  4. if not SLBridge.LUAEvent[eventID] then
  5. return
  6. end
  7. for eventTag, eventCB in pairs(SLBridge.LUAEvent[eventID]) do
  8. eventCB(eventData, eventTag)
  9. end
  10. end
  11. function SLBridge:onEnterWorld()
  12. SL.NetworkUtil = require("GUI/GUINetworkUtil").new()
  13. local rootB = global.sceneGraphCtl:GetSceneNode(global.MMO.NODE_SKILL_BEHIND)
  14. local rootF = global.sceneGraphCtl:GetSceneNode(global.MMO.NODE_SKILL)
  15. GUI._sceneRootNodeB = cc.Node:create()
  16. rootB:addChild(GUI._sceneRootNodeB)
  17. GUI._sceneRootNodeB:retain()
  18. GUI._sceneRootNodeF = cc.Node:create()
  19. rootF:addChild(GUI._sceneRootNodeF)
  20. GUI._sceneRootNodeF:retain()
  21. require("GUI/GUINetwork")
  22. require("GUILayout/GUIUtil")
  23. end
  24. function SLBridge:onLeaveWorld()
  25. SLBridge:onLUAEvent(LUA_EVENT_LEAVE_WORLD)
  26. package.loaded["GUILayout/GUIUtil"] = nil
  27. package.loaded["GUI/GUINetwork"] = nil
  28. GUI.WinLayers = {} -- GUI 界面管理
  29. GUI.Mediators = {} -- GUI 界面管理
  30. SLBridge.LUAEvent = {}
  31. SLHandlerEvent.Events = {}
  32. SLHandlerEvent.EventDesc = {}
  33. SLHandlerEvent.PropertyEvents = {}
  34. SL.FormParam = {}
  35. SL.LocalStringCache = {}
  36. SL.LocalStringTimerID = nil
  37. SL.DigitChangeTimerID = nil
  38. -- note: 无需removeFromParent,父节点已经被清理了
  39. GUI._sceneRootNodeB:autorelease()
  40. GUI._sceneRootNodeB = nil
  41. GUI._sceneRootNodeF:autorelease()
  42. GUI._sceneRootNodeF = nil
  43. GUI._actorRootNode = nil
  44. local files = SLDefine.LUAFile
  45. for k, v in pairs(files) do
  46. package.loaded[v] = nil
  47. end
  48. end
  49. function SLBridge:CheckLuaEventCleaned()
  50. if not SLBridge.LUAEvent or not next(SLBridge.LUAEvent) then
  51. return true
  52. end
  53. return false
  54. end