源战役客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 line
2.6 KiB

  1. WelecomeView = WelecomeView or BaseClass(BaseView)
  2. function WelecomeView:__init()
  3. self.base_file = "welecome"
  4. self.layout_file = "WelecomeView"
  5. self.layer_name = "Activity"
  6. self.close_mode = CloseMode.CloseDestroy
  7. self.destroy_imm = true
  8. self.hide_maincancas = false
  9. self.use_background = true
  10. self.background_alpha = 0
  11. self.is_set_zdepth = true
  12. self.gril_anima = "sheep"
  13. self.model = AutoFightManager:getInstance()
  14. -- self:AddPreLoadList("ui_anniu_chongdianxiaoqian",{"ui_anniu_chongdianxiaoqian"})
  15. self:AddPreLoadList("ui_huadongyindao02",{"ui_huadongyindao02"})
  16. self:AddPreLoadList(self.gril_anima,{self.gril_anima})
  17. self.load_callback = function ()
  18. self:LoadSuccess()
  19. self:InitEvent()
  20. end
  21. self.open_callback = function ()
  22. EventSystem.Fire(GlobalEventSystem,EventName.STOPAUTOFIGHT, false, true)
  23. local main_role = Scene.Instance.main_role
  24. if main_role and not main_role:IsInState(PoseState.STAND) then
  25. main_role:DoStand()
  26. GlobalEventSystem:Fire(EventName.FORCE_STOP_DO_TASK)
  27. end
  28. local load_finish_fun = function()
  29. self:AddUIEffect("ui_huadongyindao02", self.effect2, self.layer_name, {x=25, y=-36}, {x = 1, y = 1}, true, nil, nil, nil)
  30. end
  31. self:AddUIEffect("ui_kaishimaoxian", self.effect, self.layer_name, nil, {x = 1, y = 1}, true, nil, nil, nil, load_finish_fun)
  32. end
  33. self.destroy_callback = function ()
  34. self:Clear()
  35. end
  36. --self.use_local_view = true
  37. end
  38. function WelecomeView:Clear()
  39. if self.effect then
  40. self:ClearUIEffect(self.effect)
  41. end
  42. if self.anima then
  43. destroy(self.anima)
  44. self.anima = nil
  45. end
  46. end
  47. function WelecomeView:LoadSuccess()
  48. self.startBtn = self:GetChild("startBtn").gameObject
  49. self.click_bg = self:GetChild("click_bg").gameObject
  50. self.click_bg_tran = self:GetChild("click_bg")
  51. self.click_bg_tran.sizeDelta = Vector2(ScreenWidth+10,ScreenHeight+10)
  52. self.effect = self:GetChild("effect")
  53. self.effect2 = self:GetChild("effect2")
  54. if tonumber(AppConst.EnglineVer) >= 78 then
  55. local load_back = function(objs)
  56. if objs and objs[0] then
  57. self.anima = newObject(objs[0])
  58. self.anima.transform:SetParent(self.transform)
  59. SetLocalScale(self.anima.transform, 0.32)
  60. self.anima.transform.localEulerAngles = Vector3(0, 0, 0)
  61. SetLocalPosition(self.anima.transform, -236, -336, 0)
  62. end
  63. end
  64. lua_resM:loadPrefab(self,self.gril_anima,self.gril_anima, load_back, ASSETS_LEVEL.HIGHT)
  65. end
  66. end
  67. function WelecomeView:InitEvent()
  68. local function clickHandler(target)
  69. GlobalEventSystem:Fire(EventName.FORCE_TO_DO_TASK)
  70. self:Close()
  71. end
  72. AddClickEvent(self.startBtn, clickHandler,LuaSoundManager.SOUND_UI.SWITCH)
  73. AddClickEvent(self.click_bg, clickHandler,LuaSoundManager.SOUND_UI.SWITCH)
  74. end