Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
Finish buff tray
Browse files Browse the repository at this point in the history
  • Loading branch information
Pluviolithic committed Nov 27, 2023
1 parent 71005be commit e12edd8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/client/UI/BuffsUI.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
local Players = game:GetService "Players"
local StarterPlayer = game:GetService "StarterPlayer"
local UserInputService = game:GetService "UserInputService"
local ReplicatedStorage = game:GetService "ReplicatedStorage"
local MarketplaceService = game:GetService "MarketplaceService"

local selectors = require(ReplicatedStorage.Common.State.selectors)
local clockUtils = require(ReplicatedStorage.Common.Utils.ClockUtils)
local store = require(StarterPlayer.StarterPlayerScripts.Client.State.Store)
local RobuxShop = require(StarterPlayer.StarterPlayerScripts.Client.UI.Shops.RobuxShop)
local playerStatePromise = require(StarterPlayer.StarterPlayerScripts.Client.State.PlayerStatePromise)

local player = Players.LocalPlayer
Expand Down Expand Up @@ -55,6 +57,29 @@ buffTray.Frame.SpeedDebuff.Activated:Connect(function()
MarketplaceService:PromptProductPurchase(player, productIDs["2xSpeed"].Value)
end)

for _, buffDisplay in buffTray.Frame:GetChildren() do
buffDisplay.MouseEnter:Connect(function()
if not UserInputService.MouseEnabled then
return
end
buffDisplay.Description.Visible = true
end)

buffDisplay.MouseLeave:Connect(function()
if not UserInputService.MouseEnabled then
return
end
buffDisplay.Description.Visible = false
end)

if not buffDisplay.Name:match "Boost" then
continue
end
buffDisplay.Activated:Connect(function()
RobuxShop:OpenSubShop "Boosts"
end)
end

playerStatePromise:andThen(function()
updateBuffTray(store:getState())
store.changed:connect(updateBuffTray)
Expand Down
6 changes: 6 additions & 0 deletions src/client/UI/Shops/RobuxShop.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ function RobuxShop:_closeFramesWithExclude(exclude)
end
end

function RobuxShop:OpenSubShop(subShopName: string)
self:setEnabled(true)
self._ui.Background[subShopName .. "Frame"].Visible = true
self:_closeFramesWithExclude(self._ui.Background[subShopName .. "Frame"])
end

function RobuxShop:Refresh()
local bestAreaUnlocked = rankUtils.getBestUnlockedArea(selectors.getStat(store:getState(), player.Name, "Strength"))
for _, areaFrame in self._ui.Background.FearFrame:GetChildren() do
Expand Down

0 comments on commit e12edd8

Please sign in to comment.