--<*
|
|
-- @Author: Saber
|
|
-- @Description: 社团商城界面
|
|
--*>
|
|
|
|
GuildShopView = GuildShopView or BaseClass(BaseItem)
|
|
local GuildShopView = GuildShopView
|
|
|
|
function GuildShopView:__init(parent_wnd,prefab_asset,layer_name)
|
|
self.base_file = "guild"
|
|
self.layout_file = "GuildShopView"
|
|
self.parent_wnd = parent_wnd
|
|
self.layer_name = layer_name
|
|
|
|
self.model = GuildModel:getInstance()
|
|
-- 请求商品信息
|
|
self.model:Fire(GuildModel.REQUEST_CCMD_EVENT,40027)
|
|
self:Load()
|
|
end
|
|
|
|
function GuildShopView:Load_callback()
|
|
self.nodes = {
|
|
"left/girl_bg:raw",
|
|
"right/shop_scroll", "right/shop_scroll/Viewport/shop_con",
|
|
}
|
|
self:GetChildren(self.nodes)
|
|
|
|
lua_resM:setOutsideRawImage(self, self.girl_bg_raw, GameResPath.GetRoleBg("guild_shop_428_729"), false)
|
|
self:AddEvents()
|
|
self:UpdateView()
|
|
end
|
|
|
|
function GuildShopView:AddEvents( )
|
|
local function update_shop_list()
|
|
self:UpdateView()
|
|
end
|
|
self:BindEvent(self.model, GuildModel.UPDATE_GOODS_LIST, update_shop_list)
|
|
end
|
|
|
|
function GuildShopView:UpdateView( )
|
|
local goods_list = self.model:GetGuildShopGoodsList()
|
|
self.shop_item_creator = self.shop_item_creator or self:AddUIComponent(UI.ItemListCreator)
|
|
local info = {
|
|
data_list = goods_list,
|
|
item_con = self.shop_con,
|
|
scroll_view = self.shop_scroll,
|
|
item_class = GuildShopItem,
|
|
item_width = 180,
|
|
item_height = 214,
|
|
space_x = 18,
|
|
space_y = 11.5,
|
|
start_y = -23.5,
|
|
create_frequency = 0.01,
|
|
reuse_item_num = 12,
|
|
on_update_item = function(item, i, v)
|
|
item:SetData(v)
|
|
end,
|
|
}
|
|
self.shop_item_creator:UpdateItems(info)
|
|
end
|
|
|
|
function GuildShopView:__delete( )
|
|
|
|
end
|