113 lines
4.0 KiB
Plaintext
113 lines
4.0 KiB
Plaintext
-- 成长基金子页面
|
|
|
|
require("Util")
|
|
require("LuaUtil")
|
|
require("LuaItemBase")
|
|
AweekNodeItem= LuaItemBase:new()
|
|
|
|
local _LevelDeseStr
|
|
local _BtnCanAccpet
|
|
local _BtnAccepted
|
|
local _achieveBgTra
|
|
local _IconSuoTra
|
|
local _IconLiangTra
|
|
local _unfoldTextStr
|
|
local _moneyCountText
|
|
function AweekNodeItem.Awake()
|
|
--ELog('AweekNodeItem.Awake()')
|
|
_LevelDeseStr = _LevelDese:GetComponent("Text") -- 描述
|
|
_BtnCanAccpet = _CanAccpetBtn:GetComponent("Button") -- 可领取按钮
|
|
_BtnAccepted = _AcceptedBtn:GetComponent("Button") -- 已经领取
|
|
_achieveBgTra = _achieveBg:GetComponent('Transform') -- 已经领取背景
|
|
_IconSuoTra = _IconSuo:GetComponent('Transform') -- 箱子
|
|
_IconLiangTra = _IconLiang:GetComponent('Transform') -- 箱子
|
|
_unfoldTextStr = _unfoldText:GetComponent("Text") -- 开服天数
|
|
_moneyCountText = _moneyCount:GetComponent("Text")
|
|
|
|
-- new_LevelDese1 = new_LevelDese1:GetComponent("Text")
|
|
-- new_LevelDese2 = new_LevelDese2:GetComponent("Text")
|
|
|
|
_achieveBgTra.gameObject:SetActive(false)
|
|
|
|
-- 绑定事件
|
|
_BtnCanAccpet.onClick:RemoveAllListeners() -- 先清理
|
|
_BtnCanAccpet.onClick:AddListener(AweekNodeItem.OnBtnGet)
|
|
|
|
end
|
|
|
|
function AweekNodeItem.ShowWithTab(data)
|
|
_data = data
|
|
-- 按钮状态
|
|
local _state = data.state
|
|
_LevelDeseStr.gameObject:SetActive(_state == 0)
|
|
_IconSuoTra.gameObject:SetActive(_state == 0)
|
|
_BtnAccepted.gameObject:SetActive(_state == 2)
|
|
_achieveBgTra.gameObject:SetActive(_state == 2)
|
|
_BtnCanAccpet.gameObject:SetActive(_state == 1)
|
|
_IconLiangTra.gameObject:SetActive(_state == 1)
|
|
|
|
|
|
-- 条件描述
|
|
local moneyType = '' --货币类型
|
|
local _awardItems = _data.awardItems[1]
|
|
if _awardItems.awardSubType == 0 then
|
|
moneyType = CS.GCGame.Table.StrDictionary.GetClientDictionaryString("#{6003}")
|
|
end
|
|
if _awardItems.awardSubType == 1 then
|
|
moneyType = CS.GCGame.Table.StrDictionary.GetClientDictionaryString("#{6001}")
|
|
end
|
|
if _awardItems.awardSubType == 2 then
|
|
moneyType = CS.GCGame.Table.StrDictionary.GetClientDictionaryString("#{6002}")
|
|
end
|
|
if _awardItems.awardSubType == 3 then
|
|
moneyType = CS.GCGame.Table.StrDictionary.GetClientDictionaryString("#{6004}")
|
|
end
|
|
_LevelDeseStr.text = _awardItems.awardNum .. moneyType
|
|
|
|
_moneyCountText.text = _awardItems.awardNum .. moneyType
|
|
|
|
local intDay = AweekNodeItem.numberToString(_data.tagID + 1)
|
|
_unfoldTextStr.text = CS.GCGame.Table.StrDictionary.GetClientDictionaryString("#{39635}",intDay)-- 第{0}日返利
|
|
|
|
--new_LevelDese1.text = _data.awardInfo[data.tagID+1].itemName
|
|
|
|
|
|
end
|
|
|
|
|
|
function AweekNodeItem.OnBtnGet()
|
|
require("LuaDistributesMarketingActAwardPageGetAward")
|
|
local reqInfo = {actID = _data.actID,tagID = _data.tagID}
|
|
LuaDistributesMarketingActAwardPageGetAward.SendPacket(reqInfo)
|
|
end
|
|
|
|
|
|
function AweekNodeItem.numberToString(digit)
|
|
---阿拉伯数字转中文大写
|
|
local wordDigit = "" --得到的大写数字
|
|
local digitLength = 0 --阿拉伯数字长度
|
|
local iNum = 0
|
|
local wordFigureList = {
|
|
StrDic.GetClientDictionaryString("#{66012}"),
|
|
StrDic.GetClientDictionaryString("#{66013}"),
|
|
StrDic.GetClientDictionaryString("#{66014}"),
|
|
StrDic.GetClientDictionaryString("#{66015}"),
|
|
StrDic.GetClientDictionaryString("#{66016}"),
|
|
StrDic.GetClientDictionaryString("#{66017}"),
|
|
StrDic.GetClientDictionaryString("#{66018}"),
|
|
StrDic.GetClientDictionaryString("#{66019}"),
|
|
StrDic.GetClientDictionaryString("#{66020}"),
|
|
StrDic.GetClientDictionaryString("#{66021}")}
|
|
if nil == tonumber(digit) then
|
|
return tostring(digit)
|
|
end
|
|
digitLength =string.len(digit)
|
|
if digitLength == 0 or tonumber(digit) < 0 then
|
|
return tostring(digit)
|
|
end
|
|
for i = 1, digitLength do
|
|
iNum = string.sub(digit,i,i)
|
|
wordDigit = wordDigit..wordFigureList[iNum + 1] --//转换为相应的数字
|
|
end
|
|
return wordDigit
|
|
end |