--[[@------------------------------------------------------------------
|
|
@description:源能转盘兑换界面
|
|
@author:huangcong
|
|
----------------------------------------------------------------------]]
|
|
PowerTurnTableExchangeView = PowerTurnTableExchangeView or BaseClass(BaseView)
|
|
local PowerTurnTableExchangeView = PowerTurnTableExchangeView
|
|
|
|
function PowerTurnTableExchangeView:__init()
|
|
self.base_file = "powerTurnTable"
|
|
self.layout_file = "PowerTurnTableExchangeView"
|
|
self.layer_name = "Activity"
|
|
self.destroy_imm = true
|
|
self.use_background = true
|
|
self.change_scene_close = true
|
|
self.append_to_ctl_queue = false --是否要添加进界面堆栈
|
|
self.need_show_money = false --是否要显示顶部的金钱栏
|
|
self.model = PowerTurnTableModel:getInstance()
|
|
self.is_set_zdepth = true
|
|
self.blur_activity_bg = true
|
|
self.base_type = CustomActivityModel.CustomActBaseType.POWER_TURNTABLE
|
|
self.sub_type = CustomActivityModel:getInstance():getActMinSubType(self.base_type)
|
|
|
|
self.load_callback = function ()
|
|
self:LoadSuccess()
|
|
self:AddEvent()
|
|
end
|
|
self.open_callback = function ( )
|
|
self:OpenSuccess()
|
|
end
|
|
self.destroy_callback = function ( )
|
|
self:DestroySuccess()
|
|
end
|
|
end
|
|
|
|
function PowerTurnTableExchangeView:DestroySuccess()
|
|
|
|
end
|
|
|
|
function PowerTurnTableExchangeView:LoadSuccess()
|
|
local nodes = {
|
|
"itemScroll/Viewport/itemCon", "bg:raw", "myScore:tmp", "itemScroll", "closeBtn:obj",
|
|
}
|
|
self:GetChildren(nodes)
|
|
lua_resM:setOutsideRawImage(self, self.bg_raw, GameResPath.GetViewBigBg("powerTurnTable_exchange_bg"),false)
|
|
|
|
if self.need_load_again then
|
|
self:UpdateView()
|
|
end
|
|
end
|
|
|
|
function PowerTurnTableExchangeView:AddEvent()
|
|
local function onBtnClickHandler(target,x,y)
|
|
if target == self.closeBtn_obj then
|
|
self:Close()
|
|
end
|
|
end
|
|
AddClickEvent(self.closeBtn_obj,onBtnClickHandler,1)
|
|
|
|
local update_view_func = function (subtype)
|
|
if self.sub_type == subtype and not self._use_delete_method then
|
|
self:UpdateExchangeList()
|
|
end
|
|
end
|
|
self:BindEvent(self.model, PowerTurnTableModel.UPDATE_EXCHANGE_VIEW, update_view_func)----更新红点顺便更新界面
|
|
end
|
|
|
|
function PowerTurnTableExchangeView:Open( sub_type )
|
|
self.sub_type = sub_type or self.sub_type
|
|
BaseView.Open(self)
|
|
end
|
|
|
|
function PowerTurnTableExchangeView:OpenSuccess( )
|
|
self:UpdateView()
|
|
end
|
|
|
|
function PowerTurnTableExchangeView:UpdateView( )
|
|
if not self.is_loaded then
|
|
self.need_load_again = true
|
|
return
|
|
end
|
|
self.model:Fire(PowerTurnTableModel.REQUEST_INFO,33502,self.sub_type)
|
|
end
|
|
|
|
--更新筛选列表
|
|
function PowerTurnTableExchangeView:UpdateExchangeList( )
|
|
local server_info = self.model:GetPowerTurnTableInfo(self.sub_type)
|
|
self.myScore_tmp.text = string.format("我的积分:%s",HtmlColorTxt(server_info and server_info.score or 0, ColorUtil.GREEN_DARK))
|
|
local item_list = self.model:GetExchangeInfoList(self.sub_type)
|
|
if not item_list then return end
|
|
-- print("huangcong:HopeGiftAwardShowView [88]: ",item_list)
|
|
-- PrintTable(item_list)
|
|
if not item_list or TableSize(item_list) == 0 then
|
|
return
|
|
end
|
|
|
|
local function final_callback( ... )
|
|
|
|
end
|
|
|
|
if not self.item_list_com then
|
|
self.item_list_com = self:AddUIComponent(UI.ItemListCreator)
|
|
else
|
|
self.item_list_com:Reset()
|
|
end
|
|
|
|
local info = {
|
|
data_list = item_list,
|
|
item_con = self.itemCon,
|
|
item_class = PowerTurnTableExchangeItem,
|
|
item_height = PowerTurnTableExchangeItem.Height,
|
|
item_width = PowerTurnTableExchangeItem.Width,
|
|
show_col = 2,
|
|
start_x = 1,
|
|
start_y = -1,
|
|
space_x = 1,
|
|
space_y = 5,
|
|
scroll_view = self.itemScroll.transform,
|
|
create_frequency = 0,
|
|
final_callback = final_callback,
|
|
on_update_item = function(item, i, v)
|
|
item:SetData(v,i,self.sub_type)
|
|
end,
|
|
}
|
|
self.item_list_com:UpdateItems(info)
|
|
end
|
|
|