Skip to content
This repository has been archived by the owner on Aug 20, 2022. It is now read-only.

UIInstance

benank edited this page Aug 19, 2020 · 2 revisions

The UIInstance class is a client-side class used to store information about a specific instance of UI. For example, your game might have a scoreboard, and you might want to display it using HTML, CSS, and JS. You'll have one UIInstance for your scoreboard so you can easily transfer data to and from it and manipulate it.

Note: only the UI instance on top will receive mouse clicks. To receive mouse clicks in other UI instances, consider restricting the size of the UI instance using the css argument of UI:Create.

To create a new UIInstance, use UI:Create

UIInstance:CallEvent(event_name, data)

  • Calls an event on a specific UI instance.
  • event_name (string): name of the event that you want to call
  • data (table): table of data you want to send with the event

UIInstance:Subscribe(event_name, callback)

  • Subscribes to an event called from the Javascript portion of the UI instance, meaning that when the JS code calls OOF.CallEvent(event_name, data), it will be received here.
  • event_name (string): name of the event you want to subscribe to
  • callback (function): function to be called when the event name is called from the UI

UIInstance:Hide()

  • Hides this UI instance.

UIInstance:Show()

  • Shows this UI instance.

UIInstance:GetVisible()

  • Returns whether or not this UI instance is visible or not.

UIInstance:BringToFront()

  • Brings this UI instance to the front of all other UI instances. Good for when you want something to display on top, like chat or a scoreboard.

UIInstance:SendToBack()

  • Sends this UI instance to the back behind all other UI instances.

UIInstance:Remove()

  • Removes this UI instance entirely. It no longer exists.
Clone this wiki locally