UITestView.lua 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. local UITestView = require("UILogin/UITestView_Generate")
  2. function UITestView:OnAwake(data)
  3. self.controller = require("UILogin/UILoginCtr"):new()
  4. self.controller:Init(self)
  5. end
  6. function UITestView:AddEventListener()
  7. -- local list = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}
  8. -- CommonUtil.LoopGridViewEleCreate(self, self.scrollView.loopHorizontalScrollRect, list, 2000, function (itemLua, idx)
  9. -- -- print(itemLua.gameObject.name)
  10. -- -- print(idx)
  11. -- end)
  12. end
  13. function UITestView:FillContent(data, uiBase)
  14. self.uiBase = uiBase
  15. local gameObject = self.uiBase:GetRoot()
  16. if gameObject ~= nil then
  17. self.gameObject = gameObject
  18. self.transform = gameObject.transform
  19. end
  20. self:InitGenerate(self.transform, data)
  21. -- Filter and Sort
  22. -- local a = {}
  23. -- for i = 1,10 do
  24. -- local b = {a = i, b = i/2, c = math.fmod( i, 2)}
  25. -- a[#a + 1] = b
  26. -- end
  27. -- Log(Inspect(a))
  28. -- local list = CommonUtil.ArrayFilterSelections(a, Enum.FilterType.AND, {"a", "b"}, {1, 0.5})
  29. -- a[3].a = 5
  30. -- a[4].a = 5
  31. -- CommonUtil.ArraySortSelections(a, Enum.TableSortRule.Down, "a", "b")
  32. -- Log(Inspect(a))
  33. --NetConnectTest()
  34. -- ManagerContainer.ResMgr:LuaLoadAssetSprite(Constants.UITexturePath, ELoadType.UI, function (obj, path, name)
  35. -- self.image.image.sprite = obj
  36. -- end, "1")
  37. end
  38. function UITestView:RemoveEventListener()
  39. -- ManagerContainer.LuaEventMgr:Dispatch("hallo")
  40. ManagerContainer.LuaEventMgr:Unregister(self.uiData.name)
  41. end
  42. function UITestView:AddUIEventListener()
  43. ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name)
  44. -- ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name, "hallo", function()
  45. -- print("hello")
  46. -- end)
  47. self.uiBase:AddButtonEventListener(self.start.button, function()
  48. --self.controller:OnStartClick()
  49. -- ManagerContainer.NetManager:NetRegister(ProtoMsgId.response, function (data)
  50. -- print(Inspect(data))
  51. -- end)
  52. -- ManagerContainer.NetManager:SendMessage(ProtoMsgId.request, {open_id = "haha"})
  53. -- ManagerContainer.FSMMgr:ChangeState(Enum.StateEnum.LoadingState.stateId, Enum.SceneType.Battle)
  54. end)
  55. -- self.start.repeatButton:AddRepeatClickEventListener(function ()
  56. -- Log("repeatButton eff")
  57. -- end)
  58. -- ManagerContainer.LuaTimerMgr:AddTimer(3000, 5, false, function(sequence, param)
  59. -- print("sequence "..sequence)
  60. -- end, nil)
  61. end
  62. function UITestView:OnHide()
  63. end
  64. function UITestView:OnShow()
  65. end
  66. function UITestView:OnClose()
  67. end
  68. function UITestView:OnDispose()
  69. --self.content.loopHorizontalScrollRect:DestroyCells();
  70. end
  71. return UITestView