added finn icon

This commit is contained in:
Chr1Z93 2023-04-18 23:35:46 +02:00
parent 8c2d050854
commit c20659887d
3 changed files with 36 additions and 6 deletions

View File

@ -203,5 +203,10 @@
"Name": "TitleGradient",
"Type": 0,
"URL": "https://i.imgur.com/Mdjm349.png"
},
{
"Name": "FinnIcon",
"Type": 0,
"URL": "http://cloud-3.steamusercontent.com/ugc/2037357792052848566/5DA900C430E97D3DFF2C9B8A3DB1CB2271791FC7/"
}
]

View File

@ -42,9 +42,8 @@ local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi")
-- online functionality related variables
local MOD_VERSION = "3.1.0"
local SOURCE_REPO = 'https://raw.githubusercontent.com/chr1z93/loadable-objects/main'
local library, requestObj
local library, requestObj, modMeta, notificationVisible
local dontNotify = {}
local modMeta
---------------------------------------------------------
-- data for tokens
@ -1069,9 +1068,7 @@ function compareVersion(request)
log("Release notes for latest version not found!")
else
updateNotificationLoading()
-- small delay to avoid lagging
Wait.time(function() UI.show("updateNotification") end, 1)
UI.show("FinnIcon")
end
end
@ -1108,11 +1105,23 @@ function updateNotificationLoading()
UI.setXmlTable(ui)
end
-- triggered by clicking on the Finn Icon
function onClick_FinnIcon()
if notificationVisible then
UI.hide("updateNotification")
notificationVisible = false
else
UI.show("updateNotification")
notificationVisible = true
end
end
-- close / don't show again buttons on the update notification
function onClick_notification(_, parameter)
if parameter == "dontNotify" then
-- this variable tracks if "don't show again" was pressed for a version
dontNotify[modMeta["latestVersion"]] = true
end
UI.hide("FinnIcon")
UI.hide("updateNotification")
end

View File

@ -1,5 +1,21 @@
<!-- Default formatting inherented from OptionPanel! -->
<!-- Icon with Finn, which can be clicked -->
<Image id="FinnIcon"
active="false"
showAnimation="SlideIn_Top"
hideAnimation="SlideOut_Top"
animationDuration="0.2"
rectAlignment="UpperLeft"
offsetXY="420 -5"
height="90"
width="90"
onClick="onClick_FinnIcon"
image="FinnIcon"
tooltip="Update notification"
tooltipBackgroundColor="rgba(0,0,0,0.8)"/>
<!-- main notification window -->
<TableLayout id="updateNotification"
active="false"
color="#000000"
@ -29,7 +45,7 @@
<Row id="highlightRow"
preferredHeight="100">
<Cell>
<Panel padding="15 15 0 0">
<Panel padding="15 15 0 7">
<!-- this part will be updated via script -->
<Text id="releaseHighlightText"
resizeTextForBestFit="true">Placeholder</Text>