SL_Out.lua 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. local this = SL
  2. function this:GetItemColor(cfgId)
  3. ---@type cfg_item_column
  4. local item = SL:GetConfig("cfg_item",cfgId)
  5. if item then
  6. ---@type cfg_color_column
  7. local colorTbl = SL:GetConfig("cfg_color",item.color)
  8. return colorTbl.color
  9. end
  10. end
  11. function this:GetServerOpendifferenceTime()
  12. --if LoginManager == nil or LoginManager.EnterRoleRes == nil then
  13. if not SL:GetEnterRoleRes() then
  14. return -1
  15. end
  16. local openTime = Time.FormatTimeYMDHMS(SL:GetEnterRoleRes().openServerTime / 1000)
  17. local hour = tonumber(string.sub(openTime, 12, 13))
  18. local minute = tonumber(string.sub(openTime, 15, 16))
  19. local second = tonumber(string.sub(openTime, 18, 19))
  20. local differenceTime = 0 --刷新差值
  21. local refreshTime = 5 --刷新时间5点改为0点
  22. local isbeforerefresh = hour < refreshTime
  23. differenceTime = hour * 3600 + minute * 60 + second
  24. return isbeforerefresh, differenceTime
  25. end
  26. ---通过职业筛选奖励物品
  27. function this:GetRewardIdByCareer(rewards)
  28. local rewardList = {}
  29. local myCarrer = SL:GetMetaValue(EMetaVarGetKey.JOB)
  30. for k, v in pairs(rewards) do
  31. if v[1] == myCarrer then
  32. for k, v1 in pairs(v) do
  33. if k ~= 1 then
  34. table.insert(rewardList, v1)
  35. end
  36. end
  37. end
  38. end
  39. return rewardList
  40. end
  41. ---获取职业头像的图集名和图片名
  42. ---@return string,string @图集名,图片名
  43. function this.GetAtlas2CareerHead(baseCareer)
  44. if tostring(baseCareer) == "1" then
  45. return "Atlas/MUIcon.spriteatlas", "s_1" .. baseCareer
  46. end
  47. return "Atlas/MUIcon.spriteatlas", "1" .. baseCareer
  48. end