import "pkg:/source/utils/Locale.bs" import "pkg:/source/utils/StringUtils.bs" function Init() m.normalFont = m.top.findNode("normalFont") m.boldFont = m.top.findNode("boldFont") end function function OnContentSet() as void content = m.top.itemContent if content = invalid return end if if content.type = "login" m.top.circlePosterInnerUri = "pkg:/images/icons/user-200.png" ' bs:disable-next-line LINT3023 m.top.circlePosterInnerBlendColor = "#FFFFFFFF" m.top.letter = "" m.top.username = Tr(Locale.Buttons.Login) m.top.serverUrl = "" m.top.crownVisible = false return end if m.top.circlePosterInnerUri = "pkg:/images/white-circle.png" m.top.circlePosterInnerBlendColor = content.color username = content.username m.top.username = username if not StringUtils.IsNullOrEmpty(username) m.top.letter = UCase(username.Left(1)) else m.top.letter = "" end if m.top.serverUrl = content.serverUrl m.top.crownVisible = content.isSelected end function function OnRowListHasFocus() if not m.top.rowListHasFocus m.top.animate = false end if end function function OnItemHasFocus() m.top.animate = (m.top.itemHasFocus or m.top.focusPercent > 0.5) and m.top.rowListHasFocus end function function OnFocusPercent() if m.top.focusPercent > 0.5 and m.top.rowListHasFocus m.top.animate = true else m.top.animate = false end if end function function OnAnimate() animate = m.top.animate m.top.shadowVisible = animate m.top.serverLabelVisible = animate m.top.circlePosterTranslation = [20, 20] if animate m.top.UsernameLabelFont = m.boldFont m.top.animationControl = "start" else m.top.UsernameLabelFont = m.normalFont m.top.animationControl = "stop" end if end function