-- <*
|
|
-- @Author: Saber
|
|
-- @Description: 社团日志界面
|
|
-- *>
|
|
|
|
GuildLogView = GuildLogView or BaseClass(BaseView)
|
|
local GuildLogView = GuildLogView
|
|
|
|
function GuildLogView:__init()
|
|
self.base_file = "guild"
|
|
self.layout_file = "GuildLogView"
|
|
self.layer_name = "Activity"
|
|
self.destroy_imm = true
|
|
self.use_background = true
|
|
|
|
self.change_scene_close = true --是否切换场景时关闭(弹出界面使用)
|
|
self.blur_activity_bg = true
|
|
self.use_show_anim = true
|
|
self.use_hide_anim = true
|
|
|
|
self.model = GuildModel:getInstance()
|
|
|
|
self.load_callback = function ()
|
|
self:LoadSuccess()
|
|
self:AddEvent()
|
|
self.model:Fire(GuildModel.REQUEST_CCMD_EVENT,40405)
|
|
end
|
|
self.open_callback = function ( )
|
|
self:OpenSuccess()
|
|
end
|
|
self.destroy_callback = function ( )
|
|
self:DestroySuccess()
|
|
end
|
|
end
|
|
|
|
function GuildLogView:Open( )
|
|
--self.data = data
|
|
BaseView.Open(self)
|
|
end
|
|
|
|
function GuildLogView:LoadSuccess()
|
|
local nodes = {
|
|
"content",
|
|
"content/log_scroll", "content/log_scroll/Viewport/log_con",
|
|
"content/empty_bg:obj:raw",
|
|
}
|
|
self:GetChildren(nodes)
|
|
lua_resM:setOutsideRawImage(self, self.empty_bg_raw, GameResPath.GetRoleBg("guild_empty_girl_697_560"), false)
|
|
local function close_callback()
|
|
self:Close()
|
|
end
|
|
self.tabWindowComponent = UITabWindow.New(self.transform, {}, nil, close_callback, self.background_wnd, self.content, UITabWindow.SizeSmallNoTab, nil, nil, false)
|
|
self.tabWindowComponent:SetTitleText("社团日志")
|
|
self.tabWindowComponent:SetBackgroundRes("WindowNew2_bg")
|
|
end
|
|
|
|
function GuildLogView:AddEvent()
|
|
local function update_log()
|
|
self:UpdateView()
|
|
end
|
|
self:BindEvent(self.model, GuildModel.UPDATE_GUILD_LOG, update_log)
|
|
end
|
|
|
|
function GuildLogView:OpenSuccess()
|
|
self:UpdateView()
|
|
end
|
|
|
|
function GuildLogView:UpdateView()
|
|
local log_data = self.model:GetGuildLogInfo()
|
|
self.empty_bg_obj:SetActive(#log_data <= 0)
|
|
self.log_item_creator = self.log_item_creator or self:AddUIComponent(UI.ItemListCreator)
|
|
local info = {
|
|
data_list = log_data,
|
|
item_con = self.log_con,
|
|
scroll_view = self.log_scroll,
|
|
prefab_ab_name = "guild",
|
|
prefab_res_name = "GuildLogItem",
|
|
item_height = 48,
|
|
create_frequency = 0.01,
|
|
child_names = {"log:tmp","time:tmp",},
|
|
alignment = UnityEngine.TextAnchor.UpperLeft,
|
|
on_update_item = function(item, i, v)
|
|
local str = GuildModel.LogStr[v.type]
|
|
if v.type ~= GuildModel.LogType.Upgrade then
|
|
str = string.gsub(str, "@name", v.name)
|
|
end
|
|
if v.type == GuildModel.LogType.Active then
|
|
str = string.gsub(str, "@active", v.value)
|
|
end
|
|
if v.type == GuildModel.LogType.Position then
|
|
str = string.gsub(str, "@pos", Trim(Config.Guildpos[v.value].name))
|
|
end
|
|
if v.type == GuildModel.LogType.Upgrade then
|
|
str = string.gsub(str, "@upgrade", v.value)
|
|
end
|
|
item.log_tmp.text = str
|
|
item.time_tmp.text = TimeUtil:timeConversion(v.time, "yy/mm/dd")
|
|
end,
|
|
}
|
|
self.log_item_creator:UpdateItems(info)
|
|
end
|
|
|
|
function GuildLogView:DestroySuccess( )
|
|
if self.tabWindowComponent then
|
|
self.tabWindowComponent:DeleteMe()
|
|
self.tabWindowComponent = nil
|
|
end
|
|
end
|