127 lines
3.9 KiB
Plaintext
127 lines
3.9 KiB
Plaintext
|
-- 成长基金
|
|||
|
|
|||
|
require("LuaUtil")
|
|||
|
require("MarketingActBase")
|
|||
|
|
|||
|
InvestmentActRoot = MarketingActBase:new()
|
|||
|
|
|||
|
local curPageID = -1 --页码
|
|||
|
local pageName = "InvestmentActRoot" -- 界面名
|
|||
|
local openWithActID = -1 --打开的运营活动
|
|||
|
local menuList = nil -- 菜单列表
|
|||
|
local targetMenu = {} -- 目标菜单
|
|||
|
local _CloseButton
|
|||
|
local _Menu
|
|||
|
local _Content
|
|||
|
|
|||
|
|
|||
|
|
|||
|
function InvestmentActRoot.Awake()
|
|||
|
_CloseButton = _CloseBtn:GetComponent("Button") -- 关闭按钮
|
|||
|
_Menu = menuContainer:GetComponent("UIContainerSelect") -- 菜单容器
|
|||
|
_Content = _menuCount:GetComponent("Transform")
|
|||
|
|
|||
|
|
|||
|
_CloseButton.onClick:RemoveAllListeners() -- 清空所用绑定事件
|
|||
|
-- 绑定事件 (关闭界面)
|
|||
|
_CloseButton.onClick:AddListener(function() LuaUIMan:CloseUI(pageName) end)
|
|||
|
end
|
|||
|
|
|||
|
function InvestmentActRoot.OnEnableShowMenu(packet)
|
|||
|
_actState = packet.actState
|
|||
|
-- ELog('当前活动的actID == '..packet.actID)
|
|||
|
-- ELog('领取的奖励的tagID == '..packet.tagID.. ' (从0开始)')
|
|||
|
-- ELog('actState == '..packet.actState.. " (如果还有可以领取的返回值应该大于0)")
|
|||
|
|
|||
|
end
|
|||
|
|
|||
|
function InvestmentActRoot.OnEnable()
|
|||
|
--请求页面菜单
|
|||
|
InvestmentActRoot.AskForMenuID()
|
|||
|
menuList = nil
|
|||
|
|
|||
|
end
|
|||
|
--请求页面菜单
|
|||
|
function InvestmentActRoot.AskForMenuID()
|
|||
|
require("LuaDistributesMarketingActsReq")
|
|||
|
local reqInfo = { actType = InvestmentActRoot.ActID}
|
|||
|
LuaDistributesMarketingActsReq.SendPacket(reqInfo)
|
|||
|
end
|
|||
|
|
|||
|
function InvestmentActRoot.OnDisable()
|
|||
|
-- 关闭界面时清理一下
|
|||
|
menuList = nil
|
|||
|
if CS.MarketingActsRoot.Instance() ~= nil then
|
|||
|
CS.MarketingActsRoot.Instance():ClearShowingWin(InvestmentActRoot.curPageID)
|
|||
|
CS.MarketingActsRoot.Instance():ClearShowingWin(InvestmentActRoot.ActID)
|
|||
|
end
|
|||
|
end
|
|||
|
function InvestmentActRoot.AskForInfo()
|
|||
|
Log("Ask For info")
|
|||
|
end
|
|||
|
-- 接受菜单信息
|
|||
|
function InvestmentActRoot.MarketingActRetDel(packet)
|
|||
|
if packet == nil then
|
|||
|
ELog("没有收到服务器返回的信息")
|
|||
|
end
|
|||
|
menuList = nil
|
|||
|
menuList = packet.actIDState
|
|||
|
|
|||
|
|
|||
|
if Util.GetLen(packet.actIDState) > 0 then
|
|||
|
selectMenus = {}
|
|||
|
selectMenus[1] = packet.actIDState[1] --默认选中第一个
|
|||
|
end
|
|||
|
|
|||
|
if #selectMenus == 0 then
|
|||
|
ELog("没有选择菜单")
|
|||
|
elseif #selectMenus > 0 then
|
|||
|
_Menu:InitSelectContentL2L(packet.actIDState, selectMenus,InvestmentActRoot.OnMenuItem)
|
|||
|
end
|
|||
|
|
|||
|
-- local _isSetActive = packet.actIDState[2].ispurchase
|
|||
|
-- _Content:GetChild(1).transform:Find("MarkIcon_2").gameObject:SetActive(_isSetActive == 1)
|
|||
|
|
|||
|
end
|
|||
|
|
|||
|
|
|||
|
|
|||
|
-- 菜单
|
|||
|
function InvestmentActRoot.OnMenuItem(menuItem)
|
|||
|
--ELog("MenuItemId : "..menuItem.actID) -- 菜单对应的活动ID
|
|||
|
if menuItem ~= nil then
|
|||
|
local tab = TabMan.GetActInfoClientByID(menuItem.actID, 0) -- 根据ID获取活动客户端
|
|||
|
if tab ~= nil then
|
|||
|
--ELog("显示的分页名称 : "..tab.UIPath)
|
|||
|
-- 显示IDd对应的UI
|
|||
|
CS.LuaUIManager.Instance:ShowLuaUIAsChild(tab.UIPath, pageContainer,
|
|||
|
InvestmentActRoot.LoadUICallBack, menuItem, true)
|
|||
|
end
|
|||
|
end
|
|||
|
end
|
|||
|
|
|||
|
-- 加载UI回调
|
|||
|
function InvestmentActRoot.LoadUICallBack(isSucess, param, uiObj)
|
|||
|
local info = param
|
|||
|
|
|||
|
if info == nil then
|
|||
|
ELog("info == nil")
|
|||
|
ELog("投资回调参数错误:" .. curPageID)
|
|||
|
return
|
|||
|
end
|
|||
|
|
|||
|
if CS.MarketingActsRoot.Instance()._ShowingWin:ContainsKey(curPageID) then
|
|||
|
if CS.MarketingActsRoot.Instance()._ShowingWin[curPageID] ~= nil then
|
|||
|
CS.MarketingActsRoot.Instance()._ShowingWin[curPageID]:SetActive(false)
|
|||
|
else
|
|||
|
ELog("试着在投资里参加一些活动。但为空,请检查 _ActId= " .. curPageID)
|
|||
|
end
|
|||
|
|
|||
|
CS.MarketingActsRoot.Instance()._ShowingWin:Remove(curPageID)
|
|||
|
end
|
|||
|
|
|||
|
curPageID = info.actID
|
|||
|
--Log("菜单项页面Id : "..curPageID)
|
|||
|
CS.MarketingActsRoot.Instance():LoadUICallBackLua(isSucess, param, uiObj)
|
|||
|
end
|