--[[@------------------------------------------------------------------
|
|
@description:通用概率界面
|
|
@author:huangcong
|
|
----------------------------------------------------------------------]]
|
|
LuckyProbToolTips = LuckyProbToolTips or BaseClass(BaseView)
|
|
local LuckyProbToolTips = LuckyProbToolTips
|
|
function LuckyProbToolTips:__init()
|
|
self.base_file = "common"
|
|
self.layout_file = "LuckyProbToolTips"
|
|
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.hide_maincancas = false --全屏界面需要放开隐藏主UI
|
|
self.item_list = {}
|
|
self.model = CommonModel:getInstance()
|
|
self:AddPreLoadList("common",{"LuckyProbItem"})
|
|
self.is_set_zdepth = true
|
|
self.blur_activity_bg = true
|
|
self.item_list = {}
|
|
self.module_id = 416
|
|
self.sub_id = 1
|
|
|
|
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 LuckyProbToolTips:Open(module_id,sub_id,act_id)
|
|
self.module_id = module_id or self.module_id
|
|
self.sub_id = sub_id or self.sub_id
|
|
self.act_id = act_id or 0
|
|
BaseView.Open(self)
|
|
end
|
|
|
|
function LuckyProbToolTips:OpenSuccess( )
|
|
end
|
|
|
|
function LuckyProbToolTips:LoadSuccess()
|
|
local nodes = {
|
|
"text2:tmp", "text3:tmp", "text1:tmp", "itemScroll", "itemScroll/Viewport/itemCon",
|
|
"Window/windowTitleText:tmp", "Window/windowCloseBtn:obj", "Window:raw"
|
|
}
|
|
self:GetChildren(nodes)
|
|
lua_resM:setOutsideRawImage(self, self.Window_raw, GameResPath.GetViewBigBg("lucky_Prob_bg"), false)
|
|
|
|
self.text1_tmp.text = "编号"
|
|
self.text2_tmp.text = "物品名字"
|
|
self.text3_tmp.text = "概率"
|
|
self.windowTitleText_tmp.text = "概率详情"
|
|
CustomActivityModel:getInstance():Fire(CustomActivityModel.PROTO_CCMD_EVENT, 33109, self.module_id, self.sub_id, self.act_id)
|
|
end
|
|
|
|
function LuckyProbToolTips:AddEvent()
|
|
local on_click = function ( click_obj )
|
|
if self.windowCloseBtn_obj == click_obj then--取消
|
|
self:Close()
|
|
end
|
|
end
|
|
AddClickEvent(self.windowCloseBtn_obj, on_click)
|
|
|
|
local updateViewFunc = function (rates_list)
|
|
self.rates_list = rates_list
|
|
self:UpdateView()
|
|
end
|
|
self:BindEvent(CustomActivityModel:getInstance(), EventName.UPDATE_LUCKY_RADIO_VIEW, updateViewFunc)
|
|
end
|
|
|
|
function LuckyProbToolTips:UpdateView()
|
|
self:UpdateItemList()
|
|
end
|
|
|
|
function LuckyProbToolTips:UpdateItemList( )
|
|
local list = nil
|
|
if self.rates_list then
|
|
list = self.rates_list
|
|
else
|
|
return
|
|
end
|
|
if not list or #list == 0 then return end
|
|
local sort_func = function ( a, b )
|
|
return a.awardid < b.awardid
|
|
end
|
|
table.sort(list, sort_func)
|
|
if not list or TableSize(list) == 0 then return end
|
|
-- print("huangcong:KfCompetingListCon [97]list: ",list)
|
|
-- PrintTable(list)
|
|
if not self.item_list_com then
|
|
self.item_list_com = self:AddUIComponent(UI.ItemListCreator)
|
|
end
|
|
local info = {
|
|
data_list = list,
|
|
item_con = self.itemCon,
|
|
item_class = LuckyProbItem,
|
|
item_height = LuckyProbItem.Height,
|
|
space_x = 0,
|
|
space_y = -0.5,
|
|
scroll_view = self.itemScroll.transform,
|
|
create_frequency = 0.02,
|
|
on_update_item = function(item, i, v)
|
|
item:SetData(v, i, i)
|
|
end,
|
|
}
|
|
self.item_list_com:UpdateItems(info)
|
|
end
|
|
|
|
function LuckyProbToolTips:DestroySuccess( )
|
|
|
|
end
|