add sborka
This commit is contained in:
@@ -0,0 +1,270 @@
|
||||
--[[
|
||||
|
||||
3D2D VGUI Wrapper
|
||||
Copyright (c) 2015-2017 Alexander Overvoorde, Matt Stevens
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
]]--
|
||||
|
||||
if SERVER then return end
|
||||
|
||||
local origin = Vector(0, 0, 0)
|
||||
local angle = Angle(0, 0, 0)
|
||||
local normal = Vector(0, 0, 0)
|
||||
local scale = 0
|
||||
local maxrange = 0
|
||||
|
||||
-- Helper functions
|
||||
|
||||
local function getCursorPos()
|
||||
local p = util.IntersectRayWithPlane(LocalPlayer():EyePos(), LocalPlayer():GetAimVector(), origin, normal)
|
||||
|
||||
-- if there wasn't an intersection, don't calculate anything.
|
||||
if not p then return end
|
||||
if WorldToLocal(LocalPlayer():GetShootPos(), Angle(0,0,0), origin, angle).z < 0 then return end
|
||||
|
||||
if maxrange > 0 then
|
||||
if p:Distance(LocalPlayer():EyePos()) > maxrange then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
local pos = WorldToLocal(p, Angle(0,0,0), origin, angle)
|
||||
|
||||
return pos.x, -pos.y
|
||||
end
|
||||
|
||||
local function getParents(pnl)
|
||||
local parents = {}
|
||||
local parent = pnl:GetParent()
|
||||
while parent do
|
||||
table.insert(parents, parent)
|
||||
parent = parent:GetParent()
|
||||
end
|
||||
return parents
|
||||
end
|
||||
|
||||
local function absolutePanelPos(pnl)
|
||||
local x, y = pnl:GetPos()
|
||||
local parents = getParents(pnl)
|
||||
|
||||
for _, parent in ipairs(parents) do
|
||||
local px, py = parent:GetPos()
|
||||
x = x + px
|
||||
y = y + py
|
||||
end
|
||||
|
||||
return x, y
|
||||
end
|
||||
|
||||
local function pointInsidePanel(pnl, x, y)
|
||||
local px, py = absolutePanelPos(pnl)
|
||||
local sx, sy = pnl:GetSize()
|
||||
|
||||
if not x or not y then return end
|
||||
|
||||
x = x / scale
|
||||
y = y / scale
|
||||
|
||||
return x >= px and y >= py and x <= px + sx and y <= py + sy --pnl:IsVisible() and x >= px and y >= py and x <= px + sx and y <= py + sy
|
||||
end
|
||||
|
||||
-- Input
|
||||
|
||||
local inputWindows = {}
|
||||
local usedpanel = {}
|
||||
|
||||
local function isMouseOver(pnl)
|
||||
return pointInsidePanel(pnl, getCursorPos())
|
||||
end
|
||||
|
||||
local function postPanelEvent(pnl, event, ...)
|
||||
if not IsValid(pnl) or not pointInsidePanel(pnl, getCursorPos()) then return false end -- not pnl:IsVisible() or not pointInsidePanel(pnl, getCursorPos()) then return false end
|
||||
|
||||
local handled = false
|
||||
|
||||
for i, child in pairs(table.Reverse(pnl:GetChildren())) do
|
||||
if postPanelEvent(child, event, ...) then
|
||||
handled = true
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if not handled and pnl[event] then
|
||||
pnl[event](pnl, ...)
|
||||
usedpanel[pnl] = {...}
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
-- Always have issue, but less
|
||||
local function checkHover(pnl, x, y, found)
|
||||
if not (x and y) then
|
||||
x, y = getCursorPos()
|
||||
end
|
||||
|
||||
local validchild = false
|
||||
for c, child in pairs(table.Reverse(pnl:GetChildren())) do
|
||||
local check = checkHover(child, x, y, found or validchild)
|
||||
|
||||
if check then
|
||||
validchild = true
|
||||
end
|
||||
end
|
||||
|
||||
if found then
|
||||
if pnl.Hovered then
|
||||
pnl.Hovered = false
|
||||
if pnl.OnCursorExited then pnl:OnCursorExited() end
|
||||
end
|
||||
else
|
||||
if not validchild and pointInsidePanel(pnl, x, y) then
|
||||
pnl.Hovered = true
|
||||
if pnl.OnCursorEntered then pnl:OnCursorEntered() end
|
||||
|
||||
return true
|
||||
else
|
||||
pnl.Hovered = false
|
||||
if pnl.OnCursorExited then pnl:OnCursorExited() end
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
-- Mouse input
|
||||
|
||||
hook.Add("KeyPress", "VGUI3D2DMousePress", function(_, key)
|
||||
if key == IN_USE then
|
||||
for pnl in pairs(inputWindows) do
|
||||
if IsValid(pnl) then
|
||||
origin = pnl.Origin
|
||||
scale = pnl.Scale
|
||||
angle = pnl.Angle
|
||||
normal = pnl.Normal
|
||||
|
||||
local key = input.IsKeyDown(KEY_LSHIFT) and MOUSE_RIGHT or MOUSE_LEFT
|
||||
|
||||
postPanelEvent(pnl, "OnMousePressed", key)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
hook.Add("KeyRelease", "VGUI3D2DMouseRelease", function(_, key)
|
||||
if key == IN_USE then
|
||||
for pnl, key in pairs(usedpanel) do
|
||||
if IsValid(pnl) then
|
||||
origin = pnl.Origin
|
||||
scale = pnl.Scale
|
||||
angle = pnl.Angle
|
||||
normal = pnl.Normal
|
||||
|
||||
if pnl["OnMouseReleased"] then
|
||||
pnl["OnMouseReleased"](pnl, key[1])
|
||||
end
|
||||
|
||||
usedpanel[pnl] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
function vgui.Start3D2D(pos, ang, res)
|
||||
origin = pos
|
||||
scale = res
|
||||
angle = ang
|
||||
normal = ang:Up()
|
||||
maxrange = 0
|
||||
|
||||
cam.Start3D2D(pos, ang, res)
|
||||
end
|
||||
|
||||
function vgui.MaxRange3D2D(range)
|
||||
maxrange = isnumber(range) and range or 0
|
||||
end
|
||||
|
||||
function vgui.IsPointingPanel(pnl)
|
||||
origin = pnl.Origin
|
||||
scale = pnl.Scale
|
||||
angle = pnl.Angle
|
||||
normal = pnl.Normal
|
||||
|
||||
return pointInsidePanel(pnl, getCursorPos())
|
||||
end
|
||||
|
||||
local Panel = FindMetaTable("Panel")
|
||||
function Panel:Paint3D2D()
|
||||
|
||||
if not self:IsValid() then return end
|
||||
|
||||
-- Add it to the list of windows to receive input
|
||||
inputWindows[self] = true
|
||||
|
||||
-- Override gui.MouseX and gui.MouseY for certain stuff
|
||||
local oldMouseX = gui.MouseX
|
||||
local oldMouseY = gui.MouseY
|
||||
local cx, cy = getCursorPos()
|
||||
|
||||
function gui.MouseX()
|
||||
return (cx or 0) / scale
|
||||
end
|
||||
function gui.MouseY()
|
||||
return (cy or 0) / scale
|
||||
end
|
||||
|
||||
-- Override think of DFrame's to correct the mouse pos by changing the active orientation
|
||||
if self.Think then
|
||||
if not self.OThink then
|
||||
self.OThink = self.Think
|
||||
|
||||
self.Think = function()
|
||||
origin = self.Origin
|
||||
scale = self.Scale
|
||||
angle = self.Angle
|
||||
normal = self.Normal
|
||||
|
||||
self:OThink()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Update the hover state of controls
|
||||
local _, tab = checkHover(self)
|
||||
|
||||
-- Store the orientation of the window to calculate the position outside the render loop
|
||||
self.Origin = origin
|
||||
self.Scale = scale
|
||||
self.Angle = angle
|
||||
self.Normal = normal
|
||||
|
||||
-- Draw it manually
|
||||
self:SetPaintedManually(false)
|
||||
self:PaintManual()
|
||||
self:SetPaintedManually(true)
|
||||
|
||||
gui.MouseX = oldMouseX
|
||||
gui.MouseY = oldMouseY
|
||||
end
|
||||
|
||||
function vgui.End3D2D()
|
||||
cam.End3D2D()
|
||||
end
|
||||
@@ -0,0 +1,44 @@
|
||||
local tabPoisonEffect = {
|
||||
[ "$pp_colour_addr" ] = 0.3,
|
||||
[ "$pp_colour_addg" ] = 0.3,
|
||||
[ "$pp_colour_addb" ] = 0,
|
||||
[ "$pp_colour_brightness" ] = 0,
|
||||
[ "$pp_colour_contrast" ] = 1,
|
||||
[ "$pp_colour_colour" ] = 0.8,
|
||||
[ "$pp_colour_mulr" ] = 0,
|
||||
[ "$pp_colour_mulg" ] = 0,
|
||||
[ "$pp_colour_mulb" ] = 0
|
||||
}
|
||||
|
||||
local tabBleedingEffect = {
|
||||
[ "$pp_colour_addr" ] = 0.0,
|
||||
[ "$pp_colour_addg" ] = 0.0,
|
||||
[ "$pp_colour_addb" ] = 0.0,
|
||||
[ "$pp_colour_brightness" ] = 0,
|
||||
[ "$pp_colour_contrast" ] = 1,
|
||||
[ "$pp_colour_colour" ] = 1,
|
||||
[ "$pp_colour_mulr" ] = 0,
|
||||
[ "$pp_colour_mulg" ] = 0,
|
||||
[ "$pp_colour_mulb" ] = 0
|
||||
}
|
||||
|
||||
function MedicMod.BleedingEffect()
|
||||
|
||||
if LocalPlayer():IsMorphine() then return end
|
||||
|
||||
tabBleedingEffect[ "$pp_colour_addr" ] = math.abs(math.sin( CurTime() * 2 )) * 0.2
|
||||
|
||||
DrawColorModify( tabBleedingEffect )
|
||||
|
||||
end
|
||||
|
||||
|
||||
function MedicMod.PoisonEffect()
|
||||
|
||||
if LocalPlayer():IsMorphine() then return end
|
||||
|
||||
DrawColorModify( tabPoisonEffect )
|
||||
DrawMotionBlur( 0.1, 0.7, 0.05 )
|
||||
|
||||
end
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
surface.CreateFont( "MedicModFont100", {
|
||||
font = "Arial",
|
||||
size = 100,
|
||||
weight = 600,
|
||||
blursize = 0,
|
||||
scanlines = 0,
|
||||
antialias = true,
|
||||
underline = false,
|
||||
italic = false,
|
||||
strikeout = false,
|
||||
symbol = false,
|
||||
rotary = false,
|
||||
shadow = false,
|
||||
additive = false,
|
||||
outline = false,
|
||||
});
|
||||
|
||||
surface.CreateFont( "MedicModFont30", {
|
||||
font = "Arial",
|
||||
size = 30,
|
||||
weight = 600,
|
||||
blursize = 0,
|
||||
scanlines = 0,
|
||||
antialias = true,
|
||||
underline = false,
|
||||
italic = false,
|
||||
strikeout = false,
|
||||
symbol = false,
|
||||
rotary = false,
|
||||
shadow = false,
|
||||
additive = false,
|
||||
outline = false,
|
||||
});
|
||||
|
||||
surface.CreateFont( "MedicModFont20", {
|
||||
font = "Arial",
|
||||
size = 20,
|
||||
weight = 600,
|
||||
blursize = 0,
|
||||
scanlines = 0,
|
||||
antialias = true,
|
||||
underline = false,
|
||||
italic = false,
|
||||
strikeout = false,
|
||||
symbol = false,
|
||||
rotary = false,
|
||||
shadow = false,
|
||||
additive = false,
|
||||
outline = false,
|
||||
});
|
||||
|
||||
surface.CreateFont( "MedicModFont17", {
|
||||
font = "Arial",
|
||||
size = 17,
|
||||
weight = 600,
|
||||
blursize = 0,
|
||||
scanlines = 0,
|
||||
antialias = true,
|
||||
underline = false,
|
||||
italic = false,
|
||||
strikeout = false,
|
||||
symbol = false,
|
||||
rotary = false,
|
||||
shadow = false,
|
||||
additive = false,
|
||||
outline = false,
|
||||
});
|
||||
|
||||
surface.CreateFont( "MedicModFont15", {
|
||||
font = "Arial",
|
||||
size = 15,
|
||||
weight = 600,
|
||||
blursize = 0,
|
||||
scanlines = 0,
|
||||
antialias = true,
|
||||
underline = false,
|
||||
italic = false,
|
||||
strikeout = false,
|
||||
symbol = false,
|
||||
rotary = false,
|
||||
shadow = false,
|
||||
additive = false,
|
||||
outline = false,
|
||||
});
|
||||
|
||||
surface.CreateFont( "MedicModFont12", {
|
||||
font = "Arial",
|
||||
size = 12,
|
||||
weight = 600,
|
||||
blursize = 0,
|
||||
scanlines = 0,
|
||||
antialias = true,
|
||||
underline = false,
|
||||
italic = false,
|
||||
strikeout = false,
|
||||
symbol = false,
|
||||
rotary = false,
|
||||
shadow = false,
|
||||
additive = false,
|
||||
outline = false,
|
||||
});
|
||||
|
||||
surface.CreateFont( "MedicModFont10", {
|
||||
font = "Arial",
|
||||
size = 10,
|
||||
weight = 600,
|
||||
blursize = 0,
|
||||
scanlines = 0,
|
||||
antialias = true,
|
||||
underline = false,
|
||||
italic = false,
|
||||
strikeout = false,
|
||||
symbol = false,
|
||||
rotary = false,
|
||||
shadow = false,
|
||||
additive = false,
|
||||
outline = false,
|
||||
});
|
||||
|
||||
surface.CreateFont( "WrittenMedicMod80", {
|
||||
font = "Written on His Hands",
|
||||
size = 80,
|
||||
weight = 1000
|
||||
} )
|
||||
|
||||
surface.CreateFont( "WrittenMedicMod40", {
|
||||
font = "Written on His Hands",
|
||||
size = 40,
|
||||
weight = 1000
|
||||
} )
|
||||
|
||||
|
||||
surface.CreateFont( "WrittenMedicMod35", {
|
||||
font = "Written on His Hands",
|
||||
size = 35,
|
||||
weight = 1000
|
||||
} )
|
||||
|
||||
surface.CreateFont("Aam::Title", {
|
||||
|
||||
font = "Trebuchet24",
|
||||
size = 36,
|
||||
weight = 350
|
||||
})
|
||||
|
||||
surface.CreateFont("Aam::Button", {
|
||||
|
||||
font = "Trebuchet24",
|
||||
size = 24,
|
||||
weight = 350
|
||||
})
|
||||
|
||||
surface.CreateFont("Aam::Normal", {
|
||||
|
||||
font = "Trebuchet24",
|
||||
size = 24,
|
||||
weight = 300
|
||||
})
|
||||
@@ -0,0 +1,255 @@
|
||||
local meta = FindMetaTable( "Player" )
|
||||
local sentences = ConfigurationMedicMod.Sentences
|
||||
local lang = ConfigurationMedicMod.Language
|
||||
|
||||
function StartMedicAnimation( ply, id )
|
||||
|
||||
if not IsValid(ply) then return end
|
||||
|
||||
if ply.mdlanim && IsValid( ply.mdlanim ) then print("model already exist, removed") ply.mdlanim:Remove() end
|
||||
|
||||
if ply:GetNWString("MedicPlayerModel") then
|
||||
|
||||
ply.mdlanim = ClientsideModel(ply:GetNWString("MedicPlayerModel"))
|
||||
|
||||
if IsValid( ply.mdlanim ) then
|
||||
ply.mdlanim:SetParent( ply )
|
||||
ply.mdlanim:AddEffects( EF_BONEMERGE )
|
||||
return ply.mdlanim
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function StopMedicAnimation( ply )
|
||||
if IsValid( ply.mdlanim ) && ply:GetMedicAnimation() == 0 then
|
||||
ply.mdlanim:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
local Background = Material( "medic/terminal/background.png" )
|
||||
|
||||
local ArrowRight = Material( "medic/terminal/arrow_right.png" )
|
||||
local ArrowLeft = Material( "medic/terminal/arrow_left.png" )
|
||||
|
||||
function MedicMod.TerminalMenu( ent )
|
||||
|
||||
local ActiveItem = 1
|
||||
|
||||
/* MAIN FRAME */
|
||||
|
||||
local _MainFrame = vgui.Create( "DPanel" )
|
||||
_MainFrame:SetSize( 750, 500 )
|
||||
_MainFrame:Center()
|
||||
_MainFrame:MakePopup()
|
||||
|
||||
_MainFrame.Paint = function( pnl, w, h )
|
||||
|
||||
/* BACKGROUND */
|
||||
|
||||
surface.SetDrawColor( 255, 255, 255 )
|
||||
surface.SetMaterial( Background )
|
||||
surface.DrawTexturedRect( 0, 0, w, h )
|
||||
|
||||
draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 225 ))
|
||||
|
||||
/* TOP */
|
||||
|
||||
draw.RoundedBox( 0, 0, 0, w, h*0.2, Color( 255, 255, 255, 10 ))
|
||||
|
||||
draw.DrawText( "Terminal", "MedicModFont17", w*0.5, h*0.065, Color( 255, 255, 255 ), 1)
|
||||
|
||||
/* BOTTOM */
|
||||
|
||||
draw.DrawText( ConfigurationMedicMod.Entities[ActiveItem].price..ConfigurationMedicMod.MoneyUnit, "Aam::Normal", w*0.5, h*0.785, Color( 255, 255, 255 ), 1)
|
||||
|
||||
draw.RoundedBox( 0, w*0.2, h*0.75, w*0.6, 2, Color( 255, 255, 255 ))
|
||||
end
|
||||
|
||||
/* SCROLL SYSTEM */
|
||||
|
||||
local ItemScrollPanel = vgui.Create("DScrollPanel", _MainFrame )
|
||||
ItemScrollPanel:SetSize( _MainFrame:GetWide()*0.6, _MainFrame:GetTall()*0.45 )
|
||||
ItemScrollPanel:SetPos( _MainFrame:GetWide()*0.2, _MainFrame:GetTall()*0.25 )
|
||||
|
||||
ItemScrollPanel:GetVBar().Paint = function()
|
||||
end
|
||||
|
||||
ItemScrollPanel:GetVBar().btnGrip.Paint = function()
|
||||
end
|
||||
|
||||
ItemScrollPanel:GetVBar().btnUp.Paint = function()
|
||||
end
|
||||
|
||||
ItemScrollPanel:GetVBar().btnDown.Paint = function()
|
||||
end
|
||||
|
||||
/* ITEM LIST */
|
||||
|
||||
local ItemsList = vgui.Create( "DIconLayout", ItemScrollPanel )
|
||||
ItemsList:SetSize( ItemScrollPanel:GetWide(), ItemScrollPanel:GetTall() )
|
||||
ItemsList:SetPos( 0, 0 )
|
||||
ItemsList:SetSpaceY( 0 )
|
||||
ItemsList:SetSpaceX( 0 )
|
||||
|
||||
ItemSlot = {}
|
||||
|
||||
for k, v in pairs( ConfigurationMedicMod.Entities ) do
|
||||
|
||||
ItemSlot[k] = vgui.Create( "DPanel", ItemsList )
|
||||
ItemSlot[k]:SetSize( ItemsList:GetWide(), ItemsList:GetTall() )
|
||||
|
||||
ItemSlot[k].Paint = function( pnl, w, h )
|
||||
|
||||
draw.DrawText( v.name, "MedicModFont17", w*0.5, h*0.1, Color( 255, 255, 255 ), 1)
|
||||
|
||||
end
|
||||
|
||||
ItemSlot[k].model = vgui.Create( "DModelPanel", ItemSlot[k] )
|
||||
ItemSlot[k].model:SetPos( 0, 100 )
|
||||
ItemSlot[k].model:SetSize( ItemsList:GetWide(), ItemsList:GetTall()-100 )
|
||||
ItemSlot[k].model:SetLookAt( Vector(0, 0, 0 ) )
|
||||
ItemSlot[k].model:SetCamPos( Vector( -50, 0, 30 ) )
|
||||
ItemSlot[k].model:SetModel( v.mdl )
|
||||
|
||||
end
|
||||
|
||||
/* LEFT */
|
||||
|
||||
local _LeftArrow = vgui.Create( "DButton", _MainFrame )
|
||||
_LeftArrow:SetSize( 50, 50 )
|
||||
_LeftArrow:SetPos( _MainFrame:GetWide()*0.1, _MainFrame:GetTall()*0.4 )
|
||||
_LeftArrow:SetText("")
|
||||
|
||||
_LeftArrow.Paint = function( pnl, w, h )
|
||||
|
||||
surface.SetDrawColor( 255, 255, 255 )
|
||||
surface.SetMaterial( ArrowLeft )
|
||||
surface.DrawTexturedRect( 0, 0, w, h )
|
||||
end
|
||||
|
||||
_LeftArrow.DoClick = function()
|
||||
|
||||
if ActiveItem == 1 then return end
|
||||
|
||||
ActiveItem = ActiveItem - 1
|
||||
|
||||
ItemScrollPanel:ScrollToChild(ItemSlot[ActiveItem])
|
||||
end
|
||||
|
||||
/* RIGHT */
|
||||
|
||||
local _RightArrow = vgui.Create( "DButton", _MainFrame )
|
||||
_RightArrow:SetSize( 50, 50 )
|
||||
_RightArrow:SetPos( _MainFrame:GetWide()*0.9 - 50, _MainFrame:GetTall()*0.4 )
|
||||
_RightArrow:SetText("")
|
||||
|
||||
_RightArrow.Paint = function( pnl, w, h )
|
||||
|
||||
surface.SetDrawColor( 255, 255, 255 )
|
||||
surface.SetMaterial( ArrowRight )
|
||||
surface.DrawTexturedRect( 0, 0, w, h )
|
||||
end
|
||||
|
||||
_RightArrow.DoClick = function()
|
||||
|
||||
if ActiveItem == table.Count( ConfigurationMedicMod.Entities ) then return end
|
||||
|
||||
ActiveItem = ActiveItem + 1
|
||||
|
||||
ItemScrollPanel:ScrollToChild(ItemSlot[ActiveItem])
|
||||
end
|
||||
|
||||
/* BUY */
|
||||
|
||||
local _BuyButton = vgui.Create( "DButton", _MainFrame )
|
||||
_BuyButton:SetSize( _MainFrame:GetWide()*0.15, _MainFrame:GetTall()*0.0725 )
|
||||
_BuyButton:SetPos( _MainFrame:GetWide()*0.5 - ( _BuyButton:GetWide() / 2 ), _MainFrame:GetTall()*0.9 )
|
||||
_BuyButton:SetText("")
|
||||
_BuyButton.Color = Color(200,200,200,255)
|
||||
|
||||
_BuyButton.Paint = function( pnl, w, h )
|
||||
|
||||
local color = _BuyButton.Color
|
||||
|
||||
draw.DrawText( sentences["Buy"][lang], "Aam::Button", w*0.5, h*0.1, color, 1)
|
||||
|
||||
if _BuyButton:IsHovered() then
|
||||
|
||||
local r = math.Clamp(color.r+10, 200, 255 )
|
||||
local g = math.Clamp(color.g+10, 200, 255 )
|
||||
local b = math.Clamp(color.b+10, 200, 255 )
|
||||
|
||||
_BuyButton.Color = Color(r,g,b,255)
|
||||
|
||||
else
|
||||
|
||||
local r = math.Clamp(color.r-5, 200, 255 )
|
||||
local g = math.Clamp(color.g-5, 200, 255 )
|
||||
local b = math.Clamp(color.b-5, 200, 255 )
|
||||
|
||||
_BuyButton.Color = Color(r,g,b,255)
|
||||
|
||||
end
|
||||
|
||||
draw.RoundedBox( 3, 0, 0, w, 2, color)
|
||||
draw.RoundedBox( 3, 0, 0, 2, h, color)
|
||||
draw.RoundedBox( 3, 0, h-2, w, 2, color)
|
||||
draw.RoundedBox( 3, w-2, 0, 2, h, color)
|
||||
end
|
||||
|
||||
_BuyButton.DoClick = function()
|
||||
|
||||
net.Start("MedicMod.BuyMedicEntity")
|
||||
net.WriteInt( ActiveItem, 32 )
|
||||
net.WriteEntity( ent )
|
||||
net.SendToServer()
|
||||
|
||||
_MainFrame:Remove()
|
||||
end
|
||||
|
||||
/* CLOSE BUTTON */
|
||||
|
||||
local _CloseButton = vgui.Create( "DButton", _MainFrame )
|
||||
_CloseButton:SetSize( _MainFrame:GetWide()*0.05, _MainFrame:GetTall()*0.0725 )
|
||||
_CloseButton:SetPos( _MainFrame:GetWide()*0.99 - ( _CloseButton:GetWide() ), _MainFrame:GetTall()*0.01 )
|
||||
_CloseButton:SetText("")
|
||||
_CloseButton.Color = Color(200,200,200,255)
|
||||
|
||||
_CloseButton.Paint = function( pnl, w, h )
|
||||
|
||||
local color = _CloseButton.Color
|
||||
|
||||
draw.DrawText( "X", "Aam::Button", w*0.5, h*0.1, color, 1)
|
||||
|
||||
if _CloseButton:IsHovered() then
|
||||
|
||||
local r = math.Clamp(color.r+10, 200, 255 )
|
||||
local g = math.Clamp(color.g+10, 200, 255 )
|
||||
local b = math.Clamp(color.b+10, 200, 255 )
|
||||
|
||||
_CloseButton.Color = Color(r,g,b,255)
|
||||
|
||||
else
|
||||
|
||||
local r = math.Clamp(color.r-5, 200, 255 )
|
||||
local g = math.Clamp(color.g-5, 200, 255 )
|
||||
local b = math.Clamp(color.b-5, 200, 255 )
|
||||
|
||||
_CloseButton.Color = Color(r,g,b,255)
|
||||
|
||||
end
|
||||
|
||||
draw.RoundedBox( 3, 0, 0, w, 2, color)
|
||||
draw.RoundedBox( 3, 0, 0, 2, h, color)
|
||||
draw.RoundedBox( 3, 0, h-2, w, 2, color)
|
||||
draw.RoundedBox( 3, w-2, 0, 2, h, color)
|
||||
end
|
||||
|
||||
_CloseButton.DoClick = function()
|
||||
|
||||
_MainFrame:Remove()
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,123 @@
|
||||
hook.Add( "CalcView", "CalcView.MedicMod", function( ply, pos, ang, fov )
|
||||
if ( !IsValid( ply ) or !ply:Alive() or ply:GetViewEntity() != ply ) then return end
|
||||
|
||||
if ply:GetMedicAnimation() != 0 then
|
||||
local view = {}
|
||||
view.origin = pos - ( ang:Forward()*20 )
|
||||
view.angles = ang
|
||||
view.fov = fov
|
||||
view.drawviewer = true
|
||||
return view
|
||||
end
|
||||
|
||||
--[[
|
||||
if ply:GetNWBool("CarryingRagdoll", false) then
|
||||
local view = {}
|
||||
local tilted = Angle(ang.p, ang.y, ang.r)
|
||||
tilted:RotateAroundAxis(ang:Forward(), 18)
|
||||
view.origin = pos
|
||||
view.angles = tilted
|
||||
view.fov = fov
|
||||
view.drawviewer = false
|
||||
return view
|
||||
end
|
||||
]]
|
||||
end)
|
||||
|
||||
hook.Add("RenderScreenspaceEffects", "RenderScreenspaceEffects.MedicMod", function()
|
||||
if LocalPlayer():IsBleeding() then
|
||||
MedicMod.BleedingEffect()
|
||||
end
|
||||
if LocalPlayer():IsPoisoned() then
|
||||
MedicMod.PoisonEffect()
|
||||
end
|
||||
end)
|
||||
|
||||
local bleedingIcon = Material("materials/bleeding.png")
|
||||
local poisonedIcon = Material("materials/poisoned.png")
|
||||
local hattackIcon = Material("materials/heart_attack_icon.png")
|
||||
local morphIcon = Material("materials/morphine_icon.png")
|
||||
local breakIcon = Material("materials/break_icon.png")
|
||||
local notifIcon = Material("materials/heart_attack_icon.png")
|
||||
|
||||
local deathPanel = nil
|
||||
|
||||
hook.Add("HUDPaint", "HUDPaint.MedicMod", function()
|
||||
|
||||
if ConfigurationMedicMod.MedicTeams and table.HasValue(ConfigurationMedicMod.MedicTeams, LocalPlayer():Team()) then
|
||||
for k, v in pairs(ents.FindByClass("prop_ragdoll")) do
|
||||
|
||||
if not v:IsDeathRagdoll() then continue end
|
||||
|
||||
local pos = ( v:GetPos() + Vector(0,0,10) ):ToScreen()
|
||||
local dist = v:GetPos():Distance(LocalPlayer():GetPos())
|
||||
|
||||
surface.SetDrawColor( 255, 255, 255, 255 )
|
||||
surface.SetMaterial( notifIcon )
|
||||
surface.DrawTexturedRect( pos.x - 25, pos.y, 50, 50 )
|
||||
|
||||
draw.SimpleTextOutlined( math.floor(math.sqrt(dist/3)).."m", "MedicModFont30", pos.x, pos.y + 50, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP, 1, Color( 0, 0, 0, 255 ) )
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
--[[
|
||||
local carryText = nil
|
||||
if LocalPlayer():GetNWBool("CarryingRagdoll", false) then
|
||||
carryText = ConfigurationMedicMod.Sentences["You dropped the corpse"][ConfigurationMedicMod.Language]
|
||||
else
|
||||
local trace = LocalPlayer():GetEyeTraceNoCursor()
|
||||
if IsValid(trace.Entity) and trace.Entity:IsDeathRagdoll() and not trace.Entity:GetNWBool("IsRagdollCarried", false) and trace.HitPos:Distance(LocalPlayer():GetPos()) <= 120 then
|
||||
carryText = ConfigurationMedicMod.Sentences["Press E to carry corpse"][ConfigurationMedicMod.Language]
|
||||
end
|
||||
end
|
||||
|
||||
if carryText then
|
||||
draw.SimpleTextOutlined(carryText, "MedicModFont30", ScrW() / 2, ScrH() - 80, Color(255, 255, 0, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP, 2, Color(0, 0, 0, 255))
|
||||
end
|
||||
]]
|
||||
|
||||
local nbStat = 1
|
||||
|
||||
if LocalPlayer():IsBleeding() then
|
||||
surface.SetDrawColor( 255, 255, 255, 255 )
|
||||
surface.SetMaterial( bleedingIcon )
|
||||
surface.DrawTexturedRect( ScrW() - 300, ScrH() - 150 - 50 * nbStat, 50, 50 )
|
||||
|
||||
draw.SimpleTextOutlined( ConfigurationMedicMod.Sentences["Bleeding"][ConfigurationMedicMod.Language], "MedicModFont30", ScrW() - 240, ScrH() - 140 - 50 * nbStat, Color( 255, 0, 0, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP, 1, Color( 0, 0, 0, 255 ) )
|
||||
nbStat = nbStat + 1
|
||||
end
|
||||
if LocalPlayer():IsPoisoned() then
|
||||
surface.SetDrawColor( 255, 255, 255, 255 )
|
||||
surface.SetMaterial( poisonedIcon )
|
||||
surface.DrawTexturedRect( ScrW() - 300, ScrH() - 150 - 50 * nbStat, 50, 50 )
|
||||
|
||||
draw.SimpleTextOutlined( ConfigurationMedicMod.Sentences["Poisoned"][ConfigurationMedicMod.Language], "MedicModFont30", ScrW() - 240, ScrH() - 140 - 50 * nbStat, Color( 153, 201, 158, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP, 1, Color( 0, 0, 0, 255 ) )
|
||||
nbStat = nbStat + 1
|
||||
end
|
||||
if LocalPlayer():GetHeartAttack() then
|
||||
surface.SetDrawColor( 255, 255, 255, 255 )
|
||||
surface.SetMaterial( hattackIcon )
|
||||
surface.DrawTexturedRect( ScrW() - 300, ScrH() - 150 - 50 * nbStat, 50, 50 )
|
||||
|
||||
draw.SimpleTextOutlined( ConfigurationMedicMod.Sentences["Heart Attack"][ConfigurationMedicMod.Language], "MedicModFont30", ScrW() - 240, ScrH() - 140 - 50 * nbStat , Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP, 1, Color( 0, 0, 0, 255 ) )
|
||||
nbStat = nbStat + 1
|
||||
end
|
||||
if LocalPlayer():IsMorphine() then
|
||||
surface.SetDrawColor( 255, 255, 255, 255 )
|
||||
surface.SetMaterial( morphIcon )
|
||||
surface.DrawTexturedRect( ScrW() - 300, ScrH() - 150 - 50 * nbStat, 50, 50 )
|
||||
|
||||
draw.SimpleTextOutlined( ConfigurationMedicMod.Sentences["Morphine"][ConfigurationMedicMod.Language], "MedicModFont30", ScrW() - 240, ScrH() - 140 - 50 * nbStat, Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP, 1, Color( 0, 0, 0, 255 ) )
|
||||
nbStat = nbStat + 1
|
||||
end
|
||||
if LocalPlayer():IsFractured() then
|
||||
surface.SetDrawColor( 255, 255, 255, 255 )
|
||||
surface.SetMaterial( breakIcon )
|
||||
surface.DrawTexturedRect( ScrW() - 300, ScrH() - 150 - 50 * nbStat, 50, 50 )
|
||||
|
||||
draw.SimpleTextOutlined( ConfigurationMedicMod.Sentences["Fracture"][ConfigurationMedicMod.Language], "MedicModFont30", ScrW() - 240, ScrH() - 140 - 50 * nbStat, Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP, 1, Color( 0, 0, 0, 255 ) )
|
||||
nbStat = nbStat + 1
|
||||
end
|
||||
|
||||
end)
|
||||
@@ -0,0 +1,858 @@
|
||||
local sentences = ConfigurationMedicMod.Sentences
|
||||
local lang = ConfigurationMedicMod.Language
|
||||
|
||||
local function CreateCloseButton( Parent, Panel, color, sx, sy, back, backcolor)
|
||||
|
||||
Parent = Parent or ""
|
||||
sx = sx or 50
|
||||
sy = sy or 20
|
||||
color = color or Color(255,255,255,255)
|
||||
back = back or false
|
||||
backcolor = backcolor or false
|
||||
|
||||
local x,y = Parent:GetSize()
|
||||
|
||||
local CloseButton = vgui.Create("DButton", Parent)
|
||||
CloseButton:SetPos(x-sx, 0)
|
||||
CloseButton:SetSize(sx,sy)
|
||||
CloseButton:SetFont("Trebuchet24")
|
||||
CloseButton:SetTextColor( color )
|
||||
CloseButton:SetText("X")
|
||||
function CloseButton:DoClick()
|
||||
Panel:Close()
|
||||
end
|
||||
CloseButton.Paint = function(s , w , h)
|
||||
if back then
|
||||
draw.RoundedBox(0,0,0,w , h,backcolor)
|
||||
end
|
||||
end
|
||||
|
||||
return CloseButton
|
||||
|
||||
end
|
||||
|
||||
local function CreateButton( Parent, text, font, colorText, px, py, sx, sy, func, back, backcolor, backcolorbar, sound)
|
||||
|
||||
Parent = Parent or ""
|
||||
font = font or "Trebuchet18"
|
||||
text = text or ""
|
||||
px = px or 0
|
||||
py = py or 0
|
||||
sx = sx or 50
|
||||
sound = sound or true
|
||||
func = func or function() end
|
||||
sy = sy or 50
|
||||
colorText = colorText or Color(255,255,255,255)
|
||||
back = back or true
|
||||
backcolor = backcolor or Color( 0, 100 , 150 )
|
||||
backcolorbar = backcolorbar or Color( 0 , 80 , 120 )
|
||||
|
||||
local Button = vgui.Create("DButton", Parent)
|
||||
Button:SetPos( px , py )
|
||||
Button:SetSize(sx,sy)
|
||||
Button:SetFont("Trebuchet24")
|
||||
Button:SetTextColor( colorText )
|
||||
Button:SetText(text)
|
||||
function Button:DoClick()
|
||||
func()
|
||||
if sound then
|
||||
surface.PlaySound( "UI/buttonclick.wav" )
|
||||
end
|
||||
end
|
||||
|
||||
if sound then
|
||||
function Button:OnCursorEntered()
|
||||
surface.PlaySound( "UI/buttonrollover.wav" )
|
||||
end
|
||||
end
|
||||
|
||||
Button.Paint = function(s , w , h)
|
||||
if back then
|
||||
if Button:IsHovered() then
|
||||
draw.RoundedBox(0,0,0,w , h, Color( backcolor.r + 30, backcolor.g + 30, backcolor.b + 30 ))
|
||||
draw.RoundedBox(0,0,h-sy/10,sx , sy/10, Color( backcolorbar.r + 30, backcolorbar.g + 30, backcolorbar.b + 30 ))
|
||||
else
|
||||
draw.RoundedBox(0,0,0,w , h, backcolor)
|
||||
draw.RoundedBox(0,0,h-sy/10,sx , sy/10, backcolorbar)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return Button
|
||||
|
||||
end
|
||||
|
||||
local function CreatePanel( Parent, sx, sy, posx, posy, backcolor, scroll, bar, grip, btn)
|
||||
|
||||
Parent = Parent or ""
|
||||
sx = sx or 100
|
||||
sy = sy or 100
|
||||
backcolor = backcolor or Color(35, 35, 35, 255)
|
||||
posx = posx or 0
|
||||
posy = posy or 0
|
||||
scroll = scroll or false
|
||||
bar = bar or Color( 30, 30, 30 )
|
||||
grip = grip or Color( 0, 140, 208 )
|
||||
btn = btn or Color( 4,95,164 )
|
||||
|
||||
local typ = "DPanel"
|
||||
if scroll then
|
||||
typ = "DScrollPanel"
|
||||
else
|
||||
typ = "DPanel"
|
||||
end
|
||||
|
||||
local Panel = vgui.Create(typ, Parent)
|
||||
Panel:SetSize(sx,sy)
|
||||
Panel:SetPos(posx,posy)
|
||||
Panel.Paint = function(s , w , h)
|
||||
draw.RoundedBox(0,0,0,w , h, backcolor)
|
||||
end
|
||||
|
||||
if typ == "DScrollPanel" then
|
||||
|
||||
local sbar = Panel:GetVBar()
|
||||
|
||||
function sbar:Paint( w, h )
|
||||
draw.RoundedBox( 0, 0, 0, w, h, bar )
|
||||
end
|
||||
|
||||
function sbar.btnUp:Paint( w, h )
|
||||
draw.SimpleText( "?", "Trebuchet24", -3, -4, btn )
|
||||
end
|
||||
|
||||
function sbar.btnDown:Paint( w, h )
|
||||
draw.SimpleText( "?", "Trebuchet24", -3, -4, btn )
|
||||
end
|
||||
|
||||
function sbar.btnGrip:Paint( w, h )
|
||||
draw.RoundedBox( 8, 0, 0, w, h, grip )
|
||||
end
|
||||
end
|
||||
|
||||
return Panel
|
||||
|
||||
end
|
||||
|
||||
local function CreateLabel( Parent, font, text, sx, sy, posx, posy, color, time)
|
||||
|
||||
Parent = Parent or ""
|
||||
font = font or "Trebuchet24"
|
||||
text = text or ""
|
||||
sx = sx or 100
|
||||
sy = sy or 100
|
||||
posx = posx or 0
|
||||
posy = posy or 0
|
||||
color = color or Color(255,255,255,255)
|
||||
time = time or 0
|
||||
|
||||
local EndTime = CurTime() + time
|
||||
local SizeString = string.len( text )
|
||||
|
||||
local Label = vgui.Create("DLabel", Parent)
|
||||
Label:SetPos( posx, posy )
|
||||
Label:SetSize( sx,sy )
|
||||
if time == 0 then
|
||||
Label:SetText( text )
|
||||
else
|
||||
Label:SetText( "" )
|
||||
end
|
||||
Label:SetWrap( true )
|
||||
Label:SetTextColor(color)
|
||||
Label:SetFont(font)
|
||||
|
||||
Label.Think = function()
|
||||
|
||||
if Label:GetText() == text then
|
||||
return
|
||||
end
|
||||
|
||||
local TimeLeft = EndTime - CurTime()
|
||||
local StringSizeP1 = ( TimeLeft / ( time / 100 ) ) / 100
|
||||
local StringSize = 1 - StringSizeP1
|
||||
|
||||
Label:SetText( string.sub(text, 0, SizeString * StringSize ))
|
||||
|
||||
end
|
||||
|
||||
return Label
|
||||
|
||||
end
|
||||
|
||||
|
||||
local SizeX = 400
|
||||
local SizeY = 250
|
||||
|
||||
net.Receive("MedicMod.MedicMenu", function()
|
||||
|
||||
local ent = net.ReadEntity()
|
||||
local fract = net.ReadTable()
|
||||
|
||||
local FramePrincipal = vgui.Create( "DFrame" )
|
||||
FramePrincipal:SetSize( SizeX, SizeY )
|
||||
FramePrincipal:SetPos( ScrW()/2 - SizeX/2, ScrH()/2 - SizeY/2 )
|
||||
FramePrincipal:SetTitle( "Panel" )
|
||||
FramePrincipal:SetDraggable( false )
|
||||
FramePrincipal:ShowCloseButton( false )
|
||||
FramePrincipal:MakePopup()
|
||||
FramePrincipal.Paint = function(s , w , h)
|
||||
end
|
||||
|
||||
local boxTitle = CreatePanel( FramePrincipal, SizeX, 20, 0, 0, Color(0, 140, 208, 255), false )
|
||||
|
||||
local CloseButton = CreateCloseButton( boxTitle, FramePrincipal )
|
||||
|
||||
local LabelTitle = CreateLabel( boxTitle, "Trebuchet24", "Medecin", SizeX-40, 20, 50, 0, nil, 0)
|
||||
|
||||
local boxContent = CreatePanel( FramePrincipal, SizeX, SizeY-20, 0, 20, Color(35, 35, 35, 255), true )
|
||||
|
||||
local fractn = table.Count(fract)
|
||||
|
||||
if LocalPlayer():Health() < LocalPlayer():GetMaxHealth() or fractn > 0 then
|
||||
local money = ( LocalPlayer():GetMaxHealth() - LocalPlayer():Health() ) * ConfigurationMedicMod.HealthUnitPrice
|
||||
|
||||
if fractn > 0 then
|
||||
money = money + fractn * ConfigurationMedicMod.FractureRepairPrice
|
||||
end
|
||||
|
||||
local Label1 = CreateLabel( boxContent, nil, sentences["Hello, you look sick. I can heal you, it will cost"][lang].." "..money..ConfigurationMedicMod.MoneyUnit.."." , SizeX - 40, SizeY - 35 - 50 - 10, 10, 0, nil, 3)
|
||||
local Button1 = CreateButton( boxContent, sentences["Heal me"][lang], nil, nil, SizeX/2-75, SizeY - 50 - 10 - 25, 150, 50, function() net.Start("MedicMod.MedicStart") net.WriteEntity( ent ) net.SendToServer() FramePrincipal:Close() end )
|
||||
else
|
||||
local Label1 = CreateLabel( boxContent, nil, sentences["Hello, you seem healthy-looking today"][lang] , SizeX - 40, SizeY - 35 - 50 - 10, 10, 0, nil, 2)
|
||||
local Button1 = CreateButton( boxContent, sentences["Thanks"][lang], nil, nil, SizeX/2-75, SizeY - 50 - 10 - 25, 150, 50, function() FramePrincipal:Close() end )
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
-- net.Receive("MedicMod.NotifiyPlayer", function()
|
||||
-- local msg = net.ReadString()
|
||||
-- local time = net.ReadInt( 32 )
|
||||
-- MedicNotif( msg, time )
|
||||
-- end)
|
||||
|
||||
net.Receive("MedicMod.ScanRadio", function()
|
||||
|
||||
local ent = net.ReadEntity()
|
||||
local fractures = net.ReadTable()
|
||||
|
||||
ent.fracturesTable = fractures
|
||||
|
||||
end)
|
||||
|
||||
net.Receive("MedicMod.PlayerStartAnimation", function()
|
||||
|
||||
timer.Simple(0.15, function()
|
||||
|
||||
for k, v in pairs(player.GetAll()) do
|
||||
|
||||
if not v:GetMedicAnimation() then continue end
|
||||
|
||||
if v:GetMedicAnimation() != 0 then
|
||||
StartMedicAnimation( v, v:GetMedicAnimation() )
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
net.Receive("MedicMod.PlayerStopAnimation", function()
|
||||
|
||||
timer.Simple(0.15, function()
|
||||
|
||||
for k, v in pairs(player.GetAll()) do
|
||||
|
||||
if v:GetMedicAnimation() == 0 and IsValid( v.mdlanim ) then
|
||||
StopMedicAnimation( v )
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
net.Receive("MedicMod.Respawn", function()
|
||||
MedicMod.seconds = net.ReadInt(32)
|
||||
end)
|
||||
|
||||
net.Receive("MedicMod.TerminalMenu", function()
|
||||
local ent = net.ReadEntity()
|
||||
|
||||
if not IsValid( ent ) then return end
|
||||
|
||||
MedicMod.TerminalMenu( ent )
|
||||
end)
|
||||
|
||||
|
||||
-- medic menu
|
||||
|
||||
for i=1,30 do
|
||||
|
||||
surface.CreateFont( "Bariol"..i, {
|
||||
font = "Bariol Regular", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
|
||||
extended = false,
|
||||
size = i,
|
||||
weight = 750,
|
||||
blursize = 0,
|
||||
scanlines = 0,
|
||||
antialias = true,
|
||||
underline = false,
|
||||
italic = false,
|
||||
strikeout = false,
|
||||
symbol = false,
|
||||
rotary = false,
|
||||
shadow = false,
|
||||
additive = false,
|
||||
outline = false,
|
||||
} )
|
||||
|
||||
end
|
||||
|
||||
|
||||
local venalib = {}
|
||||
|
||||
local matCloseButton = Material( "materials/medic/lib/close_button.png" )
|
||||
|
||||
venalib.Frame = function( sizex, sizey, posx, posy, parent )
|
||||
|
||||
local parent = parent or nil
|
||||
local sizex = sizex or 500
|
||||
local sizey = sizey or 500
|
||||
|
||||
local frame = vgui.Create("DFrame", parent)
|
||||
frame:SetSize( sizex, sizey )
|
||||
frame:MakePopup()
|
||||
frame:ShowCloseButton(false)
|
||||
frame:SetTitle("")
|
||||
|
||||
if not posx or not posy then
|
||||
frame:Center()
|
||||
else
|
||||
frame:SetPos( posx, posy )
|
||||
end
|
||||
|
||||
frame.Paint = function( pnl, w, h )
|
||||
draw.RoundedBox( 3, 0, 0, w,h, Color( 46, 46, 54))
|
||||
draw.RoundedBox( 3, 0, 0, w,40, Color( 36, 36, 44))
|
||||
draw.RoundedBox( 0, 0, 40, w,2, Color( 26, 26, 34))
|
||||
draw.SimpleText( sentences["Medic"][lang].." - Menu", "Bariol20", 10, 10, Color( 255, 255, 255, 255 ) )
|
||||
end
|
||||
|
||||
local DermaButton = vgui.Create( "DButton", frame )
|
||||
DermaButton:SetText( "" )
|
||||
DermaButton:SetPos( sizex-30, 15/2 )
|
||||
DermaButton:SetSize( 25, 25 )
|
||||
DermaButton.DoClick = function()
|
||||
if frame then frame:Remove() end
|
||||
end
|
||||
DermaButton.Paint = function( pnl, w, h )
|
||||
surface.SetDrawColor( 255, 255, 255, 255 )
|
||||
surface.SetMaterial( matCloseButton )
|
||||
surface.DrawTexturedRect( 0, 0, 25, 25 )
|
||||
end
|
||||
|
||||
local dpanel = vgui.Create("DPanel", frame)
|
||||
dpanel:SetPos( 0, 42 )
|
||||
dpanel:SetSize( sizex, sizey-42 )
|
||||
dpanel.Paint = function( pnl, w, h )
|
||||
end
|
||||
|
||||
return dpanel
|
||||
|
||||
end
|
||||
|
||||
venalib.Panel = function( sizex, sizey, posx, posy, parent )
|
||||
|
||||
local parent = parent or nil
|
||||
local sizex = sizex or 500
|
||||
local sizey = sizey or 500
|
||||
|
||||
local panel = vgui.Create("DScrollPanel", parent)
|
||||
panel:SetSize( sizex, sizey )
|
||||
|
||||
if not posx or not posy then
|
||||
panel:SetPos(0,0)
|
||||
else
|
||||
panel:SetPos( posx, posy )
|
||||
end
|
||||
|
||||
panel.Paint = function( pnl, w, h )
|
||||
draw.RoundedBox( 0, 0, 0, w,h, Color(36, 36, 44))
|
||||
draw.RoundedBox( 0, 0, 0, w,h-2, Color(46, 46, 54))
|
||||
end
|
||||
|
||||
|
||||
local sbar = panel:GetVBar()
|
||||
|
||||
function sbar:Paint( w, h )
|
||||
draw.RoundedBox( 0, 0, 0, w, h, Color(56, 56, 64) )
|
||||
end
|
||||
|
||||
function sbar.btnUp:Paint( w, h )
|
||||
draw.RoundedBox( 0, 0, 0, w, h, Color(36, 36, 44) )
|
||||
end
|
||||
|
||||
function sbar.btnDown:Paint( w, h )
|
||||
draw.RoundedBox( 0, 0, 0, w, h, Color(36, 36, 44) )
|
||||
end
|
||||
|
||||
function sbar.btnGrip:Paint( w, h )
|
||||
draw.RoundedBox( 0, 0, 0, w, h, Color(31, 31, 39) )
|
||||
end
|
||||
|
||||
return panel
|
||||
|
||||
end
|
||||
|
||||
venalib.Label = function( text, font, sx, sy, posx, posy, color, Parent, time)
|
||||
|
||||
Parent = Parent or ""
|
||||
font = font or 15
|
||||
text = text or ""
|
||||
sx = sx or 100
|
||||
sy = sy or 100
|
||||
posx = posx or 0
|
||||
posy = posy or 0
|
||||
color = color or Color(255,255,255,255)
|
||||
time = time or 0
|
||||
|
||||
local EndTime = CurTime() + time
|
||||
local SizeString = string.len( text )
|
||||
|
||||
local Label = vgui.Create("DLabel", Parent)
|
||||
Label:SetPos( posx, posy )
|
||||
Label:SetSize( sx,sy )
|
||||
if time == 0 then
|
||||
Label:SetText( text )
|
||||
else
|
||||
Label:SetText( "" )
|
||||
end
|
||||
Label:SetWrap( true )
|
||||
Label:SetTextColor(color)
|
||||
Label:SetFont("Bariol"..font)
|
||||
|
||||
Label.Think = function()
|
||||
|
||||
if Label:GetText() == text then
|
||||
return
|
||||
end
|
||||
|
||||
local TimeLeft = EndTime - CurTime()
|
||||
local StringSizeP1 = ( TimeLeft / ( time / 100 ) ) / 100
|
||||
local StringSize = 1 - StringSizeP1
|
||||
|
||||
Label:SetText( string.sub(text, 0, SizeString * StringSize ))
|
||||
|
||||
end
|
||||
|
||||
return Label
|
||||
|
||||
end
|
||||
|
||||
venalib.Button = function( text, sizex, sizey, posx, posy, func, parent )
|
||||
|
||||
local text = text or ""
|
||||
local sizex = sizex or 100
|
||||
local sizey = sizey or 30
|
||||
local posx = posx or 0
|
||||
local posy = posy or 0
|
||||
local parent = parent or nil
|
||||
local func = func or function() end
|
||||
|
||||
local button = vgui.Create( "DButton", parent )
|
||||
button:SetText( "" )
|
||||
button:SetPos( posx, posy)
|
||||
button:SetSize( sizex, sizey )
|
||||
|
||||
local colorr = 36
|
||||
local colorg = 36
|
||||
local colorb = 44
|
||||
|
||||
function button:DoClick()
|
||||
func()
|
||||
surface.PlaySound( "UI/buttonclick.wav" )
|
||||
end
|
||||
|
||||
button.Paint = function( pnl, w, h )
|
||||
|
||||
local color = Color( 36, 36, 44)
|
||||
local pa = 0.1
|
||||
|
||||
if button:IsHovered() then
|
||||
colorr = math.Clamp( colorr + pa, 36, 36+5 )
|
||||
colorg = math.Clamp( colorg + pa, 36, 36+5 )
|
||||
colorb = math.Clamp( colorb + pa, 44, 44+5 )
|
||||
color = Color( colorr, colorg, colorb, 255 )
|
||||
else
|
||||
colorr = math.Clamp( colorr - pa, 36, 36+5 )
|
||||
colorg = math.Clamp( colorg - pa, 36, 36+5 )
|
||||
colorb = math.Clamp( colorb - pa, 44, 44+5 )
|
||||
color = Color( colorr, colorg, colorb, 255 )
|
||||
end
|
||||
draw.RoundedBox( 0, 0, 0, w,h-2, color)
|
||||
draw.RoundedBox( 0, 0, h-2, w,2, Color( 26, 26, 34))
|
||||
-- draw.RoundedBox( 0, w-2, 0, 2,h, Color( 31, 31, 41))
|
||||
draw.SimpleText( text, "Bariol17", 10, sizey/2-17/2-2, Color( 255, 255, 255, 255 ) )
|
||||
end
|
||||
function button:OnCursorEntered()
|
||||
surface.PlaySound( "UI/buttonrollover.wav" )
|
||||
end
|
||||
return button
|
||||
end
|
||||
|
||||
local sizex = 800
|
||||
local sizey = 600
|
||||
|
||||
local function OpenTestTubesPart(MainFrame)
|
||||
|
||||
local sizex = 800
|
||||
local sizey = 600
|
||||
|
||||
local panelM = venalib.Panel( sizex-160, sizey-40, 160, 0, MainFrame )
|
||||
local nbing = 0
|
||||
for k , v in pairs( ConfigurationMedicMod.Reagents ) do
|
||||
|
||||
local name = k
|
||||
local price = v.price or 10
|
||||
|
||||
local x = (sizex-160-40-10)/2
|
||||
local y = 100
|
||||
|
||||
local ispair = math.mod( nbing, 2 )
|
||||
|
||||
local panelMIng = venalib.Panel( x, y, 10+(10+(x))*ispair, 10 + math.floor(nbing/2) * (y+10), panelM )
|
||||
panelMIng.Paint = function( pnl, w, h )
|
||||
draw.RoundedBox( 0, 0, 0, w,h, Color(36, 36, 44))
|
||||
end
|
||||
|
||||
local icon = vgui.Create( "SpawnIcon", panelMIng )
|
||||
icon:SetPos( 10, 10 )
|
||||
icon:SetSize( 80, 80 )
|
||||
icon:SetModel( "models/medicmod/test_tube/testtube.mdl" )
|
||||
function icon:LayoutEntity( Entity ) return end
|
||||
|
||||
local text = venalib.Label( sentences["Test tube"][lang]..": "..name, 14, x-100-20, 30, 110, 10, Color(255,255,255), panelMIng)
|
||||
text:SetWrap(false)
|
||||
local text2 = venalib.Label( price..ConfigurationMedicMod.MoneyUnit, 14, x-100-20, 70, 110, 10, Color(255,255,255), panelMIng)
|
||||
text2:SetWrap(false)
|
||||
|
||||
local button1 = venalib.Button( "> "..sentences["Buy"][lang], x-100-20, 40, x-(x-100-20)-10, y - 45 , function()
|
||||
net.Start("MedicMod.BuyMedicJobEntity")
|
||||
net.WriteString( k )
|
||||
net.WriteString( "test_tube_medicmod_s" )
|
||||
net.SendToServer()
|
||||
end,panelMIng )
|
||||
|
||||
local colorr = 36
|
||||
local colorg = 36
|
||||
local colorb = 44
|
||||
|
||||
button1.Paint = function( pnl, w, h )
|
||||
|
||||
local color = Color( 36, 36, 44)
|
||||
local pa = 0.1
|
||||
|
||||
if not button1:IsHovered() then
|
||||
colorr = math.Clamp( colorr + pa, 36, 36+5 )
|
||||
colorg = math.Clamp( colorg + pa, 36, 36+5 )
|
||||
colorb = math.Clamp( colorb + pa, 44, 44+5 )
|
||||
color = Color( colorr, colorg, colorb, 255 )
|
||||
else
|
||||
colorr = math.Clamp( colorr - pa, 36, 36+5 )
|
||||
colorg = math.Clamp( colorg - pa, 36, 36+5 )
|
||||
colorb = math.Clamp( colorb - pa, 44, 44+5 )
|
||||
color = Color( colorr, colorg, colorb, 255 )
|
||||
end
|
||||
draw.RoundedBox( 0, 0, 0, w,h-2, color)
|
||||
draw.RoundedBox( 0, 0, h-2, w,2, Color( 26, 26, 34))
|
||||
-- draw.RoundedBox( 0, w-2, 0, 2,h, Color( 31, 31, 41))
|
||||
draw.SimpleText( "> "..sentences["Buy"][lang], "Bariol17", 15, 40/2-17/2-2, Color( 255, 255, 255, 255 ) )
|
||||
end
|
||||
|
||||
nbing = nbing + 1
|
||||
|
||||
end
|
||||
|
||||
return panelM
|
||||
end
|
||||
|
||||
local function OpenEntitiesPart(MainFrame)
|
||||
|
||||
local sizex = 800
|
||||
local sizey = 600
|
||||
|
||||
local panelM = venalib.Panel( sizex-160, sizey-40, 160, 0, MainFrame )
|
||||
local nbing = 0
|
||||
for k , v in pairs( ConfigurationMedicMod.MedicShopEntities ) do
|
||||
|
||||
local name = v.name or "No name"
|
||||
local price = v.price or 10
|
||||
|
||||
local x = (sizex-160-40-10)/2
|
||||
local y = 100
|
||||
|
||||
local ispair = math.mod( nbing, 2 )
|
||||
|
||||
local panelMIng = venalib.Panel( x, y, 10+(10+(x))*ispair, 10 + math.floor(nbing/2) * (y+10), panelM )
|
||||
panelMIng.Paint = function( pnl, w, h )
|
||||
draw.RoundedBox( 0, 0, 0, w,h, Color(36, 36, 44))
|
||||
end
|
||||
|
||||
local icon = vgui.Create( "SpawnIcon", panelMIng )
|
||||
icon:SetPos( 10, 10 )
|
||||
icon:SetSize( 80, 80 )
|
||||
icon:SetModel( v.model or "" )
|
||||
function icon:LayoutEntity( Entity ) return end
|
||||
|
||||
local text = venalib.Label( sentences["Test tube"][lang]..": "..name, 14, x-100-20, 30, 110, 10, Color(255,255,255), panelMIng)
|
||||
text:SetWrap(false)
|
||||
local text2 = venalib.Label( price..ConfigurationMedicMod.MoneyUnit, 14, x-100-20, 70, 110, 10, Color(255,255,255), panelMIng)
|
||||
text2:SetWrap(false)
|
||||
|
||||
local button1 = venalib.Button( "> "..sentences["Buy"][lang], x-100-20, 40, x-(x-100-20)-10, y - 45 , function()
|
||||
net.Start("MedicMod.BuyMedicJobEntity")
|
||||
net.WriteString( "entity" )
|
||||
net.WriteString( k )
|
||||
net.SendToServer()
|
||||
end,panelMIng )
|
||||
|
||||
local colorr = 36
|
||||
local colorg = 36
|
||||
local colorb = 44
|
||||
|
||||
button1.Paint = function( pnl, w, h )
|
||||
|
||||
local color = Color( 36, 36, 44)
|
||||
local pa = 0.1
|
||||
|
||||
if not button1:IsHovered() then
|
||||
colorr = math.Clamp( colorr + pa, 36, 36+5 )
|
||||
colorg = math.Clamp( colorg + pa, 36, 36+5 )
|
||||
colorb = math.Clamp( colorb + pa, 44, 44+5 )
|
||||
color = Color( colorr, colorg, colorb, 255 )
|
||||
else
|
||||
colorr = math.Clamp( colorr - pa, 36, 36+5 )
|
||||
colorg = math.Clamp( colorg - pa, 36, 36+5 )
|
||||
colorb = math.Clamp( colorb - pa, 44, 44+5 )
|
||||
color = Color( colorr, colorg, colorb, 255 )
|
||||
end
|
||||
draw.RoundedBox( 0, 0, 0, w,h-2, color)
|
||||
draw.RoundedBox( 0, 0, h-2, w,2, Color( 26, 26, 34))
|
||||
-- draw.RoundedBox( 0, w-2, 0, 2,h, Color( 31, 31, 41))
|
||||
draw.SimpleText( "> "..sentences["Buy"][lang], "Bariol17", 15, 40/2-17/2-2, Color( 255, 255, 255, 255 ) )
|
||||
end
|
||||
|
||||
nbing = nbing + 1
|
||||
|
||||
end
|
||||
|
||||
return panelM
|
||||
end
|
||||
|
||||
local function OpenWeaponsPart(MainFrame)
|
||||
|
||||
local sizex = 800
|
||||
local sizey = 600
|
||||
|
||||
local panelM = venalib.Panel( sizex-160, sizey-40, 160, 0, MainFrame )
|
||||
local nbing = 0
|
||||
for k , v in pairs( ConfigurationMedicMod.MedicShopWeapons ) do
|
||||
|
||||
local name = v.name or "No name"
|
||||
local price = v.price or 10
|
||||
|
||||
local x = (sizex-160-40-10)/2
|
||||
local y = 100
|
||||
|
||||
local ispair = math.mod( nbing, 2 )
|
||||
|
||||
local panelMIng = venalib.Panel( x, y, 10+(10+(x))*ispair, 10 + math.floor(nbing/2) * (y+10), panelM )
|
||||
panelMIng.Paint = function( pnl, w, h )
|
||||
draw.RoundedBox( 0, 0, 0, w,h, Color(36, 36, 44))
|
||||
end
|
||||
|
||||
local icon = vgui.Create( "SpawnIcon", panelMIng )
|
||||
icon:SetPos( 10, 10 )
|
||||
icon:SetSize( 80, 80 )
|
||||
icon:SetModel( v.model or "" )
|
||||
function icon:LayoutEntity( Entity ) return end
|
||||
|
||||
local text = venalib.Label( sentences["Test tube"][lang]..": "..name, 14, x-100-20, 30, 110, 10, Color(255,255,255), panelMIng)
|
||||
text:SetWrap(false)
|
||||
local text2 = venalib.Label( price..ConfigurationMedicMod.MoneyUnit, 14, x-100-20, 70, 110, 10, Color(255,255,255), panelMIng)
|
||||
text2:SetWrap(false)
|
||||
|
||||
local button1 = venalib.Button( "> "..sentences["Buy"][lang], x-100-20, 40, x-(x-100-20)-10, y - 45 , function()
|
||||
net.Start("MedicMod.BuyMedicJobEntity")
|
||||
net.WriteString( "weapon" )
|
||||
net.WriteString( k )
|
||||
net.SendToServer()
|
||||
end,panelMIng )
|
||||
|
||||
local colorr = 36
|
||||
local colorg = 36
|
||||
local colorb = 44
|
||||
|
||||
button1.Paint = function( pnl, w, h )
|
||||
|
||||
local color = Color( 36, 36, 44)
|
||||
local pa = 0.1
|
||||
|
||||
if not button1:IsHovered() then
|
||||
colorr = math.Clamp( colorr + pa, 36, 36+5 )
|
||||
colorg = math.Clamp( colorg + pa, 36, 36+5 )
|
||||
colorb = math.Clamp( colorb + pa, 44, 44+5 )
|
||||
color = Color( colorr, colorg, colorb, 255 )
|
||||
else
|
||||
colorr = math.Clamp( colorr - pa, 36, 36+5 )
|
||||
colorg = math.Clamp( colorg - pa, 36, 36+5 )
|
||||
colorb = math.Clamp( colorb - pa, 44, 44+5 )
|
||||
color = Color( colorr, colorg, colorb, 255 )
|
||||
end
|
||||
draw.RoundedBox( 0, 0, 0, w,h-2, color)
|
||||
draw.RoundedBox( 0, 0, h-2, w,2, Color( 26, 26, 34))
|
||||
-- draw.RoundedBox( 0, w-2, 0, 2,h, Color( 31, 31, 41))
|
||||
draw.SimpleText( "> "..sentences["Buy"][lang], "Bariol17", 15, 40/2-17/2-2, Color( 255, 255, 255, 255 ) )
|
||||
end
|
||||
|
||||
nbing = nbing + 1
|
||||
|
||||
end
|
||||
|
||||
return panelM
|
||||
end
|
||||
|
||||
local function OpenGuidePage( MainFrame )
|
||||
|
||||
local sizex = 800
|
||||
local sizey = 600
|
||||
|
||||
local panelM = venalib.Panel( sizex-160, sizey-40, 160, 0, MainFrame )
|
||||
|
||||
local GuideText = sentences.GuideText[lang]
|
||||
|
||||
|
||||
|
||||
local htmlc = [[<style>
|
||||
::-webkit-scrollbar {
|
||||
width: 10px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background: #383840;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: #555;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background: #555;
|
||||
}
|
||||
</style>]]
|
||||
|
||||
for _, tab in pairs( GuideText ) do
|
||||
|
||||
local text = tab[1] or ""
|
||||
local size = tab[2] or 15
|
||||
|
||||
-- local TextLabel = vgui.Create( "DLabel", panelM )
|
||||
-- TextLabel:SetPos( 10, pos )
|
||||
-- TextLabel:SetText( text )
|
||||
-- TextLabel:SetWrap( true )
|
||||
-- TextLabel:SetFont("Bariol"..size)
|
||||
-- TextLabel:SetWide(sizex-160-10)
|
||||
-- TextLabel:SetAutoStretchVertical( true )
|
||||
htmlc = htmlc..'<font size="'..(size/4)..'" face="Bariol Regular" color="white">'..text..'</font></br></br>'
|
||||
|
||||
-- local sx, sy = TextLabel:GetSize()
|
||||
|
||||
-- pos = pos + sy
|
||||
|
||||
end
|
||||
|
||||
local html = vgui.Create( "DHTML" , panelM )
|
||||
html:SetSize( sizex-160, sizey-40 )
|
||||
html:SetHTML( htmlc )
|
||||
|
||||
-- local panelM2 = venalib.Panel( 1, 1000, 160, 0, panelM )
|
||||
-- local panelM1Title = venalib.Label( "Comment cuisiner?", 20, sizex-160, 20, 20, 10 , Color(255,255,255), panelM )
|
||||
-- panelM1Title:SetWrap(false)
|
||||
|
||||
-- local panelM1desc = venalib.Label( [[testen
|
||||
-- effet
|
||||
-- oui]], 20, sizex-160, 20, 20, 30 , Color(255,255,255), panelM )
|
||||
|
||||
|
||||
-- local panelM2Title = venalib.Label( "Comment utiliser l'ecran et le terminal?", 20, sizex-160, 20, 20, 350 , Color(255,255,255), panelM )
|
||||
-- panelM2Title:SetWrap(false)
|
||||
|
||||
return panelM
|
||||
|
||||
end
|
||||
|
||||
local function OpenMedicinesPart(MainFrame)
|
||||
local rn = 0
|
||||
local panelB = venalib.Panel( sizex-160, sizey-40, 160, 0, MainFrame )
|
||||
|
||||
for k, v in pairs( ConfigurationMedicMod.Drugs ) do
|
||||
|
||||
local panel1 = venalib.Panel( sizex-160, 100, 0, 100*rn, panelB )
|
||||
local panelM1text = venalib.Label( k, 15, 200, 15, 10, 10, Color(255,255,255), panel1 )
|
||||
|
||||
local icon = vgui.Create( "SpawnIcon", panel1 )
|
||||
icon:SetSize( 60, 60 )
|
||||
icon:SetPos(15, 30)
|
||||
icon:SetModel( "models/medicmod/drug/drug.mdl" )
|
||||
|
||||
local ingnum = 0
|
||||
|
||||
for a, b in pairs( v ) do
|
||||
|
||||
if a == "func" or a == "price" then continue end
|
||||
local panelM1Ing1 = venalib.Label( "? "..a, 15, sizex-160-100-20-100, 15, 60+15+5, 32 + 15 * ingnum, Color(255,255,255), panel1 )
|
||||
panelM1Ing1:SetWrap( false )
|
||||
|
||||
ingnum = ingnum + 1
|
||||
|
||||
end
|
||||
|
||||
local buttonR = venalib.Button( sentences["Buy"][lang].. "( "..v.price..ConfigurationMedicMod.MoneyUnit.." )", 100, 35, sizex-160-100-20, 40, function()
|
||||
|
||||
net.Start("MedicMod.BuyMedicJobEntity")
|
||||
net.WriteString( k )
|
||||
net.WriteString( "drug_medicmod_s" )
|
||||
net.SendToServer()
|
||||
|
||||
end,panel1 )
|
||||
|
||||
rn = rn + 1
|
||||
|
||||
end
|
||||
|
||||
return panelB
|
||||
end
|
||||
|
||||
local function OpenMainUI()
|
||||
|
||||
local actualPart
|
||||
|
||||
local MainFrame = venalib.Frame( sizex,sizey )
|
||||
MainFrame.Paint = function( pnl, w, h )
|
||||
draw.RoundedBox( 0, 0, 0, w,h, Color(36, 36, 44))
|
||||
end
|
||||
local button1 = venalib.Button( "> "..sentences["Test tube"][lang], 160, 40, 0, 80, function() if ispanel(actualPart) then actualPart:Remove() end actualPart = OpenTestTubesPart(MainFrame) end,MainFrame )
|
||||
local button2 = venalib.Button( "> "..sentences["Drugs"][lang], 160, 40, 0, 40, function() if ispanel(actualPart) then actualPart:Remove() end actualPart = OpenMedicinesPart(MainFrame) end,MainFrame )
|
||||
local button2 = venalib.Button( "> Guide", 160, 40, 0, 0, function() if ispanel(actualPart) then actualPart:Remove() end actualPart = OpenGuidePage(MainFrame) end,MainFrame )
|
||||
local button2 = venalib.Button( "> Entities", 160, 40, 0, 120, function() if ispanel(actualPart) then actualPart:Remove() end actualPart = OpenEntitiesPart(MainFrame) end,MainFrame )
|
||||
local button2 = venalib.Button( "> Weapons", 160, 40, 0, 160, function() if ispanel(actualPart) then actualPart:Remove() end actualPart = OpenWeaponsPart(MainFrame) end,MainFrame )
|
||||
|
||||
actualPart = OpenTestTubesPart( MainFrame )
|
||||
|
||||
end
|
||||
|
||||
net.Receive("MedicMod.OpenMedicMenu", function()
|
||||
OpenMainUI()
|
||||
end)
|
||||
@@ -0,0 +1,118 @@
|
||||
-- NotificationTable_Venatuss = NotificationTable_Venatuss or {}
|
||||
|
||||
-- function MedicNotif( msg, time )
|
||||
|
||||
-- local time = time or 10
|
||||
|
||||
-- NotificationTable_Venatuss[#NotificationTable_Venatuss + 1] = {
|
||||
-- text = msg,
|
||||
-- apptime = CurTime() + 0.2,
|
||||
-- timeremove = CurTime() + 0.2 + 1 + time,
|
||||
-- type = "medic",
|
||||
-- }
|
||||
|
||||
-- end
|
||||
|
||||
-- local iconMat = Material( "materials/notify_icon.png" )
|
||||
-- local iconMatR = Material( "materials/notify_rect.png" )
|
||||
|
||||
-- hook.Add("HUDPaint", "MedicMod.HUDNotifications", function()
|
||||
|
||||
-- for k, v in pairs( NotificationTable_Venatuss ) do
|
||||
-- if v.type == "medic" then
|
||||
-- if v.timeremove - CurTime() < 0 then table.remove(NotificationTable_Venatuss,k) continue end
|
||||
|
||||
-- local alpha = ( math.Clamp(CurTime() - v.apptime, 0 , 1) )
|
||||
-- local posy = ScrH() - 200 - 60 * k - 40 * ( 1 - ( math.Clamp(CurTime() - v.apptime, 0 , 1) ) )
|
||||
-- local posx = math.Clamp(v.timeremove - CurTime(),0,0.25) * 4 * 30 + (0.25 - math.Clamp(v.timeremove - CurTime(),0,0.25)) * 4 * - 340
|
||||
|
||||
-- surface.SetFont( "MedicModFont20" )
|
||||
-- local textsize = select( 1,surface.GetTextSize( v.text ) )
|
||||
|
||||
-- surface.SetDrawColor( 255, 255, 255, 255 * alpha )
|
||||
---- surface.DrawRect( posx + 50, posy, 20 + textsize, 40 )
|
||||
|
||||
-- surface.SetMaterial( iconMat )
|
||||
-- surface.DrawTexturedRect( posx - 20, posy - 18 , 75,75 )
|
||||
-- surface.SetMaterial( iconMatR )
|
||||
-- surface.DrawTexturedRect( posx + 75 - 34, posy - 17.5 , textsize + 30, 75 )
|
||||
|
||||
-- surface.SetTextPos( posx + 50 + 10, posy + 10 )
|
||||
-- surface.SetTextColor( 255,255,255, 255 * alpha)
|
||||
-- surface.DrawText( v.text )
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- end)
|
||||
|
||||
|
||||
NotificationTable_Venatuss = NotificationTable_Venatuss or {}
|
||||
|
||||
surface.CreateFont( "Bariol20", {
|
||||
font = "Bariol Regular", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
|
||||
extended = false,
|
||||
size = 20,
|
||||
weight = 750,
|
||||
blursize = 0,
|
||||
scanlines = 0,
|
||||
antialias = true,
|
||||
underline = false,
|
||||
italic = false,
|
||||
strikeout = false,
|
||||
symbol = false,
|
||||
rotary = false,
|
||||
shadow = false,
|
||||
additive = false,
|
||||
outline = false,
|
||||
} )
|
||||
|
||||
function MedicNotif( msg, time )
|
||||
|
||||
local time = time or 10
|
||||
|
||||
NotificationTable_Venatuss[#NotificationTable_Venatuss + 1] = {
|
||||
text = msg,
|
||||
apptime = CurTime() + 0.2,
|
||||
timeremove = CurTime() + 0.2 + 1 + time,
|
||||
type = "medic",
|
||||
}
|
||||
|
||||
end
|
||||
|
||||
local iconMat = Material( "materials/heart_attack_icon.png" )
|
||||
|
||||
hook.Add("HUDPaint", "MedicMod.HUDNotifications", function()
|
||||
|
||||
for k, v in pairs( NotificationTable_Venatuss ) do
|
||||
if v.type == "medic" then
|
||||
if v.timeremove - CurTime() < 0 then table.remove(NotificationTable_Venatuss,k) continue end
|
||||
|
||||
local alpha = ( math.Clamp(CurTime() - v.apptime, 0 , 1) )
|
||||
local posy = ScrH() - 200 - 60 * k - 40 * ( 1 - ( math.Clamp(CurTime() - v.apptime, 0 , 1) ) )
|
||||
local posx = math.Clamp(v.timeremove - CurTime(),0,0.25) * 4 * 30 + (0.25 - math.Clamp(v.timeremove - CurTime(),0,0.25)) * 4 * - 340
|
||||
|
||||
surface.SetFont( "Bariol20" )
|
||||
local x,y = surface.GetTextSize( v.text )
|
||||
|
||||
draw.RoundedBox( 5, posx, posy , 60, 40, Color(0, 131, 167,255 * alpha ) )
|
||||
|
||||
surface.SetDrawColor( 255, 255, 255, 255 * alpha )
|
||||
surface.DrawRect( posx + 50, posy, 20 + x, 40 )
|
||||
|
||||
surface.SetMaterial( iconMat )
|
||||
surface.DrawTexturedRect( posx + 10, posy + 5, 30, 30 )
|
||||
|
||||
|
||||
surface.SetTextPos( posx + 50 + 10, posy + 40/2-y/2 )
|
||||
surface.SetTextColor( 0, 0, 0, 255 * alpha)
|
||||
surface.DrawText( v.text )
|
||||
end
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
net.Receive("MedicMod:NotifyPlayer", function()
|
||||
local msg = net.ReadString()
|
||||
local time = net.ReadInt( 32 )
|
||||
MedicNotif( msg, time )
|
||||
end)
|
||||
Reference in New Issue
Block a user