-
-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(radialmenu): Move logic to separate files for each framework (…
…#297) * refactor(radialmenu): Move to logic separate files for each framework * refactor(client): Remove unused variable
- Loading branch information
1 parent
db5090d
commit def920a
Showing
5 changed files
with
86 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
if not Radial.IsOX() then return end | ||
|
||
function Radial.Add(title, event) | ||
lib.addRadialItem({ | ||
id = Radial.MenuID, | ||
icon = "shirt", | ||
label = title, | ||
event = event, | ||
onSelect = function() | ||
TriggerEvent(event) | ||
end | ||
}) | ||
end | ||
|
||
function Radial.Remove() | ||
lib.removeRadialItem(Radial.MenuID) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
if not Radial.IsQB() then return end | ||
|
||
function Radial.Add(title, event) | ||
exports["qbx-radialmenu"]:AddOption({ | ||
id = Radial.MenuID, | ||
title = title, | ||
icon = "shirt", | ||
type = "client", | ||
event = event, | ||
shouldClose = true | ||
}, Radial.MenuID) | ||
end | ||
|
||
function Radial.Remove() | ||
exports["qbx-radialmenu"]:RemoveOption(Radial.MenuID) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
Radial = {} | ||
|
||
Radial.MenuID = "open_clothing_menu" | ||
|
||
local radialOptionAdded = false | ||
|
||
function Radial.IsOX() | ||
return GetResourceState("ox_lib") ~= "missing" and Config.UseOxRadial | ||
end | ||
|
||
function Radial.IsQB() | ||
return GetResourceState("qb-radialmenu") ~= "missing" | ||
end | ||
|
||
function Radial.AddOption(currentZone) | ||
if not Config.UseRadialMenu then return end | ||
|
||
if not currentZone then | ||
Radial.Remove() | ||
return | ||
end | ||
local event, title | ||
local zoneEvents = { | ||
clothingRoom = {"illenium-appearance:client:OpenClothingRoom", _L("menu.title")}, | ||
playerOutfitRoom = {"illenium-appearance:client:OpenPlayerOutfitRoom", _L("menu.outfitsTitle")}, | ||
clothing = {"illenium-appearance:client:openClothingShopMenu", _L("menu.clothingShopTitle")}, | ||
barber = {"illenium-appearance:client:OpenBarberShop", _L("menu.barberShopTitle")}, | ||
tattoo = {"illenium-appearance:client:OpenTattooShop", _L("menu.tattooShopTitle")}, | ||
surgeon = {"illenium-appearance:client:OpenSurgeonShop", _L("menu.surgeonShopTitle")}, | ||
} | ||
if zoneEvents[currentZone.name] then | ||
event, title = table.unpack(zoneEvents[currentZone.name]) | ||
end | ||
|
||
Radial.Add(title, event) | ||
radialOptionAdded = true | ||
end | ||
|
||
function Radial.RemoveOption() | ||
if radialOptionAdded then | ||
Radial.Remove() | ||
radialOptionAdded = false | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters