zhangjiannan 2025-06-11 16:43:49 +08:00
parent 3cd9098e0c
commit 8b4b4e02e7
5 changed files with 43 additions and 12 deletions

View File

@ -293,7 +293,12 @@ end
--秒转换成文字对应时间
function GetTimeStrBySeconds(_seconds)
-- 计算时区偏移UTC+4 即东4区偏移量为14400秒
local utc_offset = 43200
local now = os.time()
local utc_offset = os.difftime(now, os.time(os.date("!*t", now))) + 14400
local timeinfo = os.date("*t")
if timeinfo.isdst then -- 判断夏令时 如果是夏令时则+1时区,因为夏令时的5点,实际上获取的是4点的时间戳,所以返回结果需要加1小时
utc_offset = utc_offset + 3600
end
return os.date(GetLanguageStrById(10779), _seconds - utc_offset)
end
@ -1386,15 +1391,21 @@ function CalculateSecondsNowTo_N_OClock(n)
--- 8*60*60 = 28800
--- 24*60*60 = 86400
local now = os.time()
local timeZone = os.difftime(now, os.time(os.date("!*t", now)))
--local now = os.time()
--local timeZone = os.difftime(now, os.time(os.date("!*t", now)))
local todayPassSeconds = (curTimeStemp + timeZone) % 86400
--local todayPassSeconds = (curTimeStemp - timeZone - 14400) % 86400
local todayPassSeconds = (curTimeStemp - 14400) % 86400
local targetSeconds = n * 3600 --- 60*60 = 3600
if todayPassSeconds <= targetSeconds then
--LogError("则计算到第二天这个时间点需要的秒数"..tostring(todayPassSeconds))
--LogError("则计算到第二天这个时间点需要的秒数"..tostring(curTimeStemp))
return targetSeconds - todayPassSeconds
else
-- 如果已经过去了,则计算到第二天这个时间点需要的秒数
--LogError("则计算到第二天这个时间点需要的秒数"..tostring(todayPassSeconds))
--LogError("则计算到第二天这个时间点需要的秒数"..tostring(timeZone))
--LogError("则计算到第二天这个时间点需要的秒数"..tostring(curTimeStemp))
return targetSeconds + 86400 - todayPassSeconds
end
end
@ -1493,7 +1504,12 @@ function TimeToYMDHMS(t)
if not t or t < 0 then
return 0
end
local utc_offset = 43200
local now = os.time()
local utc_offset = os.difftime(now, os.time(os.date("!*t", now))) + 14400
local timeinfo = os.date("*t")
if timeinfo.isdst then -- 判断夏令时 如果是夏令时则+1时区,因为夏令时的5点,实际上获取的是4点的时间戳,所以返回结果需要加1小时
utc_offset = utc_offset + 3600
end
return os.date(GetLanguageStrById(1013022), t - utc_offset)
end
@ -1519,12 +1535,19 @@ end
--- 获取今天某时间点时间戳
function Today_N_OClockTimeStamp(n)
local now = os.time()
local utc_offset = os.difftime(now, os.time(os.date("!*t", now)))
local timeinfo = os.date("*t")
if timeinfo.isdst then -- 判断夏令时 如果是夏令时则+1时区,因为夏令时的5点,实际上获取的是4点的时间戳,所以返回结果需要加1小时
utc_offset = utc_offset + 3600
end
local currentTime = math.floor(GetTimeStamp())
--LogError("========================时间便宜:"..tostring(utc_offset))
local tab = os.date("*t", currentTime)
tab.hour = n
tab.min = 0
tab.sec = 0
local N_TimeStamp = os.time(tab)
local N_TimeStamp = os.time(tab) - utc_offset - 14400
return N_TimeStamp
end

View File

@ -75,7 +75,7 @@ function UIManager.Initialize()
-- this.camera = gameObj.transform:Find("UICamera"):GetComponent("Camera")
this.camera = gameObj.transform:Find("UIRoot/UICameraRoot/UICamera"):GetComponent("Camera")
this.cameraRoot = gameObj.transform:Find("UIRoot/UICameraRoot")
this.Adapter()
--this.Adapter()
this.InitCommonPanels()
UpdateBeat:Add(update, this)
end
@ -128,8 +128,10 @@ function UIManager.Adapter()
local n = Screen.height / Screen.width
if n > standard then
local rectTransform = this.uiNode.gameObject:GetComponent("RectTransform")
rectTransform.offsetMin = Vector2.New(rectTransform.offsetMin.x, rectTransform.offsetMin.y + UIManager.Offset.Bottom)
rectTransform.offsetMax = Vector2.New(rectTransform.offsetMax.x, rectTransform.offsetMax.y - UIManager.Offset.Top)
--rectTransform.offsetMin = Vector2.New(rectTransform.offsetMin.x, rectTransform.offsetMin.y + UIManager.Offset.Bottom - 40)
--rectTransform.offsetMax = Vector2.New(rectTransform.offsetMax.x, rectTransform.offsetMax.y - UIManager.Offset.Top)
rectTransform.offsetMin = Vector2.New(rectTransform.offsetMin.x, rectTransform.offsetMin.y)
rectTransform.offsetMax = Vector2.New(rectTransform.offsetMax.x, rectTransform.offsetMax.y)
rectTransform = this.screenMask1:GetComponent("RectTransform")
rectTransform.anchorMin = Vector2.New(0, 1)
@ -149,6 +151,7 @@ function UIManager.Adapter()
elseif n < standard then
local w = 1920 / Screen.height * Screen.width
local f = (w-1080) / 2
f = 0
local rectTransform = this.uiNode.gameObject:GetComponent("RectTransform")
rectTransform.offsetMin = Vector2.New(rectTransform.offsetMin.x + f, rectTransform.offsetMin.y)
rectTransform.offsetMax = Vector2.New(rectTransform.offsetMax.x - f, rectTransform.offsetMax.y)

View File

@ -103,7 +103,9 @@ function OperatingPanel:InitComponent()
-- Util.GetGameObject(self.operateTabs[14], "selected/Image"):GetComponent("Image").sprite = Util.LoadSprite(GetPictureFont("X1_zhizunhuiyuan_01"))
-- Util.GetGameObject(self.transform, "bg/pageContent/page_13/icon"):GetComponent("Image").sprite = Util.LoadSprite(GetPictureFont("X1_zhizunhuiyuan_peitu"))
end
function OperatingPanel:OpenOnlineRewards()
OnlineRewards:OnShow()
end
function OperatingPanel:BindEvent()
Util.AddClick(self.btnBack, function()
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)

View File

@ -64,7 +64,8 @@ function this:OnShow()
PayManager.Pay({Id = allBuyConfig.Id}, function ()
this:OnShow()
if UIManager.IsOpen(UIName.OperatingPanel) then
UIManager.GetOpenPanel(UIName.OperatingPanel).OnlineRewards:OnShow()
-UIManager.GetOpenPanel(UIName.OperatingPanel).OnlineRewards:OnShow()
UIManager.GetOpenPanel(UIName.OperatingPanel):OpenOnlineRewards()
end
end)
end)
@ -119,7 +120,8 @@ function this.SetItemInfo(go, data)
PayManager.Pay({Id = data.Id}, function ()
this:OnShow()
if UIManager.IsOpen(UIName.OperatingPanel) then
UIManager.GetOpenPanel(UIName.OperatingPanel).OnlineRewards:OnShow()
--UIManager.GetOpenPanel(UIName.OperatingPanel).OnlineRewards:OnShow()
UIManager.GetOpenPanel(UIName.OperatingPanel):OpenOnlineRewards()
end
end)
end)

View File

@ -269,6 +269,7 @@ function this:StartTimeCount()
-- 刷新时间
if localSelf.isShowRefreshTime then
local refreshTime = ShopManager.GetShopRefreshLeftTime(localSelf.ShopType)
--LogError("ssssssssssssssssssss"..tostring(localSelf.ShopType))
if refreshTime >= 0 then
localSelf.refreshTime:GetComponent("Text").text = TimeToHMS(refreshTime)
end