📄 calendarweather.luac.lua
字号:
-- Decompiled using luadec 0.4 by sztupy (http://winmo.sztupy.hu)
-- Command line was: -l ;9;;7,10,11,12,14;0;0;0,0,11,17;0;; 7cff21ba_manila.luac
trace("calendar weather script")
WeatherData = {index = 4}
Forecasts = nil
initWeatherData = function()
trace("init weather")
local l_1_0 = _application.Store:GetStringValue(Lifetime_Permanent, "WorldClock.Local")
trace("LocalCity = " .. tostring(l_1_0))
if l_1_0 == nil or l_1_0 == "" then
trace("cityCode empty")
return
elseif l_1_0 == "(system)" then
trace("cityCode invaild")
return
end
require("weather_svc")
weather = AccuWeather(_application:GetScopedLog("weather"), _application.Store)
CityObj = weather:GetCityFromCode(l_1_0)
trace("GetForecast data for local city")
weather:BeginGetForecast(CityObj, false, onGetForecastCompletion)
trace("init weather end")
end
onGetForecastCompletion = function(l_2_0)
trace("+onBeginGetForecastCompletion")
if l_2_0 == true then
trace("get data fail")
return
end
PrepareWeahterData()
trace("onBeginGetForecastCompletion")
end
PrepareWeahterData = function()
trace("PrepareWeahterData")
local l_3_0 = weather:GetForecast(CityObj)
local l_3_1 = calendar:GetToday()
local l_3_2 = false
local actualyear = l_3_0.lastUpdate.Year
local actualmonth = l_3_0.lastUpdate.Month
local actualday = l_3_0.lastUpdate.Day
trace("weather data lastupdate time=" .. actualyear .. "/" .. actualmonth .. "/" .. actualday)
for i = 0, 4 do
if not l_3_2 and l_3_1:IsSameDay(l_3_0.lastUpdate, 0, 0, i) then
trace("mark valid day=" .. i)
l_3_2 = true
WeatherData.index = i
end
WeatherData[i] = {}
WeatherData[i].year = actualyear
WeatherData[i].month = actualmonth
WeatherData[i].day = actualday
actualyear, actualmonth, actualday = CheckWeatherDay(actualyear, actualmonth, actualday)
end
Forecasts = l_3_0
end
CheckWeatherDay = function(l_4_0, l_4_1, l_4_2)
local what = calendar:GetNextDay(l_4_0, l_4_1, l_4_2)
if what < l_4_2 then
if l_4_1 == 12 then
l_4_1 = 1
l_4_0 = l_4_0 + 1
else
l_4_1 = l_4_1 + 1
end
end
return l_4_0, l_4_1, what
end
InitializeWeatherIcon = function(l_5_0, l_5_1)
StopComponents(l_5_0)
l_5_0._visible = false
if l_5_1 then
l_5_0.Tag = {showWipers = false}
end
end
SetWeatherIconStateNoFade = function(l_6_0, l_6_1)
trace("SetWeatherIconStateNoFade start" .. l_6_1)
l_6_0._visible = true
StartComponents(l_6_0)
local l_6_2 = l_6_0:GetComponentClip()
l_6_2:stop()
local l_6_3 = l_6_2.Namespace:FindName("WeatherStateSingleton")
l_6_3:SetComponentClipCharacter("WeatherState" .. tostring(l_6_1))
l_6_2.Namespace:FindName("CurrentState").String = tostring(l_6_1)
l_6_2.Namespace:FindName("WiperEnabled").String = "false"
l_6_2.Frame = 1
StartComponents(l_6_0)
l_6_2:play()
trace("SetWeatherIconStateNoFade end")
end
StopComponents = function(l_7_0)
if l_7_0 ~= nil then
l_7_0:StopAll()
end
end
StartComponents = function(l_8_0)
if l_8_0 ~= nil then
l_8_0:PlayAll()
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -