#include "mod_browser_logic.lua" #include "ui/ui_extensions.lua" #include "game_types.lua" function drawComponent_f542_1279_SubscribeButton_(state) -- draw frame F542_1279_SubscribeButton UiPush() UiColorFilter(1.0, 1.0, 1.0, 1) if UiIsMouseInRect(36.0, 36.0) and InputPressed("lmb") then state:onSubscribeClicked() end UiPush() UiColor(1, 1, 1, 1) UiImageBox("common/rect_c#000_o0.60_cr6.png", 36.0, 36.0, 6, 6) UiPop() UiPush() UiColor(1, 1, 1, 1) UiTranslate(7, 7) UiImageBox(state:getModStatusImage(), 22, 22, 0, 0) UiPop() UiPop() end function drawModPreview(state) state:onDraw() local w = 350 local h = 200 local gNavId = UiNavGroupBegin() UiNavGroupSize(w, h) local isFocused = UiReceivesInput() and (UiIsMouseInRect(w, h) or UiIsComponentInFocus(gNavId)) UiPush() UiAlign("top left") UiFont("regular.ttf", 48) UiColorFilter(1.0, 1.0, 1.0, 1) UiPush() if isFocused then UiColorFilter(1, 1, 0.5, 1) end UiColor(1, 1, 1, 1) UiImageBox(state:getModPreviewIcon(), w, h, 0, 0) UiPop() UiTranslate(10.0, 134.0) UiPush() UiColorFilter(1.0, 1.0, 1.0, 1) -- draw mod likes UiPush() UiColorFilter(1.0, 1.0, 1.0, 1) UiPush() UiColor(1, 1, 1, 1) UiImageBox("common/img_542_1322.png", 20, 20, 0, 0) UiPop() UiPush() UiTranslate(21.55999755859375, 2.0799804687500227) UiColor(1.0, 1.0, 1.0, 1) UiFont("regular.ttf", 24) UiText(state:getNumberOfLikesText()) UiPop() UiPop() -- draw mod name UiPush() UiTranslate(1.572998046875, 33.013991546630905) UiColor(1.0, 1.0, 1.0, 1) UiFont("bold.ttf", 27) UiText(state:getModNameText()) UiPop() UiPop() UiTranslate(0.0, -124.0) drawComponent_f542_1279_SubscribeButton_(state) UiPush() UiTranslate(284.0, 0.0) if state:getIsSubscribed() then UiColor(1, 1, 1, 1) else UiColor(0.3, 0.3, 0.3, 1) end UiFont("regular.ttf", 25) local playImg = "common/btn_542_1303.png" if not state.isPlayable then playImg = "common/btn_561_992.png" end if UiImageButton(playImg) then state.playButton:onPressed() end UiPop() UiPop() UiNavGroupEnd() end ModBrowser.listView = { listItems = {}, scrollBar = UiCreateScrollBar( { w = 8.0, h = 127.0, draw = function() UiPush() UiTranslate(2.0, 1.9999999999999982) UiColor(1, 1, 1, 1) UiImageBox("common/rect_c#ffffff_o1.00_cr3.png", 8.0, 127.0, 3, 3) UiPop() end, }, { w = 12.0, h = 700.0, draw = function(self) UiPush() UiColor(1, 1, 1, 1) UiImageBox("common/rect_c#525252_o1.00_cr4.png", 12.0, self.h, 4, 4) UiPop() end, }) } function drawComponent_f557_1122_Mod_picture_and_views_(state) -- draw frame F557_1122_Mod_picture_and_views UiPush() UiColorFilter(1.0, 1.0, 1.0, 1) UiPush() UiColor(1, 1, 1, 1) UiImageBox(state:getModPreviewImage(), 680, 276, 0, 0) UiPop() UiTranslate(10, 10) drawComponent_f542_1279_SubscribeButton_(state) UiPop() end function drawComponent_f557_1138_Frame_293_(p2) -- draw frame F557_1138_Frame_293 UiPush() UiColorFilter(1.0, 1.0, 1.0, 1) UiPush() UiColor(1, 1, 1, 1) UiImageBox("common/img_557_1139.png", 20, 20, 0, 0) UiPop() UiPush() UiTranslate(25.63800048828125, 0.38801498413090485) UiColor(1.0, 1.0, 1.0, 0.699999988079071) UiFont("regular.ttf", 27) UiText(p2) UiPop() UiPop() end function drawComponent_f557_1149_Frame_291_() -- draw frame F557_1149_Frame_291 UiPush() UiColorFilter(1.0, 1.0, 1.0, 0.5) UiPush() UiColor(1, 1, 1, 1) UiTranslate(2.63604736328125, 4.0) UiImageBox("common/img_557_1150.png", 16, 16, 0, 0) UiPop() UiPush() UiTranslate(2.0, 1.0) UiColor(1.0, 1.0, 1.0, 1) UiRect(16.0, 2.0) UiPop() UiPop() end function drawComponent_f557_1142_Frame_37165_(p3, p4) -- draw frame F557_1142_Frame_37165 UiPush() UiColorFilter(1.0, 1.0, 1.0, 1) UiPush() UiColor(1, 1, 1, 1) UiTranslate(0.0, 3.0) UiImageBox("common/img_557_1144.png", 20, 20, 0, 0) UiPop() UiPush() UiTranslate(41.881011962890625, 3.080001068115223) UiColor(1.0, 1.0, 1.0, 0.699999988079071) UiFont("regular.ttf", 27) UiText(p3) UiPop() UiTranslate(326.0, 3.0) drawComponent_f557_1149_Frame_291_() UiPush() UiTranslate(23.989990234375, 0.388014984130848) UiColor(1.0, 1.0, 1.0, 0.699999988079071) UiFont("regular.ttf", 27) UiText(p4) UiPop() UiPop() end function drawComponent_f557_1153_Frame_37161_(p5) -- draw frame F557_1153_Frame_37161 UiPush() UiColorFilter(1.0, 1.0, 1.0, 1) UiPush() UiTranslate(0.329986572265625, 3.519972991943405) UiColor(1.0, 1.0, 1.0, 0.5) UiFont("regular.ttf", 27) UiText("Type:") UiPop() UiPush() UiTranslate(61.93499755859375, 3.344008636474655) UiColor(1.0, 1.0, 1.0, 0.699999988079071) UiFont("regular.ttf", 27) UiText(p5) UiPop() UiPop() end function drawComponent_f557_1157_Frame_37162_(p6) -- draw frame F557_1157_Frame_37162 UiPush() UiColorFilter(1.0, 1.0, 1.0, 1) UiPush() UiTranslate(0.93499755859375, 3.344008636474655) UiColor(1.0, 1.0, 1.0, 0.5) UiFont("regular.ttf", 27) UiText("Category:") UiPop() UiPush() UiTranslate(104.8809814453125, 3.519972991943405) UiColor(1.0, 1.0, 1.0, 0.699999988079071) UiFont("regular.ttf", 27) UiText(p6) UiPop() UiPop() end function drawComponent_f557_1160_Likes_and_dislikes_(p7) -- draw frame F557_1160_Likes_and_dislikes UiPush() UiColorFilter(1.0, 1.0, 1.0, 1) UiPush() UiTranslate(22.55999755859375, 1.0799804687500227) UiColor(1.0, 1.0, 1.0, 1) UiFont("regular.ttf", 24) UiText(p7) UiPop() UiPush() UiColor(1, 1, 1, 1) UiImageBox("common/img_557_1163.png", 20, 20, 0, 0) UiPop() UiPop() end function drawComponent_f557_1174_Likes_and_dislikes_(p8) -- draw frame F557_1174_Likes_and_dislikes UiPush() UiColorFilter(1.0, 1.0, 1.0, 1) UiPush() UiTranslate(20.55999755859375, 1.0799804687500227) UiColor(1.0, 1.0, 1.0, 1) UiFont("regular.ttf", 24) UiText(p8) UiPop() UiPush() UiColor(1, 1, 1, 1) UiImageBox("common/img_557_1177.png", 20, 20, 0, 0) UiPop() UiPop() end function drawComponent_f557_1275_Like_(state) -- draw frame F557_1275_Like UiPush() UiColorFilter(1.0, 1.0, 1.0, 0.30000001192092896) if UiIsMouseInRect(20.0, 20.0) and InputPressed("lmb") then state:onLikeClicked() end UiPush() UiColor(1, 1, 1, 1) UiTranslate(0.0, 1.0) UiImageBox("common/img_557_1276.png", 20, 18, 0, 0) UiPop() UiPop() end function drawComponent_f557_1260_Likes_and_dislikes_(state) -- draw frame F557_1260_Likes_and_dislikes UiPush() UiColorFilter(1.0, 1.0, 1.0, 1) UiPush() UiTranslate(23.55999755859375, 1.0799804687500227) UiColor(1.0, 1.0, 1.0, 1) UiFont("regular.ttf", 24) UiText(state:getNumberOfLikesText()) UiPop() drawComponent_f557_1275_Like_(state) UiPop() end function drawComponent_f557_1136_Date_and_User_(state) -- draw frame F557_1136_Date_and_User UiPush() UiColorFilter(1.0, 1.0, 1.0, 1) UiTranslate(362.0, 52.0) drawComponent_f557_1138_Frame_293_(state:getLastUpdateDateText()) UiTranslate(-349.0, -42.0) drawComponent_f557_1142_Frame_37165_(state:getAuthorNameText(), state:getCreationDateText()) UiTranslate(0.0, 80.0) drawComponent_f557_1153_Frame_37161_(state:getModTypeText()) UiTranslate(160.0, 0.0) drawComponent_f557_1157_Frame_37162_(state:getModCategoryText()) UiTranslate(79.0, -38.0) drawComponent_f557_1160_Likes_and_dislikes_(state:getNumberOfViewsText()) UiTranslate(-128.0, 0.0) drawComponent_f557_1174_Likes_and_dislikes_(state:getModSizeText()) UiTranslate(-111.0, 0.0) drawComponent_f557_1260_Likes_and_dislikes_(state) UiPop() end function drawModDetails(state) -- draw frame F557_1116_mod_desc UiPush() UiAlign("top left") UiFont("regular.ttf", 48) UiColorFilter(1.0, 1.0, 1.0, 1) UiPush() UiColor(1, 1, 1, 1) UiImageBox("common/rect_c#000_o0.60_cr9.png", 680.0, 822.0, 9, 9) UiPop() UiPush() UiTranslate(14.930511474609375, 12.698995208740229) UiColor(1.0, 1.0, 0.49803921580314636, 1) UiFont("bold.ttf", 33) UiPush() UiWordWrap(654.0) UiText(state:getModNameText()) UiPop() UiPop() UiTranslate(0.0, 52.0) drawComponent_f557_1122_Mod_picture_and_views_(state) UiPush() UiButtonImageBox("common/rect_c#d9d9d9_o1.00_sw1.50_sc#ffffff_so1.00_cr4.png", 6, 6, 1, 1, 1) UiTranslate(229.25, 697.25) UiColor(1.0, 1.0, 1.0, 1) UiFont("regular.ttf", 25) if UiTextButton(state.subscribeButton.text, 221.5, 39.5) then state.subscribeButton:onPressed() end UiPop() UiTranslate(0.0, 276.0) drawComponent_f557_1136_Date_and_User_(state) UiPush() UiTranslate(14.29998779296875, 159.83999023437502) UiColor(1.0, 1.0, 1.0, 0.6000000238418579) UiFont("regular.ttf", 24) UiWordWrap(600) UiText(state:getModDetailedDescriptionText()) UiPop() UiPop() end ModBrowser:init() ModBrowser.onDraw = function(self) self.listView.listItems = {} local count = UiGetModsNumber(ModsType.PROS) for i=1, count do local s = ModPreviewItemState:new() s.prosShortInfo = UiGetProsModAt(i) local obj = { w = 350, h = 200, modInfo = s, draw = function(self) drawModPreview(self.modInfo) end} table.insert(self.listView.listItems, obj) end local selectedItem = self.listView.scrollBar.lastSelectedItem if (selectedItem ~= nil and selectedItem.modInfo:getId() ~= self.currentModInfo:getId()) then self.currentModInfo = selectedItem.modInfo UiSelectProsMod(self.currentModInfo:getId()) end self.currentModInfo.prosDetailedInfo = UiSelectedProsModInfo() if InputPressed("menu_cancel") or (not UiIsMouseInRect(1100, 800) and InputPressed("lmb")) then SetValue("gModBrowserScale", 0, "cosine", 0.25) end end function drawModBrowser() UiPush() UiTranslate(499.0, 100.0) ModBrowser:onDraw() UiPush() UiList(350, 700, ModBrowser.listView.listItems, ModBrowser.listView.scrollBar) UiPop() UiTranslate(400, 0) drawModDetails(ModBrowser.currentModInfo) UiPop() end