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

Commit

Permalink
Finishing changes for popups part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Pluviolithic committed Dec 5, 2023
1 parent 94e18d1 commit 9312973
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 14 deletions.
32 changes: 20 additions & 12 deletions src/client/Areas/Barriers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ local AFKUnlockUIOffTween = TweenService:Create(
{ Transparency = 1 }
)

AFKUnlockUIOnTween.Completed:Connect(function()
task.wait(6)
AFKUnlockUIOffTween:Play()
AFKUnlockUIOffTween.Completed:Wait()
AFKUnlockUI.Visible = false
end)

local function unlockArea(areaName: string, lock: boolean?)
for _, barrier in CollectionService:GetTagged(areaName .. "Barrier") do
local barrierUI = barrier:FindFirstChild "BarrierLockDisplay"
Expand All @@ -48,27 +55,28 @@ local function unlockArea(areaName: string, lock: boolean?)
end
end

local function unlockAreas()
local function unlockAreas(oldWasLoaded)
for _, requirement in areaRequirements:GetChildren() do
if requirement.Value > selectors.getStat(store:getState(), player.Name, "Strength") then
unlockArea(requirement.Name, true)
else
unlockArea(requirement.Name)
if not unlockedAreas[requirement.Name] then
unlockedAreas[requirement.Name] = true
PopupUI("New Area Unlocked!", Color3.fromRGB(250, 250, 250))
workspace.Beams[requirement.Name].Beam.Attachment1 = player.Character.HumanoidRootPart.RootAttachment

if requirement.Name == "Howling Woods" then
if oldWasLoaded then
PopupUI("New Area Unlocked!", Color3.fromRGB(250, 250, 250))
end

if workspace.Beams:FindFirstChild(requirement.Name) and oldWasLoaded then
workspace.Beams[requirement.Name].Beam.Attachment1 =
player.Character.HumanoidRootPart.RootAttachment
end

if requirement.Name == "Howling Woods" and oldWasLoaded then
AFKUnlockUI.Transparency = 1
AFKUnlockUI.Visible = true
AFKUnlockUIOnTween:Play()
AFKUnlockUIOnTween.Completed:Wait()
task.delay(6, function()
AFKUnlockUIOffTween:Play()
AFKUnlockUIOffTween.Completed:Wait()
AFKUnlockUI.Visible = false
end)
end
end
end
Expand Down Expand Up @@ -113,7 +121,7 @@ local function handleTeleporter(teleporter)
end

playerStatePromise:andThen(function()
unlockAreas()
unlockAreas(false)
store.changed:connect(function(newState, oldState)
if
selectors.isPlayerLoaded(oldState, player.Name)
Expand All @@ -122,7 +130,7 @@ playerStatePromise:andThen(function()
then
return
end
unlockAreas()
unlockAreas(selectors.isPlayerLoaded(oldState, player.Name))
end)
end)

Expand Down
4 changes: 2 additions & 2 deletions src/client/UI/Combat/StrengthMeters.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ function StrengthMeters:Refresh(): ()
local strength = selectors.getStat(store:getState(), player.Name, "Strength")
local newRank = selectors.getStat(store:getState(), player.Name, "Rank")

if newRank ~= self._currentRank then
if self._currentRank and newRank ~= self._currentRank then
PopupUI(`You Leveled Up To Rank {newRank}!`, Color3.fromRGB(250, 250, 250))
PopupUI(
`Your Fear Meter Increased To {selectors.getStat(store:getState(), player.Name, "MaxFearMeter")}!`,
Color3.fromRGB(250, 250, 250)
)
self._currentRank = newRank
end
self._currentRank = newRank

for _, meter in meters do
if not meter:IsA "ImageLabel" then
Expand Down
39 changes: 39 additions & 0 deletions src/client/UI/Shops/WeaponShop.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
local Players = game:GetService "Players"
local TweenService = game:GetService "TweenService"
local StarterPlayer = game:GetService "StarterPlayer"
local ReplicatedStorage = game:GetService "ReplicatedStorage"
local MarketplaceService = game:GetService "MarketplaceService"
Expand All @@ -23,6 +24,27 @@ local gamepassPrices = ReplicatedStorage.Config.GamepassData.Prices
local WeaponShop = CentralUI.new(player.PlayerGui:WaitForChild "WeaponShop")
local mainUI = player.PlayerGui:WaitForChild "MainUI"
local confirmationUIInstance = mainUI.WeaponShop.Confirmation
local currentTargetPrice = math.huge
local lastCanAffordNotification = -1
local canAffordNotificationUI = player.PlayerGui:WaitForChild("ScreenEffects").Unlocks.Weapon

local canAffordNotificationUIOnTween = TweenService:Create(
canAffordNotificationUI,
TweenInfo.new(0.4, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
{ Transparency = 0 }
)
local canAffordNotificationUIOffTween = TweenService:Create(
canAffordNotificationUI,
TweenInfo.new(0.4, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
{ Transparency = 1 }
)

canAffordNotificationUIOnTween.Completed:Connect(function()
task.wait(6)
canAffordNotificationUIOffTween:Play()
canAffordNotificationUIOffTween.Completed:Wait()
canAffordNotificationUI.Visible = false
end)

WeaponShop.Trigger = "WeaponShop"
WeaponShop._itemButtons = WeaponShop._ui.LeftBackground.ScrollingFrame:GetChildren()
Expand All @@ -33,6 +55,18 @@ function WeaponShop:_initialize(): ()
return
end

if
selectors.getStat(newState, player.Name, "Gems") >= currentTargetPrice
and currentTargetPrice < selectors.getStat(oldState, player.Name, "Gems")
and os.time() - lastCanAffordNotification > 300
and selectors.isPlayerLoaded(oldState, player.Name)
then
lastCanAffordNotification = os.time()
canAffordNotificationUI.Transparency = 1
canAffordNotificationUI.Visible = true
canAffordNotificationUIOnTween:Play()
end

if
selectors.getEquippedWeapon(newState, player.Name) ~= selectors.getEquippedWeapon(oldState, player.Name)
or not Table.ShallowIsEqual(
Expand Down Expand Up @@ -205,6 +239,11 @@ function WeaponShop:Refresh(): ()
button.GemPrice.Visible = true
button.Icon.Visible = true
restAreLocked = true

local price = weapons[button.Name]:FindFirstChild "Price"
if price then
currentTargetPrice = price.Value
end
else
-- this item is not unlocked
button.Locked.Visible = true
Expand Down

0 comments on commit 9312973

Please sign in to comment.