-- 成长基金子页面 require("Util") require("LuaUtil") require("LuaItemBase") InvestNodeItem = LuaItemBase:new() local _LevelDeseStr local _BtnCanAccpet local _BtnAccepted local _achieveBgTra local _IconSuoTra local _IconLiangTra local _unfoldTextStr local _moneyCountText function InvestNodeItem.Awake() --ELog('InvestNodeItem.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') -- 箱子 _moneyCountText = _moneyCount:GetComponent("Text") -- 元宝数量 -- _FuLei = _FuLei:GetComponent('Transform') -- 父类 _unfoldTextStr = _unfoldText:GetComponent("Text") -- 开服天数 _achieveBgTra.gameObject:SetActive(false) -- 绑定事件 _BtnCanAccpet.onClick:RemoveAllListeners() -- 先清理 _BtnCanAccpet.onClick:AddListener(InvestNodeItem.OnBtnGet) end function InvestNodeItem.ShowWithTab(data) _data = data -- 按钮状态 _LevelDeseStr.gameObject:SetActive(_data.state == 0) _IconSuoTra.gameObject:SetActive(_data.state == 0) _BtnAccepted.gameObject:SetActive(_data.state == 2) _achieveBgTra.gameObject:SetActive(_data.state == 2) _BtnCanAccpet.gameObject:SetActive(_data.state == 1) _IconLiangTra.gameObject:SetActive(_data.state == 1) -- 条件描述 _LevelDeseStr.text = CS.GCGame.Table.StrDictionary.GetServerDictionaryFormatString(_data.descs[1]) local intDay = InvestNodeItem.numberToString(_data.tagID + 1) _unfoldTextStr.text = CS.GCGame.Table.StrDictionary.GetClientDictionaryString("#{39634}",intDay)-- 开服第{0}天 -- 条件描述 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 _moneyCountText.text = _awardItems.awardNum .. moneyType if _data.state == 2 then _moneyCountText.gameObject:SetActive(false) end end --点击按钮请求领取 function InvestNodeItem.OnBtnGet() require("LuaDistributesMarketingActAwardPageGetAward") local reqInfo = {actID = _data.actID,tagID = _data.tagID} LuaDistributesMarketingActAwardPageGetAward.SendPacket(reqInfo) end function InvestNodeItem.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