All pastes #676107 Raw Edit

Miscellany

public text v1 · immutable
#676107 ·published 2007-08-30 19:53 UTC
rendered paste body
-- Is the player creating a character ?
IsCreatingCharacter = true

function DSRP.HideHUDCharCreation()
	if IsCreatingCharacter then
		return false
	end
end
hook.Add("HUDPaint", "DSRP.HideHUDCharCreation", DSRP.HideHUDCharCreation)

-- Define parent panel -- this won't be a frame, it will be a Panel derive unlike the rest D:
local PANEL = {}

-- init function
function PANEL:Init()
		gui.EnableScreenClicker(true)
		self:SetSize(ScrW(),ScrH())
		self:SetPos(0,0)
		self:SetZPos(600)
		
		-- Make the biography buttonz
		local biography = vgui.Create("Button",self)	
		biography:SetText("Biography")
		biography:SetPos(surface.ScreenWidth() / 2 - ( surface.ScreenWidth() / 16 ) ,75)
		function biography:DoClick( )
			local bio = vgui.Create("DSRP.Biography",self:GetParent())
			bio:SetVisible( true )
			bio:MakePopup()
			bio.Color = Color(170,170,170,255)
		end
		
		
end

-- draw function
function PANEL:Paint()
	-- black screen
	draw.RoundedBox( 2, 0, 0, ScrW(), ScrH(), Color(0,0,0,255) )
	-- Show the "Character creation screen" thingy title in the top
	draw.SimpleText( "Character creation menu", "ScoreboardHead", ScrW() / 2, 50, Color(0,0,0,255), 1, 1)
end

vgui.Register("DSRP.PlayerCreateParent", PANEL, "Panel")

local PANEL = {}

function PANEL:Init()
	gui.EnableScreenClicker(true)
	self:PostMessage( "SetTitle", "text", "Biography" )
	
	-- Position & Size them
	self:SetPos(ScrW() / 4,ScrH() / 4)
	self:SetSize(ScrW() / 2, ScrH() / 2)
	self:SetZPos(7000)
	
	-- Set name button
	if !LocalPlayer():GetTable().CharName then
		LocalPlayer():GetTable().CharName = ""
	end
	local namebut = vgui.Create("Button",self)
	namebut:SetText("Set Name")
	namebut:SetPos(5,25)
	function namebut:DoClick( )
		local nameinput = vgui.Create("TextEntry",self:GetParent())
		nameinput:SetPos(self:GetParent():GetWide() / 2 - (nameinput:GetWide() / 2),self:GetParent():GetTall() / 2 - (nameinput:GetTall() / 2))
		nameinput:SetSize(200,20)
		
		local finishname = vgui.Create("Button",self:GetParent())
		finishname:SetText("Done setting name")
		finishname:SetPos(nameinput.x,nameinput.y + 20)
		finishname:SetSize(nameinput:GetWide(),nameinput:GetTall())
		function finishname:DoClick( )
			LocalPlayer():GetTable().CharName = nameinput:GetValue()
			finishname:SetVisible(false)
			inputname:SetVisible(false)
		end
	end 
end

function PANEL:Paint()
	draw.RoundedBox( 2, 0, 0, ScrW(), ScrH(), Color(170,170,170,255) )
	return true
end

vgui.Register("DSRP.Biography", PANEL, "Frame")

local pop = vgui.Create("DSRP.PlayerCreateParent")
pop:MakePopup()
pop:SetVisible(true)


function PANEL:Init()
gui.EnableScreenClicker(true)
	self:PostMessage( "SetTitle", "text", "Character Creation" )
	
	-- Position & Size them
	self:SetPos(ScrW() / 4,ScrH() / 4)
	self:SetSize(ScrW() / 2, ScrH() / 2)

	-- Image of current player model
	local model = vgui.Create("SpawnIcon",self)
	model:SetModel( LocalPlayer():GetModel() )	
	model:SetPos(self:GetWide() / 2 - (64 / 2), self:GetTall() / 2 - (self:GetTall() / 2) + 10)
	model:SetSize( 64, 64 )
	
	-- Set name button
	if !LocalPlayer():GetTable().CharName then
		LocalPlayer():GetTable().CharName = ""
	end
	local namebut = vgui.Create("Button",self)
	namebut:SetText("Set Name")
	namebut:SetPos(5,25)
	function namebut:DoClick( )
		local nameinput = vgui.Create("TextEntry",self:GetParent())
		nameinput:SetPos(self:GetParent():GetWide() / 2 - (nameinput:GetWide() / 2),self:GetParent():GetTall() / 2 - (nameinput:GetTall() / 2))
		nameinput:SetSize(200,20)
		
		local finishname = vgui.Create("Button",self:GetParent())
		finishname:SetText("Done setting name")
		finishname:SetPos(nameinput.x,nameinput.y + 20)
		finishname:SetSize(nameinput:GetWide(),nameinput:GetTall())
		function finishname:DoClick( )
			LocalPlayer():GetTable().CharName = nameinput:GetValue()
			finishname:SetVisible(false)
			inputname:SetVisible(false)
		end
	end 
	
end

function PANEL:Paint()
        -- draw.RoundedBox(4,0,0,self:GetWide(),self:GetTall(),Color(0,0,0,255))
         draw.RoundedBox(4,2,2,self:GetWide()-4,self:GetTall()-4,Color(180,180,180,200))
end