diff --git a/docs/api-reference.md b/docs/api-reference.md index a6105c5..85aa25b 100644 --- a/docs/api-reference.md +++ b/docs/api-reference.md @@ -1,11 +1,17 @@ -Purse unlocks APIs for the CoreGui backpack which were previously locked to other CoreGui scripts. To access the APIs, just require Purse like any other [module script]: +Purse unlocks APIs for the CoreGui backpack which were previously locked to other CoreGui scripts. To access the APIs, just require Purse like any other [module script]. -``` lua title="Toggle Inventory Example" +``` lua title="LocalScript - Inventory Toggle Button" linenums="1" local ReplicatedStorage = game:GetService("ReplicatedStorage") local Purse = require(ReplicatedStorage.Purse) -Purse.OpenClose() -- Toggle the inventory +local button = script.Parent + +local function onButtonActivated() + Purse.OpenClose() -- Toggle the inventory +end + +button.Activated:Connect(onButtonActivated) ``` [module script]: https://create.roblox.com/docs/reference/engine/classes/ModuleScript @@ -14,99 +20,103 @@ Purse.OpenClose() -- Toggle the inventory ### OpenClose -Toggles the backpack open/closed state. If the backpack is currently open, it will close it. If closed, it will open it. +``` +OpenClose(): () +``` + +Toggles whether or not the inventory is visible. + +### IsInventoryEmpty + +``` +IsInventoryEmpty(): boolean +``` + +Returns true if the inventory is empty. ## Properties ### IsHotbarVisible -Returns if the hotbar is currently visible to the player. - -#### Returns +``` +IsHotbarVisible: boolean +``` -[boolean] +Determines whether or not the hotbar is visible. ### IsOpen -Returns if the inventory is currently open to the player. - -#### Returns +``` +IsOpen: boolean +``` -[boolean] +Returns true if the inventory is open. ### ModuleName -Returns the module name. This will always return "Backpack". - -#### Returns +``` +ModuleName: string +``` -[string] +Returns "Backpack". ### KeepVRTopbarOpen -Returns `true`. - -#### Returns +``` +KeepVRTopbarOpen: boolean +``` -[boolean] +Returns true. ### VRIsExclusive -Returns `true`. - -#### Returns +``` +VRIsExclusive: boolean +``` -[boolean] +Returns true. ### VRClosesNonExclusive -Returns `true`. - -#### Returns - -[boolean] - -### IsInventoryEmpty - -Returns if the inventory is empty. - -#### Returns +``` +VRClosesNonExclusive: boolean +``` -[boolean] +Returns true. ## Events ### StateChanged -Fires when the backpack is closed or opened. - -#### Returns +``` +StateChanged(isNowOpen: boolean): BindableEvent +``` -[BindableEvent] +Fires after the inventory is opened or closed. ### BackpackEmpty -Fires when the inventory is empty. - -#### Returns +``` +BackpackEmpty(): BindableEvent +``` -[BindableEvent] +Fires when the backpack becomes empty. ### BackpackItemAdded -Fires when a item is added to the inventory. - -#### Returns +``` +BackpackItemAdded(): BindableEvent +``` -[BindableEvent] +Fires when an item is added to the backpack. ### BackpackItemRemoved -Fires when a item is removed from the inventory. - -#### Returns +``` +BackpackItemRemoved(): BindableEvent +``` -[BindableEvent] +Fires when an item is removed from the backpack. [BindableEvent]: https://create.roblox.com/docs/reference/engine/classes/BindableEvent [boolean]: https://create.roblox.com/docs/luau/booleans diff --git a/mkdocs.yml b/mkdocs.yml index 9fdf29a..c9042a5 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -53,10 +53,7 @@ markdown_extensions: - attr_list - toc: permalink: true - toc_depth: 3 - pymdownx.superfences - - pymdownx.highlight: - linenums: true nav: - Home: index.md