92 lines
2.5 KiB
Lua
92 lines
2.5 KiB
Lua
|
|
surface.CreateFont( "customFont2", {
|
|
font = "Verdana", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
|
|
extended = false,
|
|
size = 15,
|
|
weight = 100,
|
|
blursize = 0,
|
|
scanlines = 0,
|
|
antialias = true,
|
|
underline = false,
|
|
italic = false,
|
|
strikeout = false,
|
|
symbol = false,
|
|
rotary = false,
|
|
shadow = false,
|
|
additive = false,
|
|
outline = false,
|
|
} )
|
|
|
|
function mysplit(inputstr, sep)
|
|
if sep == nil then
|
|
sep = "%s"
|
|
end
|
|
local t={} ; i=1
|
|
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
|
|
t[i] = str
|
|
i = i + 1
|
|
end
|
|
return t
|
|
end
|
|
|
|
local net_message_box = {
|
|
setTextAndCount = function(self, text, count)
|
|
newLineCount = #mysplit(text, "\n")
|
|
self:SetTitle(" #" .. tostring(count))
|
|
self.netmsgBox:SetText(text)
|
|
W, H = self.netmsgBox:GetSize()
|
|
W, H = self.netmsgBox:GetSize()
|
|
self:SetSize(W, H + 200)
|
|
self:SizeToContents()
|
|
|
|
end,
|
|
Init = function(self)
|
|
outer_self = self
|
|
self:ShowCloseButton( false )
|
|
self:SetSize(150, 400)
|
|
self.W, self.H = self:GetSize()
|
|
self.netmsgBox = vgui.Create( "DTextEntry", self)
|
|
self.netmsgBox:SetPos( 40, 50 )
|
|
self.netmsgBox:Dock(FILL)
|
|
self.netmsgBox:SetMultiline(true);
|
|
self.netmsgBox.Paint = function(self,w,h)
|
|
draw.RoundedBox(0, 0, 0, w, h, Color(48,10,36, 255))
|
|
self:DrawTextEntryText(Color(255, 255, 255), Color(30, 130, 255), Color(255, 255, 255))
|
|
end
|
|
|
|
local closeBtn = vgui.Create( "Button", self)
|
|
closeBtn:SetSize( 14,14 )
|
|
closeBtn:SetPos(5,6)
|
|
closeBtn:SetVisible( true )
|
|
closeBtn:SetText( "" )
|
|
closeBtn.Paint = function(self,w,h)
|
|
draw.RoundedBox(5, 0, 0, w, h, Color(225,81,32, 255))
|
|
-- surface.DrawCircle( 100, 100, 50, Color(255,255,255,255) )
|
|
draw.DrawText( "x", "customFont2", w/2, -1, Color( 255,255,255, 255 ), TEXT_ALIGN_CENTER )
|
|
end
|
|
print("outer_self", outer_self)
|
|
function closeBtn:OnMousePressed()
|
|
outer_self:SetVisible(false)
|
|
outer_self:Remove()
|
|
end
|
|
|
|
end,
|
|
|
|
Paint = function(self, w, h)
|
|
draw.RoundedBox(0, 0, 0, w, h, Color(48,10,36, 255))
|
|
surface.SetDrawColor( Color( 200, 200, 200, 255 ) )
|
|
surface.DrawOutlinedRect(0,0, w-1,h-1)
|
|
surface.DrawOutlinedRect(0,0, w-1,25)
|
|
end,
|
|
Think = function(self, w, h)
|
|
if (self:IsHovered()) then
|
|
|
|
end
|
|
end
|
|
}
|
|
|
|
vgui.Register("netmessagebox", net_message_box, "DFrame")
|
|
-- net_message_box = vgui.Create("netmessagebox")
|
|
-- net_message_box:setTextAndCount("net.Start('test')\nnet.SendToServer()")
|
|
|