Fix: language of the cl_report_bug

This commit is contained in:
Linventif 2024-11-14 16:06:31 +00:00
parent 34d22baab9
commit f361bd884a

View File

@ -1,4 +1,46 @@
local Fields = {
local ScreenshotRequested = false
local contextMenuOpen = false
hook.Add("OnContextMenuOpen", "gmInte:BugReport:ContextMenu:Open", function() contextMenuOpen = true end)
hook.Add("OnContextMenuClose", "gmInte:BugReport:ContextMenu:Close", function() contextMenuOpen = false end)
hook.Add("HUDPaint", "gmInte:BugReport:Screenshot", function()
if !ScreenshotRequested then return end
if !contextMenuOpen then return end
surface.SetDrawColor(230, 230, 230)
surface.DrawRect(0, 0, ScrW(), 3)
surface.DrawRect(0, 0, 3, ScrH())
surface.DrawRect(ScrW() - 3, 0, 3, ScrH())
surface.DrawRect(0, ScrH() - 3, ScrW(), 3)
surface.DrawRect(ScrW() / 2 - 10, ScrH() / 2 - 1, 20, 2)
surface.DrawRect(ScrW() / 2 - 1, ScrH() / 2 - 10, 2, 20)
surface.SetDrawColor(0, 0, 0, 50)
surface.DrawRect(0, 0, ScrW(), ScrH())
draw.SimpleText(gmInte.getTranslation("report_bug.context_menu.screen_capture", "Close the context menu to take the screenshot to use in the bug report."), "Trebuchet24", ScrW() / 2, ScrH() / 2 + 40, Color(255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
end)
local screenCapture = nil
local screenFileID = nil
local captureData = nil
hook.Add("PostRender", "gmInte:BugReport:Screenshot", function()
if !ScreenshotRequested then return end
if contextMenuOpen then return end
captureData = {
format = "jpeg",
x = 0,
y = 0,
w = ScrW(),
h = ScrH(),
quality = 95,
}
screenCapture = render.Capture(captureData)
ScreenshotRequested = false
gmInte.showScreenshotInfo = false
if !file.Exists("gmod_integration/report_bug", "DATA") then file.CreateDir("gmod_integration/report_bug") end
if screenCapture then file.Write("gmod_integration/report_bug/" .. screenFileID .. ".jpeg", screenCapture) end
end)
local function openReportBug()
local Fields = {
{
["title"] = gmInte.getTranslation("report_bug.screenshot", "Screenshot"),
["type"] = "image",
@ -53,50 +95,8 @@ local Fields = {
["dsc"] = gmInte.getTranslation("report_bug.actual_result.dsc", "What actually happened?"),
["tall"] = 50,
},
}
local ScreenshotRequested = false
local contextMenuOpen = false
hook.Add("OnContextMenuOpen", "gmInte:BugReport:ContextMenu:Open", function() contextMenuOpen = true end)
hook.Add("OnContextMenuClose", "gmInte:BugReport:ContextMenu:Close", function() contextMenuOpen = false end)
hook.Add("HUDPaint", "gmInte:BugReport:Screenshot", function()
if !ScreenshotRequested then return end
if !contextMenuOpen then return end
surface.SetDrawColor(230, 230, 230)
surface.DrawRect(0, 0, ScrW(), 3)
surface.DrawRect(0, 0, 3, ScrH())
surface.DrawRect(ScrW() - 3, 0, 3, ScrH())
surface.DrawRect(0, ScrH() - 3, ScrW(), 3)
surface.DrawRect(ScrW() / 2 - 10, ScrH() / 2 - 1, 20, 2)
surface.DrawRect(ScrW() / 2 - 1, ScrH() / 2 - 10, 2, 20)
surface.SetDrawColor(0, 0, 0, 50)
surface.DrawRect(0, 0, ScrW(), ScrH())
draw.SimpleText(gmInte.getTranslation("report_bug.context_menu.screen_capture", "Close the context menu to take the screenshot to use in the bug report."), "Trebuchet24", ScrW() / 2, ScrH() / 2 + 40, Color(255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
end)
local screenCapture = nil
local screenFileID = nil
local captureData = nil
hook.Add("PostRender", "gmInte:BugReport:Screenshot", function()
if !ScreenshotRequested then return end
if contextMenuOpen then return end
captureData = {
format = "jpeg",
x = 0,
y = 0,
w = ScrW(),
h = ScrH(),
quality = 95,
}
screenCapture = render.Capture(captureData)
ScreenshotRequested = false
gmInte.showScreenshotInfo = false
if !file.Exists("gmod_integration/report_bug", "DATA") then file.CreateDir("gmod_integration/report_bug") end
if screenCapture then file.Write("gmod_integration/report_bug/" .. screenFileID .. ".jpeg", screenCapture) end
end)
local function openReportBug()
local frame = vgui.Create("DFrame")
frame:SetSize(500, (700 / 1080) * ScrH())
frame:Center()