--HIỆN TEXT MÔ TẢ NHIỆM VỤ TRÊN GÓC MÀN HÌNH

require "OptionScreens/MainScreen"

VLF = VLF or {}
local core = getCore()
local screenWidth = core:getScreenWidth()
local screenHeight = core:getScreenHeight()
local fontHeightSmall = getTextManager():getFontHeight(UIFont.Small)
local fontHeightMedium = getTextManager():getFontHeight(UIFont.NewMedium)
local textMng = getTextManager()

function VLF.DrawUIInfoQuest()
    local player = getPlayer();
    local qUIData = VLF.QuestUI
    if player and qUIData.ItemsAdded then
        local x = screenWidth/23
        local y = screenHeight/30
        local countTrue = 0
        for i, v in ipairs(qUIData.ItemsAdded) do
            local qID = v.item.id
            if qID and qUIData.IsShowOnScreen[qID] == true then
                local qName = v.item.name
                local qTask = v.item.task
                local isCollection, currentCollection, requestCollection = v.item.isCollection, v.item.currentCollection, v.item.requestCollection
                countTrue = countTrue + 1
                textMng:DrawString(UIFont.NewMedium, x, y, qName, 1, 1, 1, 0.9)
                y = y + fontHeightMedium
                if isCollection == true then
                    textMng:DrawString(UIFont.Small, x + 18, y, "- "..qTask.." ("..tostring(currentCollection).."/"..tostring(requestCollection)..")", 1, 1, 1, 0.9)
                else
                    textMng:DrawString(UIFont.Small, x + 18, y, "- "..qTask, 1, 1, 1, 0.9)
                end
                y = y + fontHeightSmall
            end
        end
        if countTrue == 0 then
            Events.OnPostUIDraw.Remove(VLF.DrawUIInfoQuest)
        else
            countTrue = 0
        end
            
    end
end
--Events.OnPostUIDraw.Remove(VLF.DrawUIInfoQuest)
--Events.OnPostUIDraw.Add(VLF.DrawUIInfoQuest)
