#include "script/common.lua" #include "ui/ui_helpers.lua" #include "ui/ui_extensions.lua" local activeSlider = nil function setActiveSlider(slider) activeSlider = slider end function getActiveSlider() return activeSlider end local focusedSliderConfig = { thumb = "common/thumb_I218_249_2430_49029.png", thumbWidth = 8, thumbHeight = 20, background = "common/rect_c#ffffff_o0.10_cr3.png", backgroundBorder = 4, bar = "common/rect_c#ffff7f_o1.00_crs2-0-0-2.png", width = 301, barBorder = 3, barThickness = 8, } local sliderConfig = { thumb = "common/thumb_I218_252_2430_48962.png", thumbWidth = 8, thumbHeight = 20, background = "common/rect_c#ffffff_o0.10_cr3.png", backgroundBorder = 4, bar = "common/rect_c#868686_o1.00_crs2-0-0-2.png", barBorder = 3, width = 301, barThickness = 8, } function drawCheckBox(isChecked, labelText) local f366_517_item_navId = UiNavGroupBegin() UiNavGroupSize(232.0, 42.0) local f366_517_item_isFocued = UiReceivesInput() and (UiIsMouseInRect(232.0, 42.0) or UiIsComponentInFocus(f366_517_item_navId)) if f366_517_item_isFocued then -- draw frame F366_517_item UiPush() UiColorFilter(1.0, 1.0, 1.0, 1) UiPush() local navId = UiNavComponent(232.0, 42.0) local isFocused = UiIsMouseInRect(232.0, 42.0) or UiIsComponentInFocus(navId) local isClicked = isFocused and (InputPressed("menu_accept") or InputPressed("lmb")) UiIgnoreNavigation() if isClicked then isChecked = not isChecked end if isChecked then -- draw frame FI366_517_359_1089_Checked UiPush() UiPush() UiColor(1, 1, 1, 1) UiTranslate(199.0, 10.0) UiCircleOutline(11, 1) UiTranslate(3.0, 3.0) UiCircle(8) UiPop() UiPush() UiColor(1, 1, 1, 1) UiImageBox("common/rect_c#ffffff_o0.15_cr8.png", 232.0, 42.0, 9, 9) UiPop() UiPush() UiTranslate(10.947021484375, 7) UiColor(1.0, 1.0, 0.49803921580314636, 1) UiFont("regular_sc.ttf", 26) UiText(labelText) UiPop() UiPop() else -- draw frame FI366_517_359_1185_Unchecked UiPush() UiPush() UiColor(1, 1, 1, 1) UiTranslate(199.0, 10.0) UiCircleOutline(11, 1) UiPop() UiPush() UiColor(1, 1, 1, 1) UiImageBox("common/rect_c#ffffff_o0.15_cr8.png", 232.0, 42.0, 9, 9) UiPop() UiPush() UiTranslate(10.947021484375, 7) UiColor(1.0, 1.0, 0.49803921580314636, 1) UiFont("regular_sc.ttf", 26) UiText(labelText) UiPop() UiPop() end UiPop() UiPop() else -- draw frame F366_517_item UiPush() UiColorFilter(1.0, 1.0, 1.0, 1) UiPush() local navId = UiNavComponent(232.0, 42.0) local isFocused = UiIsMouseInRect(232.0, 42.0) or UiIsComponentInFocus(navId) local isClicked = isFocused and (InputPressed("menu_accept") or InputPressed("lmb")) UiIgnoreNavigation() if isClicked then isChecked = not isChecked end if isChecked then -- draw frame FI366_517_359_1036_Checked UiPush() UiTranslate(9.0, 8.0) UiPush() UiColor(1, 1, 1, 1) UiTranslate(190.0, 2.0) UiCircleOutline(11, 1) UiTranslate(3.0, 3.0) UiCircle(8) UiPop() UiPush() UiTranslate(1.947021484375, -1) UiColor(1.0, 1.0, 1.0, 0.800000011920929) UiFont("regular_sc.ttf", 26) UiText(labelText) UiPop() UiPop() else -- draw frame FI366_517_359_1041_Unchecked UiPush() UiTranslate(9.0, 8.0) UiPush() UiColor(1, 1, 1, 1) UiTranslate(190.0, 2.0) UiCircleOutline(11, 1) UiPop() UiPush() UiTranslate(1.947021484375, -1) UiColor(1.0, 1.0, 1.0, 0.800000011920929) UiFont("regular_sc.ttf", 26) UiText(labelText) UiPop() UiPop() end UiPop() UiPop() end UiNavGroupEnd() end UiDropDown = {} UiDropDown.listView = {} UiDropDown.listView.listItems = {} UiDropDown.listView.backGround = { w = 12.0, h = 473.0, draw = function(self) UiPush() UiColor(1, 1, 1, 1) UiImageBox("common/rect_c#525252_o1.00_cr4.png", self.w, self.h, 4, 4) UiPop() end, } UiDropDown.listView.thumb = { w = 8.0, h = 127.0, draw = function(self) UiPush() UiTranslate(2, 0) UiColor(1, 1, 1, 1) UiImageBox("common/rect_c#ffffff_o1.00_cr3.png", self.w, self.h, 3, 3) UiPop() end, } UiDropDown.listView.scrollBar = UiCreateScrollBar(UiDropDown.listView.thumb, UiDropDown.listView.backGround) UiDropDown.listView.scrollBar.lerpSpeed = 15 function drawDropdown(dropdownState, isInFocus) UiPush() local ddMainView = { w = 341.0, h = 27.0, drawOpened = function(self, labelText) if isInFocus or dropdownState.isOpened then UiPush() UiTranslate(235.0, 0.0) UiPush() UiColor(1, 1, 1, 1) UiTranslate(82.258544921875, 10.486610412597656) UiImageBox("common/img_I218_284_388_1408.png", 18, 12, 0, 0) UiPop() UiPush() UiAlign("top right") UiTranslate(72.5999755859375, 3.123999786376956) UiColor(1.0, 1.0, 0.49803921580314636, 1) UiFont("regular.ttf", 27) UiText(labelText) UiPop() UiNavComponent(101.0, 27.0) UiPop() else UiPush() UiTranslate(235.0, 0.0) UiPush() UiColor(1, 1, 1, 1) UiTranslate(82.258544921875, 10.486610412597656) UiImageBox("common/img_I218_284_388_980.png", 18, 12, 0, 0) UiPop() UiPush() UiAlign("top right") UiTranslate(72.5999755859375, 3.123999786376956) UiColor(1.0, 1.0, 1.0, 0.6499999761581421) UiFont("regular.ttf", 27) UiText(labelText) UiPop() UiNavComponent(101.0, 27.0) UiPop() end end, drawClosed = function(self, labelText) if isInFocus then UiPush() UiTranslate(235.0, 0.0) UiPush() UiColor(1, 1, 1, 1) UiTranslate(82.258544921875, 10.0) UiImageBox("common/img_I218_284_388_1401.png", 18, 12, 0, 0) UiPop() UiPush() UiAlign("top right") UiTranslate(72.5999755859375, 3.123999786376956) UiColor(1.0, 1.0, 0.49803921580314636, 1) UiFont("regular.ttf", 27) UiText(labelText) UiPop() UiNavComponent(101.0, 27.0) UiPop() else UiPush() UiTranslate(235.0, 0.0) UiPush() UiColor(1, 1, 1, 1) UiTranslate(82.258544921875, 10.0) UiImageBox("common/img_I218_284_388_973.png", 18, 12, 0, 0) UiPop() UiPush() UiAlign("top right") UiTranslate(72.5999755859375, 3.123999786376956) UiColor(1.0, 1.0, 1.0, 0.6499999761581421) UiFont("regular.ttf", 27) UiText(labelText) UiPop() UiNavComponent(101.0, 27.0) UiPop() end end, } local ddListView = { w = 253.0, h = 489.0, list = UiDropDown.listView, offsetX = 97, offsetY = 50, draw = function() -- draw frame FI218_284_388_1413_List UiPush() UiPush() UiTranslate(0.0, 1.0) UiColor(1, 1, 1, 1) UiImageBox("common/rect_c#3a3a3a_o1.00_cr8.png", 252.0, 402.0, 8, 8) UiPop() UiPush() UiTranslate(10.0, 12.0) UiList(232.0, 455.0, UiDropDown.listView.listItems, UiDropDown.listView.scrollBar) UiPop() UiPop() end, } local itemTemplate = { w = 232.0, h = 42.0, draw = function(self, isChecked, labelText) drawCheckBox(isChecked, labelText) end, } UiDropDownList(ddMainView, ddListView, itemTemplate, dropdownState) UiPop() end function drawComponent_f218_285_Settings_layout_218_273(p0, p1) local f218_284_Settings_layout_navId = UiNavGroupBegin() UiNavGroupSize(1008.0, 50.0) local isInFocus = UiReceivesInput() and (UiIsMouseInRect(1008.0, 50.0) or UiIsComponentInFocus(f218_284_Settings_layout_navId)) if isInFocus or p1.isOpened then -- draw frame F218_284_Settings_layout UiPush() UiColorFilter(1.0, 1.0, 1.0, 1) UiPush() UiColor(1, 1, 1, 1) UiImageBox("common/rect_c#d9d9d9_o1.00_cr8.png", 1008.0, 50.0, 9, 9) UiPop() UiPush() UiTranslate(11.947021484375, 15.123999786376956) UiColor(1.0, 1.0, 1.0, 0.800000011920929) UiFont("regular.ttf", 27) UiText(p0) UiPop() -- draw frame FI218_284_388_1316_UiSettingSwitch UiPush() UiTranslate(660.0, 10.0) drawDropdown(p1, isInFocus) UiPop() UiPop() else -- draw frame F218_284_Settings_layout UiPush() UiColorFilter(1.0, 1.0, 1.0, 1) UiPush() UiTranslate(11.947021484375, 15.123999786376956) UiColor(1.0, 1.0, 1.0, 0.800000011920929) UiFont("regular.ttf", 27) UiText(p0) UiPop() -- draw frame FI218_284_388_890_UiSettingSwitch UiPush() UiTranslate(660.0, 10.0) drawDropdown(p1, isInFocus) UiPop() UiPop() end UiNavGroupEnd() end gTooltipCurW = 0 gTooltipCurH = 0 function drawTooltip(params) local cx,cy = UiGetCursorPos() local obj = { x = cx, y = cy, draw = function(self) UiPush() if self.colorFilter then UiColorFilter(unpack(self.colorFilter)) end local scaleX = 1 local scaleY = 1 if self.scale then UiScale(unpack(self.scale)) scaleX = self.scale[1] scaleY = self.scale[2] or self.scale[1] end UiTranslate(self.x / scaleX, self.y / scaleY) local pad = 15 local addLeftPad = self.showProtrusion and 12 or 0 local totalW = self.adaptWidth and gTooltipCurW + pad or 340 local totalH = gTooltipCurH + pad local txtWrap = 340 - 2 * pad - addLeftPad if self.anchorInMiddle then UiTranslate(0, -(gTooltipCurH + pad) / 2) end if not self.showProtrusion then UiPush() UiAlign("top left") UiColor(1, 1, 1, 1) UiImageBox("common/rect_c#000_o0.55_cr8.png", totalW, totalH, 9, 9) UiPop() else UiPush() UiAlign("top left") UiColor(0, 0, 0, 0.55) UiImageBox("common/tooltip_with_prot.png", totalW, totalH, 30, 9) UiPop() end UiBeginFrame() UiPush() UiAlign("top left") UiTranslate(pad + addLeftPad, pad) UiColor(1, 1, 1, 1) UiFont("regular.ttf", 27) UiPush() UiWordWrap(txtWrap) local _, hh = UiText(self.header) UiPop() UiPop() UiPush() UiAlign("top left") UiTranslate(pad + addLeftPad, hh + 20) UiColor(0.8, 0.8, 0.8, 0.8) UiFont("regular.ttf", 24) UiPush() UiWordWrap(txtWrap) UiText(self.description) UiPop() UiPop() local fw, fh = UiEndFrame() gTooltipCurW = fw / scaleX gTooltipCurH = fh / scaleY UiPop() end } for k, v in pairs(params) do -- skip this fields to support legacy code if k ~= "x" and k ~= "y" then obj[k] = v end end UiDrawLater(obj) end function sliderBehaviourUpdate(p1, isInFocus) local newSliderp1Value = roundMultiple(p1.rawVal * p1.span, p1.step) + p1.minVal newSliderp1Value = clamp(newSliderp1Value, p1.minVal, p1.maxVal) if newSliderp1Value ~= p1.currentVal then p1.currentVal = newSliderp1Value p1:onValueChanged() end local waitTime = 0.5 local repeatPeriod = 0.05 if isInFocus and InputPressed("menu_right") then UiNavSkipUpdate() p1.currentVal = p1.currentVal + p1.step p1.currentVal = clamp(p1.currentVal, p1.minVal, p1.maxVal) p1:onValueChanged() p1.rightIsPressed = true p1.leftIsPressed = false p1.waitStartTime = GetTime() end if isInFocus and p1.rightIsPressed and InputDown("menu_right") then UiNavSkipUpdate() if GetTime() - p1.waitStartTime > waitTime and not p1.repeatEvent then p1.repeatEvent = true p1.waitStartTime = GetTime() p1.currentVal = p1.currentVal + p1.step p1.currentVal = clamp(p1.currentVal, p1.minVal, p1.maxVal) p1:onValueChanged() end if p1.repeatEvent then if GetTime() - p1.waitStartTime > repeatPeriod then p1.waitStartTime = GetTime() p1.currentVal = p1.currentVal + p1.step p1.currentVal = clamp(p1.currentVal, p1.minVal, p1.maxVal) p1:onValueChanged() end end elseif not isInFocus or (p1.rightIsPressed and not InputDown("menu_right")) then p1.rightIsPressed = false p1.repeatEvent = false end if isInFocus and InputPressed("menu_left") then UiNavSkipUpdate() p1.currentVal = p1.currentVal - p1.step p1.currentVal = clamp(p1.currentVal, p1.minVal, p1.maxVal) p1:onValueChanged() p1.rightIsPressed = false p1.leftIsPressed = true p1.waitStartTime = GetTime() end if isInFocus and p1.leftIsPressed and InputDown("menu_left") then UiNavSkipUpdate() if GetTime() - p1.waitStartTime > waitTime and not p1.repeatEvent then p1.repeatEvent = true p1.waitStartTime = GetTime() p1.currentVal = p1.currentVal - p1.step p1.currentVal = clamp(p1.currentVal, p1.minVal, p1.maxVal) p1:onValueChanged() end if p1.repeatEvent then if GetTime() - p1.waitStartTime > repeatPeriod then p1.waitStartTime = GetTime() p1.currentVal = p1.currentVal - p1.step p1.currentVal = clamp(p1.currentVal, p1.minVal, p1.maxVal) p1:onValueChanged() end end elseif not isInFocus or (p1.leftIsPressed and not InputDown("menu_left")) then p1.leftIsPressed = false p1.repeatEvent = false end p1.rawVal = (p1.currentVal - p1.minVal) / p1.span end local function drawVerticalSlider(config, value, height, range) local thikness = config.barThickness or 8 local barBorder = config.barBorder or 3 local backgroundBorder = config.backgroundBorder or 4 local offset = config.extend or 2 local barOffset = config.thumbWidth / 2 local fullThikness = config.barThickness + offset * 2 local usefulArea = height - offset * 3 local thumbOffset = Remap(value, 0, range, 0, usefulArea) UiPush() UiAlign("top center") Ui.ColorFilter(config.backgroundColor or 0xFFFFFF) UiImageBox(config.background, fullThikness, height, backgroundBorder, backgroundBorder) Ui.ColorFilter(config.barColor or 0xFFFFFF) UiTranslate(0, offset + barOffset + thumbOffset) UiAlign("center middle") UiImageBox(config.thumb, config.thumbWidth, config.thumbHeight) UiTranslate(0, -barOffset - thumbOffset) UiAlign("left middle") UiImageBox(config.bar, thikness, barOffset + thumbOffset, barBorder, barBorder) UiTranslate(0, barOffset) if InputDown("lmb") and config.active then local _, my = UiGetMousePos() value = Remap(my, 0, usefulArea, 0, range) end UiPop() return value end local function drawHorizontalSlider(config, value, width, range) local thikness = config.barThickness or 8 local barBorder = config.barBorder or 3 local backgroundBorder = config.backgroundBorder or 4 local offset = config.extend or 2 local barOffset = config.thumbWidth / 2 local fullThikness = config.barThickness + offset * 2 local usefulArea = width - offset * 3 local thumbOffset = Remap(value, 0, range, 0, usefulArea) UiPush() UiAlign("left middle") Ui.ColorFilter(config.backgroundColor or 0xFFFFFF) UiImageBox(config.background, width, fullThikness, backgroundBorder, backgroundBorder) Ui.ColorFilter(config.barColor or 0xFFFFFF) UiTranslate(offset + barOffset + thumbOffset, 0) UiAlign("center middle") UiImageBox(config.thumb, config.thumbWidth, config.thumbHeight) UiTranslate(-barOffset - thumbOffset, 0) UiAlign("left middle") UiImageBox(config.bar, barOffset + thumbOffset, thikness, barBorder, barBorder) UiTranslate(barOffset, 0) if InputDown("lmb") and config.active then local mx, _ = UiGetMousePos() value = Remap(mx, 0, usefulArea, 0, range) end UiPop() return value end --- @param p1 Slider --- @param config table --- @param focus boolean function Slider(p1, config, focus) local length = p1.maxVal - p1.minVal local width = config.width or not config.vertical and length or config.thumbHeight local height = config.height or not config.vertical and config.thumbWidth or length local maxValue = config.vertical and height or width local lastPosition = p1.rawVal * maxValue local current = lastPosition config.active = p1 == activeSlider UiPush() if config.vertical then current = drawVerticalSlider(config, p1.rawVal * maxValue, width, maxValue) else current = drawHorizontalSlider(config, p1.rawVal * maxValue, width, maxValue) end UiPop() if focus then p1.rawVal = current / maxValue p1.currentVal = Remap(current, 0, maxValue, p1.minVal, p1.maxVal) if lastPosition ~= current then p1:onValueChanged() end end sliderBehaviourUpdate(p1, focus) end function drawFocusedSlider(p1) UiPush() UiColorFilter(1.0, 1.0, 1.0, 1) local navId = UiNavComponent(346.0, 26.0) local isInFocus = UiIsMouseInRect(363.3, 27.3) or UiIsComponentInFocus(navId) UiIgnoreNavigation() UiColor(1, 1, 1, 1) UiPush() UiPush() UiAlign("top right") UiTranslate(40, 3.4) UiColor(1.0, 1.0, 0.49803921580314636, 1) UiFont("regular.ttf", 27) UiText(p1:indicatorGetter()) UiPop() UiTranslate(45.0, 13) if isInFocus then if InputPressed("lmb") then setActiveSlider(p1) end else setActiveSlider(nil) end if InputReleased("lmb") then setActiveSlider(nil) end Slider(p1, focusedSliderConfig, true) UiPop() UiPop() end function drawSlider(p1) UiPush() UiColorFilter(1.0, 1.0, 1.0, 1) UiNavComponent(346.0, 26.0) UiIgnoreNavigation() UiColor(1, 1, 1, 1) UiPush() UiPush() UiAlign("top right") UiTranslate(40, 3.4) UiColor(0.5291666388511658, 0.5291666388511658, 0.5291666388511658, 1) UiFont("regular.ttf", 27) UiText(p1:indicatorGetter()) UiPop() UiTranslate(45.0, 13) Slider(p1, sliderConfig, false) UiPop() UiPop() end function drawFocusedStepper(p1) -- draw frame FI519_1008_388_1316_UiSettingSwitch UiPush() UiColorFilter(1.0, 1.0, 1.0, 1) UiPush() UiTranslate(0, 4.26) local navId = UiNavComponent(340.0, 26.0) local leftArrow = "common/stepper_l_btn_I218_299_218_249_2430_49039.png" local rightArrow = "common/stepper_r_btn_I218_299_218_249_2430_49039.png" local isInFocus = UiIsMouseInRect(340.0, 26.0) or UiIsComponentInFocus(navId) UiColor(1, 1, 1, 1) UiIgnoreNavigation() UiPush() local canMoveLeft = not (p1.currentIdx <= 1 and not p1.isCyclic) if canMoveLeft then UiTranslate(0, -6) if UiImageButton(leftArrow) then UiSound("common/click.ogg") p1:onPrev() end end UiPop() if isInFocus and InputPressed("menu_left") and not (not p1.isCyclic and p1.currentIdx <= 1) then UiSound("common/click.ogg") UiNavSkipUpdate() p1:onPrev() end UiPush() UiAlign("middle center") UiPush() UiTranslate(164, 9) UiColor(1.0, 1.0, 0.5, 1) UiFont("regular.ttf", 27) UiText(p1:getCurrentValue()) UiPop() UiPop() UiTranslate(319, 0.0) UiPush() local canMoveRight = not(p1.currentIdx >= #p1.allValues and not p1.isCyclic) if canMoveRight then UiTranslate(0, -6) if UiImageButton(rightArrow) then UiSound("common/click.ogg") p1:onNext() end end UiPop() if canMoveRight and isInFocus and InputPressed("menu_right") and not (not p1.isCyclic and p1.currentIdx >= #p1.allValues) then UiSound("common/click.ogg") UiNavSkipUpdate() p1:onNext() end UiPop() UiPop() end function drawStepper(p1) -- draw frame FI519_1008_388_890_UiSettingSwitch UiPush() UiColorFilter(1.0, 1.0, 1.0, 1) UiPush() UiTranslate(0, 4.26) local navId = UiNavComponent(340.0, 26.0) local leftArrow = "common/stepper_l_btn_I218_299_218_252_2430_49022.png" local rightArrow = "common/stepper_r_btn_I218_299_218_252_2430_49022.png" local isInFocus = UiIsMouseInRect(340.0, 26.0) or UiIsComponentInFocus(navId) UiColor(1, 1, 1, 1) UiIgnoreNavigation() UiPush() local canMoveLeft = not (p1.currentIdx <= 1 and not p1.isCyclic) if canMoveLeft then UiTranslate(0, -6) if UiImageButton(leftArrow) then UiSound("common/click.ogg") p1:onPrev() end end UiPop() if canMoveLeft and isInFocus and InputPressed("menu_left") and not (not p1.isCyclic and p1.currentIdx <= 1) then UiSound("common/click.ogg") UiNavSkipUpdate() p1:onPrev() end UiPush() UiAlign("middle center") UiPush() UiTranslate(164, 9) UiColor(0.5291666388511658, 0.5291666388511658, 0.5291666388511658, 1) UiFont("regular.ttf", 27) UiText(p1:getCurrentValue()) UiPop() UiPop() UiTranslate(319, 0.0) UiPush() local canMoveRight = not(p1.currentIdx >= #p1.allValues and not p1.isCyclic) if canMoveRight then UiTranslate(0, -6) if UiImageButton(rightArrow) then UiSound("common/click.ogg") p1:onNext() end end UiPop() if canMoveRight and isInFocus and InputPressed("menu_right") and not (not p1.isCyclic and p1.currentIdx >= #p1.allValues) then UiSound("common/click.ogg") UiNavSkipUpdate() p1:onNext() end UiPop() UiPop() end function drawOptionsListItemWithSlider(p0, p1, p2) local f458_6537_item_navId = UiNavGroupBegin() UiNavGroupSize(1008.0, 50.0) local f458_6537_item_isFocued = UiReceivesInput() and (UiIsMouseInRect(1008.0, 50.0) or UiIsComponentInFocus(f458_6537_item_navId)) if f458_6537_item_isFocued then -- drawTooltip if p2 ~= nil then UiPush() UiTranslate(p2.x, p2.y) drawTooltip(p2) UiPop() end -- draw frame F458_6537_item UiPush() UiColorFilter(1.0, 1.0, 1.0, 1) UiPush() UiColor(1, 1, 1, 1) UiImageBox("common/rect_c#d9d9d9_o1.00_cr8.png", 1008.0, 50.0, 9, 9) UiPop() UiPush() UiTranslate(11.947006225585938, 15.12399215698241) UiColor(1.0, 1.0, 1.0, 0.800000011920929) UiFont("regular.ttf", 27) UiText(p0) UiPop() UiTranslate(650.0, 12.0) drawFocusedSlider(p1) UiPop() else -- draw frame F458_6537_item UiPush() UiColorFilter(1.0, 1.0, 1.0, 1) UiPush() UiTranslate(11.947006225585938, 15.12399215698241) UiColor(1.0, 1.0, 1.0, 0.800000011920929) UiFont("regular.ttf", 27) UiText(p0) UiPop() UiTranslate(650.0, 12.0) drawSlider(p1) UiPop() end UiNavGroupEnd() end function drawOptionsListItemWithStepper(p0, p1, p2) local f519_1008_item_navId = UiNavGroupBegin() UiNavGroupSize(1008.0, 50.0) local f519_1008_item_isFocued = UiReceivesInput() and (UiIsMouseInRect(1008.0, 50.0) or UiIsComponentInFocus(f519_1008_item_navId)) if f519_1008_item_isFocued then if p2 ~= nil then UiPush() UiTranslate(p2.x, p2.y) drawTooltip(p2) UiPop() end -- draw frame F519_1008_item UiPush() if p1.canChange == nil or p1.canChange then UiColorFilter(1.0, 1.0, 1.0, 1) else UiColorFilter(1.0, 1.0, 1.0, 0.5) end UiPush() UiColor(1, 1, 1, 1) UiImageBox("common/rect_c#d9d9d9_o1.00_cr8.png", 1008.0, 50.0, 9, 9) UiPop() UiPush() UiTranslate(11.947006225585938, 15.12399215698241) UiColor(1.0, 1.0, 1.0, 0.800000011920929) UiFont("regular.ttf", 27) UiText(p0) UiPop() UiTranslate(665.0, 12.0) drawFocusedStepper(p1) UiPop() else -- draw frame F519_1008_item UiPush() if p1.canChange == nil or p1.canChange then UiColorFilter(1.0, 1.0, 1.0, 1) else UiColorFilter(1.0, 1.0, 1.0, 0.5) end UiPush() UiTranslate(11.947006225585938, 15.12399215698241) UiColor(1.0, 1.0, 1.0, 0.800000011920929) UiFont("regular.ttf", 27) UiText(p0) UiPop() UiTranslate(665.0, 12.0) drawStepper(p1) UiPop() end UiNavGroupEnd() end WarningView = { w = 440, h = 230, horizontalPadding = 30, verticalPadding = 20, hintWidth = 410, acceptButtonColor = 0xE63B3BFF, acceptButtonWidth = 182, draw = function(self, params) UiPush() UiAlign("top left") UiColor(1, 1, 1, 1) UiTranslateToScreenCenter(-self.w / 2, 0) UiTranslateToScreenMiddle(0, -self.h / 2) UiWindow(self.w, self.h) UiColorFilter(1.0, 1.0, 1.0, 1) UiPush() UiColor(1, 1, 1, 1) UiImageBox("common/rect_c#000_o0.55_cr8.png", self.w, self.h, 9, 9) UiPop() UiBeginFrame() UiBeginFrame() -- warning icon UiPush() local iconSize = 54 UiColor(1, 1, 1, 1) UiTranslateToScreenCenter(-iconSize / 2, self.horizontalPadding) UiImageBox("common/img_540_1106.png", iconSize, iconSize, 0, 0) UiPop() -- warning short note UiPush() UiTranslateToScreenCenter(0, 108) UiAlign("top center") UiColor(1.0, 1.0, 1.0, 1) UiFont("bold.ttf", 36) UiText(params.note) UiPop() -- warning details UiPush() UiAlign("top center") UiTranslateToScreenCenter(0, 170) UiColor(1.0, 1.0, 1.0, 0.8) UiFont("regular.ttf", 27) UiWordWrap(self.w - self.verticalPadding * 2) UiTextAlignment(Ui.TextAlignment.Center) UiText(params.details) UiPop() local _, detailsEdge = UiEndFrame() if LastInputDevice() ~= UI_DEVICE_GAMEPAD then UiPush() local buttonsOffsetY = 30 local btnW = 182 local btnH = 40 UiTranslateToScreenCenter(-self.hintWidth / 2, 0) UiBeginFrame() UiPush() UiButtonImageBox("common/rect_c#d9d9d9_o1.00_sw1.50_sc#ffffff_so1.00_cr4.png", 6, 6, 1, 1, 1) UiTranslate(btnW + 30, detailsEdge + buttonsOffsetY) Ui.Color(Ui.Style.Color.White) UiFont("regular.ttf", 25) UiButtonHoverColor(1, 1, 0.5, 1) if UiTextButton(params.cancelButton.text, btnW, btnH) then params.cancelButton:onPressed() end UiPop() UiPush() Ui.Color(self.acceptButtonColor) UiButtonImageBox("common/rect_c#d9d9d9_o1.00_sw1.50_sc#ffffff_so1.00_cr4.png", 6, 6, hexrgb(self.acceptButtonColor)) UiTranslate(0, detailsEdge + buttonsOffsetY) UiFont("regular.ttf", 25) if UiIsMouseInRect(self.acceptButtonWidth, btnH) then UiButtonImageBox("common/rect_c#d9d9d9_o1.00_sw1.50_sc#ffffff_so1.00_cr4.png", 6, 6, 1, 1, 1) Ui.Color(Ui.Style.Color.White) UiButtonHoverColor(1, 1, 0.5, 1) end UiBeginFrame() if UiTextButton(params.acceptButton.text, btnW, btnH) then params.acceptButton:onPressed() end self.acceptButtonWidth = UiEndFrame() UiPop() self.hintWidth, _ = UiEndFrame() UiPop() else UiPush() local buttonsOffsetY = 40 UiTranslateToScreenCenter(0, detailsEdge + buttonsOffsetY) UiDrawHintsCentered({ { ico = "[[menu:menu_accept;iconsize=42,42]]", txt = params.acceptButton.text, txtColor = 0xE63B3BFF }, { ico = "[[menu:menu_cancel;iconsize=42,42]]", txt = params.cancelButton.text } }) if InputPressed("menu_accept") then params.acceptButton:onPressed() end if InputPressed("menu_cancel") then params.cancelButton:onPressed() end end local contentWidth, contentHeight = UiEndFrame() self.h = contentHeight + self.horizontalPadding self.w = contentWidth + self.verticalPadding UiPop() end } function drawGenericOptionHint(resetCallback, alternateIcons) if LastInputDevice() == UI_DEVICE_MOUSE then UiPush() UiAlign("middle center") UiColor(0.8, 0.8, 0.8, 1) UiButtonHoverColor(1.25, 1.25, 0.625, 1) UiButtonImageBox("common/rect_c#000000_o0.00_sw1.50_sc#ffffff_so0.30_cr4.png", 6, 6, 1, 1, 1) UiFont("regular.ttf", 27) if UiTextButton("loc@UI_BUTTON_RESET_TO", 271.5, 39.5) then resetCallback() end UiPop() else UiPush() UiColor(1, 1, 1, 1) local icons = {} if alternateIcons ~= nil then icons = alternateIcons else local change_ico = "[[menu:gamepad_dpad_leftright;iconsize=42,42]]" if IsRunningOnSteam() then change_ico = "[[menu:gamepad_dpad_left;iconsize=42,42]], [[menu:gamepad_dpad_right;iconsize=42,42]] " end icons = { { ico = change_ico, txt = "loc@UI_CHANGE" } } end table.insert(icons, { ico = "[[menu:interact;iconsize=42,42]]", txt = "loc@UI_BUTTON_RESET_TO" }) table.insert(icons, { ico = "[[menu:menu_cancel;iconsize=42,42]]", txt = "loc@UI_BACK" }) UiDrawHintsCentered(icons) if InputPressed("interact") then resetCallback() end UiPop() end end