Polish Trophy Hunt pickups and feedback
This commit is contained in:
1 parent
9fb926537c
commit
0c949fadf0
10 files changed
+156
-11
No files matched your search
@@ -0,0 +1,22 @@
|
||||
--!strict
|
||||
local rs=game:GetService("ReplicatedStorage")
|
||||
local S=require(rs.Hunter.Strings).trophyHints
|
||||
local H=require(rs.Hunter.Hints)
|
||||
local Provider={}
|
||||
function Provider.candidates(_match: Instance, player: Player): {H.Hint}
|
||||
local count=player:GetAttribute("ArenaTokens")
|
||||
if typeof(count)=="number" and count>=3 then
|
||||
return {{key="th_bank",text=string.format(S.carry,count),priority=70,ttl=.4}}
|
||||
end
|
||||
local root=player.Character and player.Character.PrimaryPart
|
||||
local world=workspace:FindFirstChild("ProceduralArena")
|
||||
local folder=world and world:FindFirstChild("MatchObjectives")
|
||||
if not root or not folder then return {} end
|
||||
for _,token in folder:GetChildren() do
|
||||
if token.Name=="Tokens" and token:IsA("BasePart") and (root.Position-token.Position).Magnitude<18 then
|
||||
return {{key="th_near",text=S.near,priority=30,ttl=.4}}
|
||||
end
|
||||
end
|
||||
return {}
|
||||
end
|
||||
return Provider
|
||||
@@ -62,6 +62,15 @@ local function event(kind: string, p: any)
|
||||
elseif p.side == player:GetAttribute("ArenaTeam") then S.flagHints.picked else S.flagHints.enemyPicked
|
||||
bannerUntil = workspace:GetServerTimeNow() + 2.7
|
||||
end
|
||||
if id == "TrophyHunt" and p.userId == player.UserId then
|
||||
if kind == Kinds.TokensBanked then
|
||||
contour:SetAttribute("Accent", tone)
|
||||
title.Text = string.format(S.trophyHints.banked, p.value or 0)
|
||||
bannerUntil = workspace:GetServerTimeNow() + 2.7
|
||||
elseif kind == Kinds.TokensLost then
|
||||
pending = {key="th_lost",priority=60,text=S.trophyHints.lost,ttl=4}
|
||||
end
|
||||
end
|
||||
if id == "Domination" then
|
||||
if kind == Kinds.ZoneLost and p.side == player:GetAttribute("ArenaTeam") then
|
||||
pending = {key="dp_lost",priority=70,text=S.domination.lost(string.sub(p.text or "A",1,1)),ttl=4}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
--!strict
|
||||
local rs=game:GetService("ReplicatedStorage")
|
||||
local Players=game:GetService("Players")
|
||||
local RunService=game:GetService("RunService")
|
||||
local TweenService=game:GetService("TweenService")
|
||||
local UI=require(rs:WaitForChild("HunterUI") :: ModuleScript)
|
||||
local Kinds=require(rs.Hunter.EventKinds)
|
||||
local Router=require(script.Parent.EventRouter)
|
||||
local player=Players.LocalPlayer
|
||||
local match=rs:WaitForChild("ArenaRound"):WaitForChild("Procedural")
|
||||
local gui=Instance.new("ScreenGui")
|
||||
gui.Name,gui.DisplayOrder,gui.ResetOnSpawn="TrophyCounter",23,false
|
||||
gui.Parent=player:WaitForChild("PlayerGui")
|
||||
local plate=UI.plate(gui,"Coins",UDim2.new(1,-16,1,-80),UDim2.fromOffset(106,48),UI.Gold)
|
||||
plate.AnchorPoint=Vector2.new(1,1)
|
||||
local art=UI.element("GoldCoin",plate,UDim2.fromOffset(6,4),UDim2.fromOffset(40,40)) :: Frame
|
||||
local rig=UI.bindCoin(art)
|
||||
local label=UI.label(plate,"Count","×0",UDim2.fromOffset(47,0),UDim2.fromOffset(52,48),24,UI.Gold)
|
||||
label.FontFace=UI.Display
|
||||
local scale=Instance.new("UIScale",plate)
|
||||
local bounce: Tween?=nil
|
||||
local last=0
|
||||
local function update()
|
||||
local count=player:GetAttribute("ArenaTokens")
|
||||
local n=if typeof(count)=="number" then count else 0
|
||||
gui.Enabled=player:GetAttribute("InArena")==true and match:GetAttribute("Ruleset")=="TrophyHunt" and match:GetAttribute("Phase")=="Round"
|
||||
label.Text="×"..n
|
||||
if gui.Enabled and n>last then
|
||||
if bounce then bounce:Cancel() end
|
||||
scale.Scale=1.18
|
||||
bounce=TweenService:Create(scale,TweenInfo.new(.32,Enum.EasingStyle.Back,Enum.EasingDirection.Out),{Scale=1})
|
||||
bounce:Play()
|
||||
end
|
||||
last=n
|
||||
end
|
||||
local connections={player:GetAttributeChangedSignal("ArenaTokens"):Connect(update),player:GetAttributeChangedSignal("InArena"):Connect(update),
|
||||
match:GetAttributeChangedSignal("Ruleset"):Connect(update),match:GetAttributeChangedSignal("Phase"):Connect(update)}
|
||||
local draw=RunService.RenderStepped:Connect(function()
|
||||
if not gui.Enabled then return end
|
||||
local t=os.clock()
|
||||
UI.spinCoin(rig,t*2,math.max(0,math.cos(t*2))*.55,t%1)
|
||||
end)
|
||||
|
||||
local pool: {Part}={}
|
||||
local motions: {[Part]: Tween}={}
|
||||
for i=1,6 do
|
||||
local coin=Instance.new("Part")
|
||||
coin.Name="TrophySpark"
|
||||
coin.Shape,coin.Material,coin.Color=Enum.PartType.Cylinder,Enum.Material.Neon,UI.Gold
|
||||
coin.Size=Vector3.new(.12,.62,.62)
|
||||
coin.Anchored,coin.CanCollide,coin.CanQuery,coin.CanTouch=true,false,false,false
|
||||
coin.Transparency=1
|
||||
coin.Parent=workspace
|
||||
table.insert(pool,coin)
|
||||
end
|
||||
local off=Router.on(Kinds.TokenDropped,function(payload)
|
||||
if not gui.Enabled or typeof(payload.at)~="Vector3" then return end
|
||||
for i,coin in pool do
|
||||
if motions[coin] then motions[coin]:Cancel() end
|
||||
local a=i*math.pi/3
|
||||
local from=payload.at+Vector3.yAxis*.7
|
||||
coin.CFrame=CFrame.new(from)*CFrame.Angles(a,0,0)
|
||||
coin.Transparency=.1
|
||||
local tween=TweenService:Create(coin,TweenInfo.new(.55,Enum.EasingStyle.Quad,Enum.EasingDirection.Out),
|
||||
{CFrame=CFrame.new(from+Vector3.new(math.cos(a)*4,2.4,math.sin(a)*4))*CFrame.Angles(a,1.7,1),Transparency=1})
|
||||
motions[coin]=tween
|
||||
tween:Play()
|
||||
end
|
||||
end)
|
||||
update()
|
||||
script.Destroying:Once(function()
|
||||
draw:Disconnect()
|
||||
for _, cn in connections do cn:Disconnect() end
|
||||
off()
|
||||
for _, coin in pool do
|
||||
if motions[coin] then motions[coin]:Cancel() end
|
||||
coin:Destroy()
|
||||
end
|
||||
gui:Destroy()
|
||||
end)
|
||||
Reference in new issue
Block a user