192 lines
5.6 KiB
Plaintext
192 lines
5.6 KiB
Plaintext
-- 等级投资
|
|
|
|
require("Util")
|
|
require("LuaUtil")
|
|
require("MarketingActBase")
|
|
|
|
InvestPagePanel = MarketingActBase:new()
|
|
|
|
local _moneyUIImgText
|
|
local _PerchaseTextStr
|
|
local _reward
|
|
local _Btninvest
|
|
local _BtnHasinvest
|
|
local _UIContainerScrolls
|
|
|
|
|
|
local asdasdasd = 0
|
|
|
|
function InvestPagePanel.Awake()
|
|
_moneyUIImgText = _moneyValue:GetComponent('UIImgText') -- 价钱
|
|
_PerchaseTextStr = _PerchaseText:GetComponent('Text') -- 价钱
|
|
_reward = _times:GetComponent('UIImgText') -- 倍数
|
|
_Btninvest = _investBtn:GetComponent('Button') --投资按钮
|
|
_BtnHasinvest = _HasinvestBtn:GetComponent('Button') -- 已投资按钮
|
|
_UIContainerScrolls = _UIContainerScroll:GetComponent('UIContainerBase') -- 子界面容器
|
|
|
|
--绑定事件
|
|
_Btninvest.onClick:RemoveAllListeners() -- 先清理
|
|
_Btninvest.onClick:AddListener(InvestPagePanel.OnGetBtnClick)
|
|
|
|
--_moneyUIImgText.text = '388'
|
|
_PerchaseTextStr.text = _moneyUIImgText.text
|
|
|
|
|
|
|
|
end
|
|
|
|
-- 投资请求
|
|
function InvestPagePanel.OnGetBtnClick()
|
|
--ELog('等级投资actid.... '..InvestPagePanel.ActID)
|
|
require("LuaDistributesMarketinfActPerchasePeq")
|
|
local reqInfo = { actId = InvestPagePanel.ActID ,tagId = 0}
|
|
LuaDistributesMarketinfActPerchasePeq.SendPacket(reqInfo)
|
|
end
|
|
|
|
function InvestPagePanel.AskForInfo()
|
|
--ELog('InvestPagePanel.AskForInfo .. '..InvestPagePanel.ActID)
|
|
require("LuaDistributesMarketingActAwardPageReq")
|
|
local reqInfo = { actID = InvestPagePanel.ActID , updateOrInit = 1 }
|
|
LuaDistributesMarketingActAwardPageReq.SendPacket(reqInfo)
|
|
end
|
|
local redTipCount = 0
|
|
_packet = nil
|
|
function InvestPagePanel.MarketingActPageAwardRetDel(packet)
|
|
--ELog('InvestPagePanel.MarketingActPageAwardRetDel')
|
|
_packet = packet
|
|
if packet ~= nil then
|
|
--_UIContainerScrolls:InitContentItemL2L(packet.awardTags)
|
|
InvestPagePanel.RefreshMenuItemState()
|
|
end
|
|
|
|
if packet ~= nil then
|
|
-- 投资按钮状态
|
|
_Btninvest.gameObject:SetActive(packet.pagrState == 0)
|
|
_BtnHasinvest.gameObject:SetActive(packet.pagrState >= 1)
|
|
end
|
|
|
|
-- 临时代码
|
|
local _InvestmentActRoot = CS.LuaUIManager.Instance:GetUIInstance("InvestmentActRoot")
|
|
local _pathMenu = "Anchor/BG/UIContainerSelect/Scroll View/Viewport/Content"
|
|
local _Menu = _InvestmentActRoot.transform:Find(_pathMenu):GetComponent("Transform")
|
|
local _menuObj = _Menu:GetChild(0):GetComponent("Transform")
|
|
local TH_dot = _menuObj.transform:Find("MarkIcon_2")
|
|
TH_dot.gameObject:SetActive(packet.awardTags[1].state == 1)
|
|
|
|
-- ELog('执行了吗')
|
|
-- if asdasdasd == 0 then
|
|
-- asdasdasd = 1
|
|
-- for i = 1, #packet.awardTags do
|
|
-- if packet.awardTags[i].state == 1 then
|
|
-- ELog(packet.awardTags[i].state)
|
|
-- end
|
|
-- end
|
|
-- end
|
|
--临时代码
|
|
|
|
local actInfo = TabMan.GetActInfoClientByID(InvestPagePanel.ActID, 0)
|
|
LoadAB:SetImageSprite(advertising:GetComponent("Image"), actInfo.Icon)
|
|
|
|
--货币类型
|
|
if actInfo.ModelID > 0 then
|
|
yuanbao:SetActive(actInfo.ModelID == 1)
|
|
lingyu:SetActive(actInfo.ModelID == 2)
|
|
end
|
|
|
|
|
|
end
|
|
|
|
-- function InvestPagePanel.OnEnable()
|
|
-- asdasdasd = 0
|
|
-- end
|
|
|
|
function InvestPagePanel.OnPacketCopyInfo(data)
|
|
_data = data
|
|
if data.investmentVal > 0 then
|
|
-- _moneyUIImgText.text = data.investmentVal
|
|
-- _PerchaseTextStr.text = _moneyUIImgText.text
|
|
end
|
|
--_reward.text = 10 openServerTimeFlag
|
|
|
|
end
|
|
local isTimes = 0
|
|
function InvestPagePanel.Update()
|
|
if isTimes == 0 and _packet ~= nil then
|
|
isTimes = 1
|
|
local contentSubCount = _content.transform.childCount
|
|
if contentSubCount >= #_packet.awardTags then
|
|
for i = 1, #_packet.awardTags do
|
|
if _data ~= nil then
|
|
_content.transform:GetChild(i-1).transform:Find("unfold").gameObject:SetActive(_data.openServerTimeFlag > 0)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
function InvestPagePanel.RefreshMenuItemState()
|
|
--重新排序初始化
|
|
|
|
table.sort(_packet.awardTags, function(subNode1, subNode2)
|
|
local aWeigth
|
|
local bWeight
|
|
|
|
if subNode1.state == 1 then
|
|
aWeigth = 3
|
|
elseif subNode1.state == 0 then
|
|
aWeigth = 2
|
|
else
|
|
aWeigth = 1
|
|
end
|
|
|
|
|
|
if subNode2.state == 1 then
|
|
bWeight = 3
|
|
elseif subNode2.state == 0 then
|
|
bWeight = 2
|
|
else
|
|
bWeight = 1
|
|
end
|
|
if aWeigth == bWeight then
|
|
return subNode1.tagID < subNode2.tagID
|
|
else
|
|
return aWeigth > bWeight
|
|
end
|
|
end)
|
|
_UIContainerScrolls:InitContentItemL2L(_packet.awardTags)
|
|
end
|
|
|
|
function InvestPagePanel.OnDisable()
|
|
self.gameObject:SetActive(false)
|
|
end
|
|
|
|
function InvestPagePanel.NewOnPacketCopyInfo(data)
|
|
if data.awardTags[1].otherDescs[1] ~= nil then
|
|
_moneyUIImgText.text = data.awardTags[1].otherDescs[1]
|
|
_PerchaseTextStr.text = _moneyUIImgText.text
|
|
else
|
|
_moneyUIImgText.text = ''
|
|
end
|
|
if data.awardTags[1].otherDescs[2] ~= nil then
|
|
_reward.text = data.awardTags[1].otherDescs[2]
|
|
else
|
|
_reward.text = ''
|
|
end
|
|
|
|
-- if data.awardTags ~= nil then
|
|
|
|
-- end
|
|
|
|
-- for i = 1, #data.awardTags do
|
|
-- for j = 1, #data.awardTags[i].otherDescs do
|
|
-- if data.awardTags[i].otherDescs[j] ~= nil then
|
|
|
|
-- _moneyUIImgText.text = data.awardTags[i].otherDescs[1]
|
|
-- _PerchaseTextStr.text = data.awardTags[i].otherDescs[1]
|
|
-- _reward.text = data.awardTags[i].otherDescs[2]
|
|
-- end
|
|
-- end
|
|
-- end
|
|
|
|
end
|