Jump to content

Recommended Posts

Hello.
I'm trying to understand how widgets work, someone could give a didactic explanation. An explanation of when to use AddClassPostConstruct (); Class (Widget, function (self, ...)).
For example, if I want to remove that inventory bar, image below, and add another image, what should I do?

image.thumb.png.b300e44c77a954d65043496b51f69e29.png

Thanks in advance.

Link to comment
https://forums.kleientertainment.com/forums/topic/121487-how-to-use-widgets/
Share on other sites

For the example above, I solved it with the code below. But I still want an explanation of how the widgets work, if anyone can do this favor, I appreciate it.

AddClassPostConstruct("widgets/inventorybar", function(self, owner)   
	self.bgcover:Kill() 
	self.bg:Kill()
	repeat
		table.remove(self.equipslotinfo)
	until #self.equipslotinfo==0
	function Inv:SelectDefaultSlot()
	end
end)

 

Widgets are UI elements. AddClassPostConstruct is called whenever the specified widget type is made. Beyond that, there isn't really anything super special. The Class function is just used for making a class.

Edited by penguin0616
  • Like 2

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...