源战役客户端
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

107 linhas
3.4 KiB

  1. -- <*
  2. -- @Author: Saber
  3. -- @Description: 社团日志界面
  4. -- *>
  5. GuildLogView = GuildLogView or BaseClass(BaseView)
  6. local GuildLogView = GuildLogView
  7. function GuildLogView:__init()
  8. self.base_file = "guild"
  9. self.layout_file = "GuildLogView"
  10. self.layer_name = "Activity"
  11. self.destroy_imm = true
  12. self.use_background = true
  13. self.change_scene_close = true --是否切换场景时关闭(弹出界面使用)
  14. self.blur_activity_bg = true
  15. self.use_show_anim = true
  16. self.use_hide_anim = true
  17. self.model = GuildModel:getInstance()
  18. self.load_callback = function ()
  19. self:LoadSuccess()
  20. self:AddEvent()
  21. self.model:Fire(GuildModel.REQUEST_CCMD_EVENT,40405)
  22. end
  23. self.open_callback = function ( )
  24. self:OpenSuccess()
  25. end
  26. self.destroy_callback = function ( )
  27. self:DestroySuccess()
  28. end
  29. end
  30. function GuildLogView:Open( )
  31. --self.data = data
  32. BaseView.Open(self)
  33. end
  34. function GuildLogView:LoadSuccess()
  35. local nodes = {
  36. "content",
  37. "content/log_scroll", "content/log_scroll/Viewport/log_con",
  38. "content/empty_bg:obj:raw",
  39. }
  40. self:GetChildren(nodes)
  41. lua_resM:setOutsideRawImage(self, self.empty_bg_raw, GameResPath.GetRoleBg("guild_empty_girl_697_560"), false)
  42. local function close_callback()
  43. self:Close()
  44. end
  45. self.tabWindowComponent = UITabWindow.New(self.transform, {}, nil, close_callback, self.background_wnd, self.content, UITabWindow.SizeSmallNoTab, nil, nil, false)
  46. self.tabWindowComponent:SetTitleText("社团日志")
  47. self.tabWindowComponent:SetBackgroundRes("WindowNew2_bg")
  48. end
  49. function GuildLogView:AddEvent()
  50. local function update_log()
  51. self:UpdateView()
  52. end
  53. self:BindEvent(self.model, GuildModel.UPDATE_GUILD_LOG, update_log)
  54. end
  55. function GuildLogView:OpenSuccess()
  56. self:UpdateView()
  57. end
  58. function GuildLogView:UpdateView()
  59. local log_data = self.model:GetGuildLogInfo()
  60. self.empty_bg_obj:SetActive(#log_data <= 0)
  61. self.log_item_creator = self.log_item_creator or self:AddUIComponent(UI.ItemListCreator)
  62. local info = {
  63. data_list = log_data,
  64. item_con = self.log_con,
  65. scroll_view = self.log_scroll,
  66. prefab_ab_name = "guild",
  67. prefab_res_name = "GuildLogItem",
  68. item_height = 48,
  69. create_frequency = 0.01,
  70. child_names = {"log:tmp","time:tmp",},
  71. alignment = UnityEngine.TextAnchor.UpperLeft,
  72. on_update_item = function(item, i, v)
  73. local str = GuildModel.LogStr[v.type]
  74. if v.type ~= GuildModel.LogType.Upgrade then
  75. str = string.gsub(str, "@name", v.name)
  76. end
  77. if v.type == GuildModel.LogType.Active then
  78. str = string.gsub(str, "@active", v.value)
  79. end
  80. if v.type == GuildModel.LogType.Position then
  81. str = string.gsub(str, "@pos", Trim(Config.Guildpos[v.value].name))
  82. end
  83. if v.type == GuildModel.LogType.Upgrade then
  84. str = string.gsub(str, "@upgrade", v.value)
  85. end
  86. item.log_tmp.text = str
  87. item.time_tmp.text = TimeUtil:timeConversion(v.time, "yy/mm/dd")
  88. end,
  89. }
  90. self.log_item_creator:UpdateItems(info)
  91. end
  92. function GuildLogView:DestroySuccess( )
  93. if self.tabWindowComponent then
  94. self.tabWindowComponent:DeleteMe()
  95. self.tabWindowComponent = nil
  96. end
  97. end