mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 05:43:46 +03:00
Upload
This commit is contained in:
129
gamemodes/ixhl2rp/plugins/cid/derma/cl_cidselector.lua
Normal file
129
gamemodes/ixhl2rp/plugins/cid/derma/cl_cidselector.lua
Normal file
@@ -0,0 +1,129 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
local PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
if ix.gui.cidSelector then
|
||||
ix.gui.cidSelector:Remove()
|
||||
end
|
||||
|
||||
ix.gui.cidSelector = self
|
||||
|
||||
self:SetSize(ScrW(), ScrH())
|
||||
self:SetAlpha(0)
|
||||
self:AlphaTo(255, 0.5, 0)
|
||||
self.Paint = function(self, w, h)
|
||||
surface.SetDrawColor(Color(63, 58, 115, 220))
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
|
||||
Derma_DrawBackgroundBlur( self, 1 )
|
||||
end
|
||||
|
||||
self.innerContent = self:Add("Panel")
|
||||
self.innerContent:SetSize(SScaleMin(500 / 3), SScaleMin(50 / 3))
|
||||
self.innerContent:Center()
|
||||
self.innerContent:MakePopup()
|
||||
self.innerContent.Paint = function(self, w, h)
|
||||
surface.SetDrawColor(0, 0, 0, 130)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
Schema:AllowMessage(self.innerContent)
|
||||
|
||||
self:CreateTopBar()
|
||||
self:CreateSelector()
|
||||
end
|
||||
|
||||
function PANEL:CreateTopBar()
|
||||
local topbar = self.innerContent:Add("Panel")
|
||||
topbar:SetSize(self.innerContent:GetWide(), SScaleMin(50 / 3))
|
||||
topbar:Dock(TOP)
|
||||
topbar.Paint = function( self, w, h )
|
||||
surface.SetDrawColor(0, 0, 0, 130)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
local titleText = topbar:Add("DLabel")
|
||||
titleText:SetFont("CharCreationBoldTitleNoClamp")
|
||||
titleText:Dock(LEFT)
|
||||
titleText:SetText("Which CID do you want to use?")
|
||||
titleText:DockMargin(SScaleMin(10 / 3), 0, 0, 0)
|
||||
titleText:SetContentAlignment(4)
|
||||
titleText:SizeToContents()
|
||||
|
||||
local exit = topbar:Add("DImageButton")
|
||||
exit:SetImage("willardnetworks/tabmenu/navicons/exit.png")
|
||||
exit:SetSize(SScaleMin(20 / 3), SScaleMin(20 / 3))
|
||||
exit:DockMargin(0, SScaleMin(15 / 3), SScaleMin(10 / 3), SScaleMin(15 / 3))
|
||||
exit:Dock(RIGHT)
|
||||
exit.DoClick = function()
|
||||
if self.ExitCallback then
|
||||
self.ExitCallback()
|
||||
end
|
||||
|
||||
self:Remove()
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
end
|
||||
|
||||
local function createDivider(parent)
|
||||
parent:SetSize(1, topbar:GetTall())
|
||||
parent:Dock(RIGHT)
|
||||
parent:DockMargin(0, SScaleMin(10 / 3), SScaleMin(10 / 3), SScaleMin(10 / 3))
|
||||
parent.Paint = function(self, w, h)
|
||||
surface.SetDrawColor(Color(111, 111, 136, (255 / 100 * 30)))
|
||||
surface.DrawLine(0, 0, 0, h)
|
||||
end
|
||||
end
|
||||
|
||||
local divider = topbar:Add("Panel")
|
||||
createDivider(divider)
|
||||
end
|
||||
|
||||
function PANEL:CreateSelector()
|
||||
local selectorPanel = self.innerContent:Add("DScrollPanel")
|
||||
selectorPanel:Dock(FILL)
|
||||
|
||||
local character = LocalPlayer():GetCharacter()
|
||||
local inventoryItems = character:GetInventory():GetItemsByUniqueID("id_card")
|
||||
|
||||
for k, v in pairs(inventoryItems) do
|
||||
local cidButton = selectorPanel:Add("DButton")
|
||||
local cidName = v:GetData("name") or ""
|
||||
local cid = v:GetData("cid") or ""
|
||||
|
||||
cidButton:Dock(TOP)
|
||||
cidButton:SetTall(SScaleMin(50 / 3))
|
||||
cidButton:DockMargin(SScaleMin(50 / 3), k == 1 and SScaleMin(10 / 3) or 0, SScaleMin(50 / 3), SScaleMin(10 / 3))
|
||||
cidButton:SetFont("MenuFontNoClamp")
|
||||
cidButton:SetText(cidName.." | "..cid.." | "..v:GetData("cardNumber"))
|
||||
cidButton.Paint = function( self, w, h )
|
||||
surface.SetDrawColor(0, 0, 0, 130)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
cidButton.DoClick = function()
|
||||
self:AlphaTo(0, 0.5, 0)
|
||||
timer.Simple(0.5, function()
|
||||
if self.SelectCallback then
|
||||
self.SelectCallback(v:GetID(), cid, cidName, self.activeEntity)
|
||||
end
|
||||
|
||||
self:Remove()
|
||||
end)
|
||||
end
|
||||
|
||||
self.innerContent:SetTall(math.Clamp(self.innerContent:GetTall() + cidButton:GetTall() + (k == 1 and SScaleMin(10 / 3) or 0) + SScaleMin(10 / 3), 0, SScaleMin(600 / 3)))
|
||||
self.innerContent:Center()
|
||||
end
|
||||
end
|
||||
|
||||
vgui.Register("CIDSelector", PANEL, "EditablePanel")
|
||||
182
gamemodes/ixhl2rp/plugins/cid/derma/cl_transactionlog.lua
Normal file
182
gamemodes/ixhl2rp/plugins/cid/derma/cl_transactionlog.lua
Normal file
@@ -0,0 +1,182 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
local PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
self:SetSize(SScaleMin(1179 / 3), SScaleMin(1116 / 3))
|
||||
self:MakePopup()
|
||||
self:Center()
|
||||
|
||||
Schema:AllowMessage(self)
|
||||
|
||||
self.content = self:Add("DScrollPanel")
|
||||
self.content:SetSize(SScaleMin(800 / 3), SScaleMin(740 / 3))
|
||||
self.content:Center()
|
||||
|
||||
self.contentPanels = {}
|
||||
|
||||
local topPanel = self.content:Add("Panel")
|
||||
topPanel:Dock(TOP)
|
||||
topPanel:SetTall(SScaleMin(32 / 3))
|
||||
topPanel.Paint = function(this, w, h)
|
||||
self:DrawBottomLine(w, h)
|
||||
end
|
||||
|
||||
local title = topPanel:Add("DLabel")
|
||||
title:Dock(LEFT)
|
||||
title:SetText("GENERIC TRANSACTION LOG")
|
||||
title:SetFont("LargerTitlesFontNoClamp")
|
||||
title:SizeToContents()
|
||||
|
||||
local exit = topPanel:Add("DButton")
|
||||
exit:Dock(RIGHT)
|
||||
exit:SetWide(SScaleMin(24 / 3))
|
||||
exit:DockMargin(0, SScaleMin(4 / 3), 0, SScaleMin(4 / 3))
|
||||
exit:SetText("")
|
||||
exit.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(color_white)
|
||||
surface.SetMaterial(ix.util.GetMaterial("willardnetworks/tabmenu/navicons/exit.png"))
|
||||
surface.DrawTexturedRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
exit.DoClick = function()
|
||||
self:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:DrawBottomLine(w, h)
|
||||
surface.SetDrawColor(color_white)
|
||||
surface.DrawLine(0, h - 1, w, h - 1)
|
||||
end
|
||||
|
||||
function PANEL:CreateContentPanel(height, bShouldCreateBottomLine)
|
||||
local contentPanel = self.content:Add("Panel")
|
||||
contentPanel:Dock(TOP)
|
||||
contentPanel:SetTall(height)
|
||||
|
||||
if bShouldCreateBottomLine then
|
||||
contentPanel.Paint = function(this, w, h)
|
||||
self:DrawBottomLine(w, h)
|
||||
end
|
||||
end
|
||||
|
||||
self.contentPanels[#self.contentPanels + 1] = contentPanel
|
||||
|
||||
return contentPanel
|
||||
end
|
||||
|
||||
function PANEL:CreateContent(data, bShowReadButton)
|
||||
if (data and !table.IsEmpty(data)) then
|
||||
for _, tData in pairs(data) do
|
||||
local transPanel = self:CreateContentPanel(SScaleMin(140 / 3), true)
|
||||
|
||||
-- LEFT SIDE
|
||||
local leftPanel = transPanel:Add("Panel")
|
||||
transPanel.leftPanel = leftPanel
|
||||
leftPanel:SetTall(transPanel:GetTall())
|
||||
leftPanel:Dock(LEFT)
|
||||
leftPanel.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(color_white)
|
||||
surface.DrawLine(w, 1, w, h - 1)
|
||||
end
|
||||
|
||||
leftPanel.datePanel = self:CreateText(leftPanel, os.date("%d/%m/%y", tData.datetime), TOP, 4)
|
||||
leftPanel.datePanel:SetTall(SScaleMin(50 / 3))
|
||||
leftPanel.timePanel = self:CreateText(leftPanel, os.date("%H:%M:%S", tData.datetime), TOP, 4)
|
||||
|
||||
if (bShowReadButton) then
|
||||
leftPanel.readUnRead = leftPanel:Add("DButton")
|
||||
leftPanel.readUnRead:Dock(FILL)
|
||||
leftPanel.readUnRead:SetText(tonumber(tData.read) == 1 and "READ" or "UNREAD")
|
||||
leftPanel.readUnRead:SetFont("TitlesFontNoClamp")
|
||||
leftPanel.readUnRead:SizeToContents()
|
||||
leftPanel.readUnRead:SetContentAlignment(4)
|
||||
leftPanel.readUnRead.Paint = nil
|
||||
leftPanel.readUnRead.DoClick = function()
|
||||
if (tData.read == 1) then
|
||||
tData.read = 0
|
||||
else
|
||||
tData.read = 1
|
||||
end
|
||||
leftPanel.readUnRead:SetText(tonumber(tData.read) == 1 and "READ" or "UNREAD")
|
||||
netstream.Start("ixTransactionSetRead", tData.id, false, tData.read == 1, tData.pos)
|
||||
end
|
||||
end
|
||||
leftPanel:SetWidth(SScaleMin(90 / 3))
|
||||
|
||||
-- RIGHT SIDE
|
||||
local rightPanel = transPanel:Add("Panel")
|
||||
transPanel.rightPanel = rightPanel
|
||||
rightPanel:Dock(FILL)
|
||||
-- INFO ROW
|
||||
rightPanel.transInfoPanel = rightPanel:Add("Panel")
|
||||
rightPanel.transInfoPanel:Dock(TOP)
|
||||
rightPanel.transInfoPanel:SetTall(SScaleMin(50 / 3))
|
||||
self:CreateText(rightPanel.transInfoPanel, tData.sender_name.." | CID: "..tData.sender_cid, LEFT, 4, Color(171, 27, 27, 255))
|
||||
self:CreateText(rightPanel.transInfoPanel, "➔", FILL, 5, Color(169, 171, 27, 255))
|
||||
self:CreateText(rightPanel.transInfoPanel, tData.receiver_name.." | CID: "..tData.receiver_cid, RIGHT, 6, Color(63, 171, 27, 255))
|
||||
-- AMOUNT ROW
|
||||
rightPanel.descPanel = rightPanel:Add("Panel")
|
||||
rightPanel.descPanel:Dock(TOP)
|
||||
rightPanel.descPanel.amountLabel = self:CreateText(rightPanel.descPanel, "AMOUNT: "..tData.amount.." ", RIGHT, 6, Color(169, 171, 27, 255))
|
||||
rightPanel.descPanel.amountLabel:DockMargin(0, 0, 0, SScaleMin(5 / 3))
|
||||
rightPanel.descPanel.reasonLabel = self:CreateText(rightPanel.descPanel, "REASON: ", LEFT, 5, Color(169, 171, 27, 255))
|
||||
rightPanel.descPanel.reasonLabel:DockMargin(0, 0, 0, SScaleMin(5 / 3))
|
||||
rightPanel.descPanel:SetTall(rightPanel.descPanel.amountLabel:GetTall())
|
||||
|
||||
rightPanel.reasonPanel = rightPanel:Add("Panel")
|
||||
rightPanel.reasonPanel:Dock(TOP)
|
||||
rightPanel.reasonPanel:SetTall(SScaleMin(50 / 3))
|
||||
rightPanel.reasonPanel:DockMargin(0, SScaleMin(10 / 3), 0, 0)
|
||||
rightPanel.reasonPanel.reasonTextEntry = rightPanel.reasonPanel:Add("DTextEntry")
|
||||
rightPanel.reasonPanel.reasonTextEntry:Dock(FILL)
|
||||
rightPanel.reasonPanel.reasonTextEntry:SetText(tData.reason)
|
||||
rightPanel.reasonPanel.reasonTextEntry:SetEditable(true)
|
||||
rightPanel.reasonPanel.reasonTextEntry:SetVerticalScrollbarEnabled(true)
|
||||
rightPanel.reasonPanel.reasonTextEntry:SetMultiline(true)
|
||||
rightPanel.reasonPanel.reasonTextEntry:SetFont("MenuFontNoClamp")
|
||||
rightPanel.reasonPanel.reasonTextEntry:SetTextColor( color_white )
|
||||
rightPanel.reasonPanel.reasonTextEntry:SetCursorColor( color_white )
|
||||
rightPanel.reasonPanel.reasonTextEntry.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(20, 20, 20, 75)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
|
||||
this:DrawTextEntryText( this:GetTextColor(), this:GetHighlightColor(), this:GetCursorColor() )
|
||||
end
|
||||
|
||||
-- Because scrollbar won't be useable unless textentry is editable thanks derma
|
||||
local coverForTextEntry = rightPanel.reasonPanel:Add("Panel")
|
||||
coverForTextEntry:Dock(FILL)
|
||||
coverForTextEntry:DockMargin(0, 0, 19, 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:CreateText(parent, text, dock, contentAlignment, color)
|
||||
local label = parent:Add("DLabel")
|
||||
label:Dock(dock)
|
||||
label:SetText(text or "")
|
||||
label:SetFont("TitlesFontNoClamp")
|
||||
label:SetTextColor(color or color_white)
|
||||
label:SetContentAlignment(contentAlignment)
|
||||
label:SizeToContents()
|
||||
|
||||
return label
|
||||
end
|
||||
|
||||
function PANEL:Paint(w, h)
|
||||
surface.SetDrawColor(color_white)
|
||||
surface.SetMaterial(Material("willardnetworks/posterminal.png"))
|
||||
surface.DrawTexturedRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
vgui.Register("ixCIDTransactionLog", PANEL, "EditablePanel")
|
||||
Reference in New Issue
Block a user