1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- local this = SL
- function this:GetItemColor(cfgId)
- ---@type cfg_item_column
- local item = SL:GetConfig("cfg_item",cfgId)
- if item then
- ---@type cfg_color_column
- local colorTbl = SL:GetConfig("cfg_color",item.color)
- return colorTbl.color
- end
- end
- function this:GetServerOpendifferenceTime()
- --if LoginManager == nil or LoginManager.EnterRoleRes == nil then
- if not SL:GetEnterRoleRes() then
- return -1
- end
- local openTime = Time.FormatTimeYMDHMS(SL:GetEnterRoleRes().openServerTime / 1000)
- local hour = tonumber(string.sub(openTime, 12, 13))
- local minute = tonumber(string.sub(openTime, 15, 16))
- local second = tonumber(string.sub(openTime, 18, 19))
- local differenceTime = 0 --刷新差值
- local refreshTime = 5 --刷新时间5点改为0点
- local isbeforerefresh = hour < refreshTime
- differenceTime = hour * 3600 + minute * 60 + second
- return isbeforerefresh, differenceTime
- end
- ---通过职业筛选奖励物品
- function this:GetRewardIdByCareer(rewards)
- local rewardList = {}
- local myCarrer = SL:GetMetaValue(EMetaVarGetKey.JOB)
- for k, v in pairs(rewards) do
- if v[1] == myCarrer then
- for k, v1 in pairs(v) do
- if k ~= 1 then
- table.insert(rewardList, v1)
- end
- end
- end
- end
- return rewardList
- end
- ---获取职业头像的图集名和图片名
- ---@return string,string @图集名,图片名
- function this.GetAtlas2CareerHead(baseCareer)
- if tostring(baseCareer) == "1" then
- return "Atlas/MUIcon.spriteatlas", "s_1" .. baseCareer
- end
- return "Atlas/MUIcon.spriteatlas", "1" .. baseCareer
- end
|