Skip to content

Commit

Permalink
Fix icon not changing
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaneee committed Jul 24, 2024
1 parent 985edba commit 2f1281a
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions AuthenticWeather/@Resources/icon_mapping.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
-- icon_mapping.lua
function Initialize()
-- Define a table mapping icon codes to image filenames
iconMap = {
["01d"] = "clear_day.png",
["01n"] = "clear_night.png",
["02d"] = "partly_cloudy_day.png",
["02n"] = "partly_cloudy_night.png",
["03d"] = "cloudy.png",
["03n"] = "cloudy.png",
["04d"] = "broken_clouds.png",
["04n"] = "broken_clouds.png",
["09d"] = "shower_rain_day.png",
["09n"] = "shower_rain_night.png",
["10d"] = "rain.png",
["10n"] = "rain.png",
["13d"] = "snow.png",
["13n"] = "snow.png",
["50d"] = "mist.png",
["50n"] = "mist.png",
}
end

function Update()
local iconCode = SKIN:GetMeasure('Icon'):GetStringValue() -- Assuming the icon code is in the 'Icon' measure

local iconName = iconMap[iconCode] or "default.png"

SKIN:Bang('!SetVariable', 'IconMapping', iconName)
end
Binary file modified AuthenticWeather/AuthenticWeather.ini
Binary file not shown.

0 comments on commit 2f1281a

Please sign in to comment.