1
This commit is contained in:
commit
a85391509d
211 files changed
+28903
No files matched your search
@@ -0,0 +1,950 @@
|
||||
--!strict
|
||||
local ContextActionService = game:GetService("ContextActionService")
|
||||
local Players = game:GetService("Players")
|
||||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||
local RunService = game:GetService("RunService")
|
||||
local StarterGui = game:GetService("StarterGui")
|
||||
local TweenService = game:GetService("TweenService")
|
||||
local UserInputService = game:GetService("UserInputService")
|
||||
local UI = require(ReplicatedStorage:WaitForChild("HunterUI") :: ModuleScript)
|
||||
local Modes = require(ReplicatedStorage:WaitForChild("ArenaModes") :: ModuleScript)
|
||||
local Rules = require(ReplicatedStorage:WaitForChild("MatchRules") :: ModuleScript)
|
||||
local Sounds = require(ReplicatedStorage:WaitForChild("SniperEffects") :: ModuleScript)
|
||||
|
||||
local player = Players.LocalPlayer
|
||||
local playerGui = player:WaitForChild("PlayerGui")
|
||||
local state = ReplicatedStorage:WaitForChild("ArenaRound")
|
||||
local results = state:WaitForChild("RoundResults") :: RemoteEvent
|
||||
local limit = state:GetAttribute("TeamLimit") :: number
|
||||
local modeIds = {Modes.Procedural}
|
||||
local function currentMode(): string
|
||||
return Modes.Procedural
|
||||
end
|
||||
local function activeState(): Instance
|
||||
return Modes.state(state, currentMode())
|
||||
end
|
||||
|
||||
local ink, muted, panelColor = UI.Ink, UI.Muted, UI.Panel
|
||||
local blue, orange = UI.Blue, UI.Orange
|
||||
local blueDark = Color3.fromRGB(15, 55, 75)
|
||||
local orangeDark = Color3.fromRGB(99, 48, 35)
|
||||
|
||||
local gui = Instance.new("ScreenGui")
|
||||
gui.Name = "ArenaRoundHud"
|
||||
gui.ResetOnSpawn = false
|
||||
gui.DisplayOrder = 25
|
||||
gui.Parent = playerGui
|
||||
|
||||
local function frame(name: string, parent: Instance, position: UDim2, size: UDim2, color: Color3): Frame
|
||||
local item = Instance.new("Frame")
|
||||
item.Name = name
|
||||
item.Position = position
|
||||
item.Size = size
|
||||
item.BackgroundColor3 = color
|
||||
item.BorderSizePixel = 0
|
||||
item.Parent = parent
|
||||
return item
|
||||
end
|
||||
|
||||
local function corners(item: GuiObject, radius: number)
|
||||
Instance.new("UICorner", item).CornerRadius = UDim.new(0, radius)
|
||||
end
|
||||
|
||||
|
||||
local function gradient(item: GuiObject, light: Color3, dark: Color3, angle: number)
|
||||
item.BackgroundColor3 = Color3.new(1, 1, 1)
|
||||
local tint = Instance.new("UIGradient")
|
||||
tint.Color = ColorSequence.new(light, dark)
|
||||
tint.Rotation = angle
|
||||
tint.Parent = item
|
||||
return tint
|
||||
end
|
||||
|
||||
local function label(parent: Instance, text: string, position: UDim2, size: UDim2, fontSize: number, color: Color3): TextLabel
|
||||
local item = Instance.new("TextLabel")
|
||||
item.BackgroundTransparency = 1
|
||||
item.Text = text
|
||||
item.TextColor3 = color
|
||||
item.TextSize = fontSize
|
||||
item.Font = Enum.Font.GothamMedium
|
||||
item.Position = position
|
||||
item.Size = size
|
||||
item.Parent = parent
|
||||
return item
|
||||
end
|
||||
|
||||
local portraitCache: {[number]: {url: string?, waiting: {[ImageLabel]: boolean}}} = {}
|
||||
|
||||
local function portrait(parent: Instance, position: UDim2, size: number, accent: Color3): ImageLabel
|
||||
local image = UI.portrait(parent, position, size, accent)
|
||||
local initial = image:WaitForChild("Initial") :: TextLabel
|
||||
initial.TextSize = math.floor(size * .48)
|
||||
image:GetPropertyChangedSignal("IsLoaded"):Connect(function()
|
||||
initial.Visible = image.Image == "" or not image.IsLoaded
|
||||
end)
|
||||
return image
|
||||
end
|
||||
|
||||
local function setPortrait(image: ImageLabel, userId: number?, displayName: string?)
|
||||
image.Visible = userId ~= nil
|
||||
if image:GetAttribute("UserId") == userId then return end
|
||||
image:SetAttribute("UserId", userId)
|
||||
image.Image = ""
|
||||
local initial = image.Initial :: TextLabel
|
||||
initial.Visible = true
|
||||
local name = displayName or ""
|
||||
initial.Text = name:sub(1, (utf8.offset(name, 2) or (#name + 1)) - 1):upper()
|
||||
if not userId or userId <= 0 then return end
|
||||
local cached = portraitCache[userId]
|
||||
if cached then
|
||||
if cached.url then
|
||||
image.Image = cached.url
|
||||
initial.Visible = not image.IsLoaded
|
||||
else
|
||||
cached.waiting[image] = true
|
||||
end
|
||||
return
|
||||
end
|
||||
local entry: {url: string?, waiting: {[ImageLabel]: boolean}} = {url = nil, waiting = {[image] = true}}
|
||||
portraitCache[userId] = entry
|
||||
task.spawn(function()
|
||||
for attempt = 1, 3 do
|
||||
local ok, url, ready = pcall(Players.GetUserThumbnailAsync, Players, userId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size100x100)
|
||||
if ok and ready then
|
||||
entry.url = url
|
||||
for target in entry.waiting do
|
||||
if target.Parent and target:GetAttribute("UserId") == userId then
|
||||
target.Image = url
|
||||
local fallback = target.Initial :: TextLabel
|
||||
fallback.Visible = not target.IsLoaded
|
||||
end
|
||||
end
|
||||
break
|
||||
end
|
||||
if attempt < 3 then task.wait(attempt * .75) end
|
||||
end
|
||||
table.clear(entry.waiting)
|
||||
if not entry.url then portraitCache[userId] = nil end
|
||||
end)
|
||||
end
|
||||
|
||||
local hudLayout = frame("MatchHUD", gui, UDim2.fromScale(0, 0), UDim2.fromScale(1, 1), panelColor)
|
||||
hudLayout.BackgroundTransparency = 1
|
||||
local widthOfCard = 373
|
||||
local objective = UI.plate(hudLayout, "Objective", UDim2.fromOffset(15, 75), UDim2.fromOffset(widthOfCard, 62), UI.Blue)
|
||||
local objectiveContour = UI.contour(objective, blue)
|
||||
local objectiveScale = Instance.new("UIScale", objective)
|
||||
objective.Visible = false
|
||||
local objectiveTitle = UI.label(objective, "Rule", "", UDim2.fromOffset(16, 7), UDim2.new(1, -32, 0, 21), 18, ink)
|
||||
objectiveTitle.FontFace = UI.Display
|
||||
objectiveTitle.TextXAlignment = Enum.TextXAlignment.Left
|
||||
local objectiveText = UI.label(objective, "Instructions", "", UDim2.fromOffset(16, 29), UDim2.new(1, -32, 0, 31), 14, ink)
|
||||
objectiveText.Font = Enum.Font.GothamMedium
|
||||
objectiveText.TextWrapped = true
|
||||
objectiveText.TextXAlignment = Enum.TextXAlignment.Left
|
||||
objectiveText.TextYAlignment = Enum.TextYAlignment.Top
|
||||
local objectiveStatus = UI.label(objective, "Status", "", UDim2.fromOffset(16, 60), UDim2.new(1, -32, 0, 25), 12, blue)
|
||||
local siegeBar = Instance.new("Frame")
|
||||
siegeBar.Position = UDim2.fromOffset(16, 88)
|
||||
siegeBar.Size = UDim2.new(1, -32, 0, 5)
|
||||
siegeBar.BackgroundColor3 = Color3.fromRGB(34, 45, 65)
|
||||
siegeBar.BorderSizePixel = 0
|
||||
siegeBar.Visible = false
|
||||
siegeBar.Parent = objective
|
||||
local siegeSegments: {Frame} = {}
|
||||
for i = 1, 10 do
|
||||
local segment = Instance.new("Frame")
|
||||
segment.Position = UDim2.fromScale((i - 1) / 10, 0)
|
||||
segment.Size = UDim2.new(.1, -2, 1, 0)
|
||||
segment.BackgroundColor3 = blue
|
||||
segment.BorderSizePixel = 0
|
||||
segment.Parent = siegeBar
|
||||
siegeSegments[i] = segment
|
||||
end
|
||||
objectiveStatus.TextWrapped = true
|
||||
objectiveStatus.TextXAlignment = Enum.TextXAlignment.Left
|
||||
objectiveStatus.TextYAlignment = Enum.TextYAlignment.Top
|
||||
|
||||
local strip = UI.plate(hudLayout, "Timer", UDim2.fromOffset(15, 7), UDim2.fromOffset(widthOfCard, 63), UI.Outline)
|
||||
UI.contour(strip, blue)
|
||||
local scoreScale = Instance.new("UIScale", strip)
|
||||
|
||||
local function scoreCard(id: string, x: number, accent: Color3): TextLabel
|
||||
local tile = UI.element("ScoreChip", strip, UDim2.fromOffset(x, 9), UDim2.fromOffset(88, 45))
|
||||
tile.Name = id .. "Card"
|
||||
UI.tintPlate(tile, accent:Lerp(ink, .19), accent)
|
||||
local score = label(tile, "0", UDim2.fromScale(.5, .5), UDim2.new(1, 0, 0, 38), 31, panelColor)
|
||||
score.AnchorPoint = Vector2.new(.5, .5)
|
||||
score.Name = "Score"
|
||||
score.FontFace = UI.Display
|
||||
return score
|
||||
end
|
||||
|
||||
local blueScore = scoreCard("Blue", 178, blue)
|
||||
local orangeScore = scoreCard("Orange", 274, orange)
|
||||
local center = frame("Center", strip, UDim2.fromOffset(20, 0), UDim2.fromOffset(150, 61), panelColor)
|
||||
center.BackgroundTransparency = 1
|
||||
local separator = frame("Divider", strip, UDim2.fromOffset(161, 15), UDim2.fromOffset(1, 33), UI.Outline)
|
||||
separator.Rotation = 10
|
||||
local mode = label(center, "", UDim2.fromOffset(1, 4), UDim2.new(1, 0, 0, 12), 10, muted)
|
||||
mode.Name = "PhaseLabel"
|
||||
mode.Font = Enum.Font.GothamBold
|
||||
mode.TextXAlignment = Enum.TextXAlignment.Left
|
||||
local clock = label(center, "", UDim2.fromOffset(0, 6), UDim2.new(1, 0, 0, 46), 40, ink)
|
||||
clock.Name = "Clock"
|
||||
clock.FontFace = UI.Display
|
||||
clock.TextXAlignment = Enum.TextXAlignment.Left
|
||||
local roundLine = UI.element("ProgressBar", strip, UDim2.fromOffset(20, 55), UDim2.fromOffset(126, 2))
|
||||
roundLine.Name = "RoundProgress"
|
||||
local roundFill = roundLine:WaitForChild("Fill") :: Frame
|
||||
roundFill.BackgroundColor3 = blue
|
||||
UI.sheen(roundFill)
|
||||
|
||||
local countdown = frame("RoundCountdown", hudLayout, UDim2.new(.5, 0, 0, 12), UDim2.fromOffset(148, 106), panelColor)
|
||||
countdown.AnchorPoint = Vector2.new(.5, 0)
|
||||
countdown.BackgroundTransparency = 1
|
||||
countdown.Visible = false
|
||||
|
||||
local allyCapture = Color3.fromRGB(90, 247, 170)
|
||||
local enemyCapture = Color3.fromRGB(255, 79, 105)
|
||||
local captureHud = UI.plate(hudLayout, "HotPointCapture", UDim2.new(.5, 0, 0, 10), UDim2.fromOffset(384, 52), UI.Outline)
|
||||
captureHud.AnchorPoint, captureHud.Visible = Vector2.new(.5, 0), false
|
||||
local captureArc = UI.contour(captureHud, allyCapture)
|
||||
local captureLabel = UI.label(captureHud, "Status", "", UDim2.fromOffset(14, 5), UDim2.new(1, -77, 0, 24), 15, ink)
|
||||
captureLabel.FontFace = UI.Display
|
||||
captureLabel.TextXAlignment = Enum.TextXAlignment.Left
|
||||
local captureValue = UI.label(captureHud, "Percent", "", UDim2.new(1, -62, 0, 5), UDim2.fromOffset(48, 24), 15, ink)
|
||||
captureValue.FontFace = UI.Display
|
||||
captureValue.TextXAlignment = Enum.TextXAlignment.Right
|
||||
local captureTrack = UI.element("ProgressBar", captureHud, UDim2.fromOffset(14, 34), UDim2.new(1, -28, 0, 8))
|
||||
captureTrack.Name = "CaptureProgress"
|
||||
local captureFill = captureTrack:WaitForChild("Fill") :: Frame
|
||||
captureFill.Size = UDim2.fromScale(0, 1)
|
||||
UI.sheen(captureFill)
|
||||
local captureTween: Tween? = nil
|
||||
local captureTeam: string? = nil
|
||||
local capturePercent = 0
|
||||
local captureCueTeam: string? = nil
|
||||
local captureCuePhase: string? = nil
|
||||
|
||||
local function countdownDigit(name: string, color: Color3, depth: number): TextLabel
|
||||
local digit = label(countdown, "", UDim2.fromScale(.5, .5), UDim2.fromScale(1, 1), 92, color)
|
||||
digit.Name = name
|
||||
digit.AnchorPoint = Vector2.new(.5, .5)
|
||||
digit.FontFace = UI.Display
|
||||
digit.ZIndex = depth
|
||||
return digit
|
||||
end
|
||||
|
||||
local countdownText = countdownDigit("Digit", Color3.fromRGB(255, 62, 79), 14)
|
||||
local countdownOutline = Instance.new("UIStroke", countdownText)
|
||||
countdownOutline.Color = Color3.fromRGB(33, 4, 13)
|
||||
countdownOutline.Thickness = 4
|
||||
local digitScale = Instance.new("UIScale", countdownText)
|
||||
local echo = countdownDigit("Pulse", Color3.fromRGB(255, 60, 76), 13)
|
||||
local echoScale = Instance.new("UIScale", echo)
|
||||
local digitMotion: Tween? = nil
|
||||
local echoMotion: Tween? = nil
|
||||
local echoFade: Tween? = nil
|
||||
local countdownSound: Sound? = nil
|
||||
|
||||
local function clearCountdownBeat()
|
||||
if digitMotion then digitMotion:Cancel() end
|
||||
if echoMotion then echoMotion:Cancel() end
|
||||
if echoFade then echoFade:Cancel() end
|
||||
if countdownSound then
|
||||
countdownSound:Destroy()
|
||||
countdownSound = nil
|
||||
end
|
||||
end
|
||||
|
||||
local function showCountdownBeat(seconds: number)
|
||||
clearCountdownBeat()
|
||||
local value = tostring(seconds)
|
||||
countdownText.Text = value
|
||||
echo.Text = value
|
||||
digitScale.Scale = .76
|
||||
echoScale.Scale = .96
|
||||
echo.TextTransparency = .5
|
||||
countdown.Visible = true
|
||||
|
||||
digitMotion = TweenService:Create(digitScale, TweenInfo.new(.28, Enum.EasingStyle.Back, Enum.EasingDirection.Out), {Scale = 1})
|
||||
local echoTime = TweenInfo.new(.5, Enum.EasingStyle.Quart, Enum.EasingDirection.Out)
|
||||
echoMotion = TweenService:Create(echoScale, echoTime, {Scale = 1.35})
|
||||
echoFade = TweenService:Create(echo, echoTime, {TextTransparency = 1})
|
||||
digitMotion:Play()
|
||||
echoMotion:Play()
|
||||
echoFade:Play()
|
||||
countdownSound = Sounds.sound("RoundCountdown")
|
||||
end
|
||||
|
||||
local teamStats = UI.plate(hudLayout, "TeamKillStats", UDim2.fromOffset(15, 74), UDim2.fromOffset(widthOfCard, 55), UI.Outline)
|
||||
local teamContour = UI.contour(teamStats, blue)
|
||||
teamStats.Visible = false
|
||||
local statsScale = Instance.new("UIScale", teamStats)
|
||||
local badges = frame("Badges", teamStats, UDim2.fromOffset(10, 5), UDim2.new(1, -19, 1, -9), panelColor)
|
||||
badges.BackgroundTransparency = 1
|
||||
local grid = Instance.new("UIGridLayout")
|
||||
grid.CellSize = UDim2.fromOffset(79, 45)
|
||||
grid.CellPadding = UDim2.fromOffset(4, 4)
|
||||
grid.FillDirectionMaxCells = 5
|
||||
grid.SortOrder = Enum.SortOrder.LayoutOrder
|
||||
grid.Parent = badges
|
||||
|
||||
type KillBadge = {card: Frame, avatar: ImageLabel, kills: TextLabel, killSize: UITextSizeConstraint, teamLine: Frame}
|
||||
local killBadges: {KillBadge} = {}
|
||||
for i = 1, limit do
|
||||
local card = frame("Member" .. i, badges, UDim2.fromOffset(0, 0), UDim2.fromOffset(79, 45), panelColor)
|
||||
card.LayoutOrder = i
|
||||
card.Visible = false
|
||||
card.BackgroundTransparency = 1
|
||||
UI.hoverRow(card, muted)
|
||||
local avatar = portrait(card, UDim2.fromOffset(10, 3), 38, muted)
|
||||
local kills = label(card, "", UDim2.new(0, 51, .5, -16), UDim2.fromOffset(26, 32), 23, ink)
|
||||
kills.Name = "Kills"
|
||||
kills.FontFace = UI.Display
|
||||
kills.TextXAlignment = Enum.TextXAlignment.Left
|
||||
kills.TextScaled = true
|
||||
local killSize = Instance.new("UITextSizeConstraint", kills)
|
||||
local teamLine = frame("Accent", card, UDim2.new(0, 4, .5, -10), UDim2.fromOffset(3, 20), blue)
|
||||
teamLine.Rotation = 17
|
||||
corners(teamLine, 2)
|
||||
UI.sheen(teamLine)
|
||||
killBadges[i] = {card = card, avatar = avatar, kills = kills, killSize = killSize, teamLine = teamLine}
|
||||
end
|
||||
|
||||
local shownMembers = 0
|
||||
local function fitHud()
|
||||
local width = hudLayout.AbsoluteSize.X
|
||||
if width <= 0 then return end
|
||||
scoreScale.Scale = math.clamp((width - 30) / widthOfCard, .46, if width < 540 then .71 else 1)
|
||||
statsScale.Scale = scoreScale.Scale
|
||||
objectiveScale.Scale = scoreScale.Scale
|
||||
local top = 12 + math.round(63 * scoreScale.Scale)
|
||||
objective.Position = UDim2.fromOffset(15, top)
|
||||
if objective.Visible then
|
||||
top += 5 + math.round(objective.Size.Y.Offset * scoreScale.Scale)
|
||||
end
|
||||
teamStats.Position = UDim2.fromOffset(15, top)
|
||||
local packed = shownMembers > 3
|
||||
local columns = if packed then 5 else 3
|
||||
local cellW, cellH = if packed then 62 else 79, if packed then 37 else 45
|
||||
grid.CellSize = UDim2.fromOffset(cellW, cellH)
|
||||
grid.FillDirectionMaxCells = columns
|
||||
local rowCount = math.ceil(shownMembers / columns)
|
||||
local height = 7 + rowCount * (cellH + 4)
|
||||
teamStats.Size = UDim2.fromOffset(18 + (cellW + 4) * math.max(1, math.min(columns, shownMembers)), height)
|
||||
for _, badge in killBadges do
|
||||
local size = if packed then 28 else 38
|
||||
local countX = badge.avatar.Position.X.Offset + size + 3
|
||||
badge.avatar.Size = UDim2.fromOffset(size, size)
|
||||
badge.kills.Size = UDim2.fromOffset(cellW - countX - 2, 32)
|
||||
badge.kills.Position = UDim2.new(0, countX, .5, -16)
|
||||
badge.killSize.MaxTextSize = if packed then 17 else 23
|
||||
end
|
||||
local bottom = top + (if rowCount > 0 then height * scoreScale.Scale else 0)
|
||||
local minimumTop = if countdown.Visible then 119 else 10
|
||||
local captureTop = if width >= 1200 then minimumTop else math.max(minimumTop, bottom + 8)
|
||||
captureHud.Position = UDim2.new(.5, 0, 0, captureTop)
|
||||
captureHud.Size = UDim2.fromOffset(math.floor(math.min(384, width - 24)), 52)
|
||||
gui:SetAttribute("ContentBottom", if width >= 700 then 4 else bottom)
|
||||
end
|
||||
hudLayout:GetPropertyChangedSignal("AbsoluteSize"):Connect(fitHud)
|
||||
fitHud()
|
||||
|
||||
local function refreshCapture()
|
||||
local match = activeState()
|
||||
local phase = match:GetAttribute("HotPointPhase") :: string?
|
||||
local team = player:GetAttribute("ArenaTeam")
|
||||
if not phase or (team ~= "Blue" and team ~= "Orange") or match:GetAttribute("Phase") ~= "Round"
|
||||
or match:GetAttribute("Ruleset") ~= "HotPoint" then
|
||||
if captureTween then captureTween:Cancel(); captureTween = nil end
|
||||
captureHud.Visible, captureTeam, capturePercent = false, nil, 0
|
||||
captureCueTeam, captureCuePhase = nil, nil
|
||||
captureFill.Size = UDim2.fromScale(0, 1)
|
||||
return
|
||||
end
|
||||
local side = match:GetAttribute("HotPointTeam") :: string?
|
||||
local allied = side == team
|
||||
if phase == "Captured" and captureCuePhase ~= "Captured" then
|
||||
Sounds.sound("HotPointCaptured")
|
||||
elseif phase == "Capturing" and allied and side ~= captureCueTeam then
|
||||
Sounds.sound("HotPointStart")
|
||||
end
|
||||
captureCueTeam, captureCuePhase = if phase == "Captured" then nil else side, phase
|
||||
local accent = if not side then UI.Gold elseif allied then allyCapture else enemyCapture
|
||||
captureHud.Visible = true
|
||||
captureLabel.Text = if phase == "Captured" then "ТОЧКА ЗАХВАЧЕНА · +1"
|
||||
elseif phase == "Contested" then "ТОЧКА ОСПАРИВАЕТСЯ"
|
||||
elseif phase == "UnderFire" then (if allied then "ВАШ ЗАХВАТ ТЕРЯЕТСЯ" else "ЗАХВАТ СОПЕРНИКОВ ПАДАЕТ")
|
||||
elseif allied then "ВАША КОМАНДА ЗАХВАТЫВАЕТ" else "СОПЕРНИКИ ЗАХВАТЫВАЮТ"
|
||||
local percent = math.clamp((match:GetAttribute("HotPointProgress") :: number?) or 0, 0, 100)
|
||||
captureValue.Text, captureValue.TextColor3 = string.format("%d%%", percent), accent
|
||||
captureArc:SetAttribute("Accent", accent)
|
||||
captureFill.BackgroundColor3 = accent
|
||||
if percent == capturePercent and side == captureTeam then return end
|
||||
if captureTween then captureTween:Cancel() end
|
||||
local size = UDim2.fromScale(percent / 100, 1)
|
||||
if percent == 0 or side ~= captureTeam then
|
||||
captureFill.Size = size
|
||||
else
|
||||
captureTween = TweenService:Create(captureFill, TweenInfo.new(.17, Enum.EasingStyle.Linear), {Size = size})
|
||||
captureTween:Play()
|
||||
end
|
||||
captureTeam, capturePercent = side, percent
|
||||
end
|
||||
|
||||
local function refreshObjective()
|
||||
local match = activeState()
|
||||
local visible = player:GetAttribute("InArena") == true and match:GetAttribute("Phase") == "Round"
|
||||
local needsLayout = visible ~= objective.Visible
|
||||
objective.Visible = visible
|
||||
siegeBar.Visible = false
|
||||
if visible then
|
||||
local rule = Rules.get(match:GetAttribute("Ruleset"))
|
||||
local accent = if player:GetAttribute("ArenaTeam") == "Orange" then orange else blue
|
||||
objectiveTitle.Text = rule.title
|
||||
objectiveTitle.TextColor3 = accent
|
||||
objectiveText.Text = rule.detail
|
||||
objectiveContour:SetAttribute("Accent", accent)
|
||||
local text = (match:GetAttribute("ObjectiveStatus") :: string?) or ""
|
||||
local siege = match:FindFirstChild("CitadelMatchState")
|
||||
if rule.id == "Siege" and siege then
|
||||
local phase = siege:GetAttribute("Phase")
|
||||
local attacker = siege:GetAttribute("Attacker")
|
||||
local seconds = (siege:GetAttribute("Seconds") :: number?) or 0
|
||||
local zone = player:GetAttribute("CitadelZone")
|
||||
local role = if attacker == player:GetAttribute("ArenaTeam") then "Вы атакуете" else "Вы защищаете"
|
||||
local point = (siege:GetAttribute("PointName") :: string?) or ""
|
||||
objectiveTitle.Text = if phase == "RoleSwap" then "СМЕНА РОЛЕЙ" else string.format("АТАКА %d/2 · %d:%02d",
|
||||
if phase == "Attack2" then 2 else 1, math.floor(seconds / 60), seconds % 60)
|
||||
objectiveText.Text = role .. " · " .. point
|
||||
if phase ~= "RoleSwap" and siege:GetAttribute("Point") then
|
||||
if zone == "Height" then text = "Найдите нужный этаж"
|
||||
elseif zone == "Blocked" then text = "Нет прямой видимости центра"
|
||||
elseif zone == "Inside" and role == "Вы защищаете" then text = "Вы блокируете захват. Оставайтесь в круге!" end
|
||||
siegeBar.Visible = true
|
||||
local progress = (siege:GetAttribute("Progress") :: number?) or 0
|
||||
for i, segment in siegeSegments do
|
||||
segment.Visible = progress + 1e-8 >= i / #siegeSegments
|
||||
segment.BackgroundColor3 = if siege:GetAttribute("Status") == "Contested" then orange else blue
|
||||
end
|
||||
end
|
||||
end
|
||||
local tokens = (player:GetAttribute("ArenaTokens") :: number?) or 0
|
||||
if player:GetAttribute("ArenaFlag") then text = "У вас флаг · Несите его на свою базу"
|
||||
elseif tokens > 0 then text = "Жетонов у вас: " .. tokens .. " · Вернитесь на базу"
|
||||
elseif player:GetAttribute("ArenaLeader") then text = "Вы лидер · За вас дают 3 очка"
|
||||
elseif rule.id == "TrophyHunt" then text = "" end
|
||||
objectiveStatus.Visible = text ~= ""
|
||||
objectiveStatus.Text = text
|
||||
objectiveStatus.TextColor3 = accent:Lerp(ink, .3)
|
||||
local height = if siegeBar.Visible then 101 elseif objectiveStatus.Visible then 88 else 62
|
||||
if height ~= objective.Size.Y.Offset then
|
||||
objective.Size = UDim2.fromOffset(widthOfCard, height)
|
||||
needsLayout = true
|
||||
end
|
||||
end
|
||||
if needsLayout then fitHud() end
|
||||
end
|
||||
|
||||
type ResultPlayer = {userId: number, displayName: string, kills: number, deaths: number}
|
||||
type RoundResult = {mode: string, ruleset: string, winner: string, endsAt: number, duration: number, blueScore: number, orangeScore: number,
|
||||
blue: {ResultPlayer}, orange: {ResultPlayer}, allowModeChange: boolean?, siegeReason: string?}
|
||||
type ResultRow = {body: Frame, avatar: ImageLabel, name: TextLabel, kills: TextLabel, deaths: TextLabel}
|
||||
type ResultTeam = {card: Frame, score: TextLabel, empty: TextLabel, accent: Color3, rows: {ResultRow}}
|
||||
type SummaryView = "Live" | "Final"
|
||||
|
||||
local resultsGui = Instance.new("ScreenGui")
|
||||
resultsGui.Name = "ArenaResults"
|
||||
resultsGui.ResetOnSpawn = false
|
||||
resultsGui.IgnoreGuiInset = true
|
||||
resultsGui.DisplayOrder = 35
|
||||
resultsGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
|
||||
resultsGui.Parent = playerGui
|
||||
local resultsShade = frame("RoundResults", resultsGui, UDim2.fromScale(0, 0), UDim2.fromScale(1, 1), Color3.fromRGB(5, 9, 18))
|
||||
resultsShade.Active = true
|
||||
resultsShade.Visible = false
|
||||
local resultsPanel = UI.plate(resultsShade, "Summary", UDim2.fromScale(.5, .5), UDim2.fromOffset(960, 630), UI.Outline, Color3.fromRGB(13, 19, 29))
|
||||
resultsPanel.AnchorPoint = Vector2.new(.5, .5)
|
||||
local resultsScale = Instance.new("UIScale", resultsPanel)
|
||||
local function fitResults()
|
||||
local size = resultsShade.AbsoluteSize
|
||||
resultsScale.Scale = math.clamp(math.min((size.X - 26) / 960, (size.Y - 26) / resultsPanel.Size.Y.Offset), .01, 1)
|
||||
end
|
||||
resultsShade:GetPropertyChangedSignal("AbsoluteSize"):Connect(fitResults)
|
||||
fitResults()
|
||||
local resultArc = UI.contour(resultsPanel, blue)
|
||||
local resultTitle = UI.label(resultsPanel, "Title", "ИТОГИ РАУНДА", UDim2.fromOffset(26, 17), UDim2.fromOffset(510, 42), 31, ink)
|
||||
resultTitle.FontFace = UI.Display
|
||||
resultTitle.TextXAlignment = Enum.TextXAlignment.Left
|
||||
local resultWinner = UI.label(resultsPanel, "Winner", "", UDim2.fromOffset(27, 60), UDim2.fromOffset(510, 25), 17, UI.Gold)
|
||||
resultWinner.TextXAlignment = Enum.TextXAlignment.Left
|
||||
local resultMode = UI.label(resultsPanel, "Mode", "", UDim2.fromOffset(566, 30), UDim2.fromOffset(368, 31), 15, muted)
|
||||
resultMode.TextXAlignment = Enum.TextXAlignment.Right
|
||||
|
||||
local outcomeShade = frame("CitadelOutcome", resultsShade, UDim2.fromScale(0, 0), UDim2.fromScale(1, 1), Color3.fromRGB(5, 9, 18))
|
||||
outcomeShade.ZIndex = 20
|
||||
outcomeShade.Visible = false
|
||||
local outcome = UI.label(outcomeShade, "Outcome", "", UDim2.fromScale(.5, .5), UDim2.fromScale(.78, .18), 76, ink)
|
||||
outcome.AnchorPoint = Vector2.new(.5, .5)
|
||||
outcome.FontFace = UI.Display
|
||||
outcome.TextScaled = true
|
||||
local outcomeLimit = Instance.new("UITextSizeConstraint", outcome)
|
||||
outcomeLimit.MaxTextSize = 104
|
||||
local outcomeScale = Instance.new("UIScale", outcome)
|
||||
local outcomeLine = frame("Light", outcomeShade, UDim2.fromScale(.5, .61), UDim2.fromScale(0, .004), UI.Gold)
|
||||
outcomeLine.AnchorPoint = Vector2.new(.5, .5)
|
||||
local outcomeTweens: {Tween} = {}
|
||||
local outcomeVersion = 0
|
||||
local function clearOutcome()
|
||||
outcomeVersion += 1
|
||||
for _, tween in outcomeTweens do tween:Cancel() end
|
||||
table.clear(outcomeTweens)
|
||||
outcomeShade.Visible = false
|
||||
end
|
||||
|
||||
local function showOutcome(text: string, accent: Color3)
|
||||
clearOutcome()
|
||||
outcome.Text, outcome.TextColor3, outcome.TextTransparency = text, accent, 1
|
||||
outcomeScale.Scale = .72
|
||||
outcomeShade.BackgroundTransparency = .12
|
||||
outcomeLine.BackgroundColor3, outcomeLine.BackgroundTransparency = accent, 0
|
||||
outcomeLine.Size = UDim2.fromScale(0, .004)
|
||||
outcomeShade.Visible = true
|
||||
local version = outcomeVersion
|
||||
local function play(target: Instance, info: TweenInfo, goal: {[string]: any}): Tween
|
||||
local tween = TweenService:Create(target, info, goal)
|
||||
table.insert(outcomeTweens, tween)
|
||||
tween:Play()
|
||||
return tween
|
||||
end
|
||||
play(outcomeScale, TweenInfo.new(.55, Enum.EasingStyle.Back), {Scale = 1})
|
||||
play(outcome, TweenInfo.new(.3), {TextTransparency = 0})
|
||||
play(outcomeLine, TweenInfo.new(.55, Enum.EasingStyle.Quint), {Size = UDim2.fromScale(.38, .004)})
|
||||
task.delay(2, function()
|
||||
if version ~= outcomeVersion then return end
|
||||
local fade = TweenInfo.new(.35, Enum.EasingStyle.Quad)
|
||||
play(outcomeShade, fade, {BackgroundTransparency = 1})
|
||||
play(outcomeLine, fade, {BackgroundTransparency = 1})
|
||||
play(outcome, fade, {TextTransparency = 1}).Completed:Once(function()
|
||||
if version == outcomeVersion then outcomeShade.Visible = false end
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
local function resultTeam(id: string, x: number, name: string, color: Color3, dark: Color3): ResultTeam
|
||||
local card = UI.plate(resultsPanel, id, UDim2.fromOffset(x, 97), UDim2.fromOffset(446, 467), color:Lerp(panelColor, .35), panelColor:Lerp(dark, .28))
|
||||
local header = frame("Header", card, UDim2.fromOffset(5, 7), UDim2.new(1, -10, 0, 61), dark)
|
||||
gradient(header, dark:Lerp(color, .35), dark, 8)
|
||||
UI.sheen(header)
|
||||
local titleText = UI.label(card, "TeamName", name, UDim2.fromOffset(18, 14), UDim2.fromOffset(324, 48), 23, ink)
|
||||
titleText.FontFace = UI.Display
|
||||
titleText.TextXAlignment = Enum.TextXAlignment.Left
|
||||
local chip = UI.element("ScoreChip", card, UDim2.fromOffset(352, 12), UDim2.fromOffset(80, 50))
|
||||
UI.tintPlate(chip, color:Lerp(ink, .2), color)
|
||||
local score = UI.label(chip, "Score", "0", UDim2.fromScale(0, 0), UDim2.fromScale(1, 1), 32, panelColor)
|
||||
score.FontFace = UI.Display
|
||||
local head = frame("Columns", card, UDim2.fromOffset(12, 73), UDim2.fromOffset(422, 25), panelColor)
|
||||
head.BackgroundTransparency = 1
|
||||
local playerHeader = UI.label(head, "Player", "ИГРОК", UDim2.fromOffset(8, 0), UDim2.fromOffset(200, 25), 12, muted)
|
||||
playerHeader.TextXAlignment = Enum.TextXAlignment.Left
|
||||
UI.label(head, "Kills", "УБИЙСТВА", UDim2.fromOffset(241, 0), UDim2.fromOffset(93, 25), 12, muted)
|
||||
UI.label(head, "Deaths", "СМЕРТИ", UDim2.fromOffset(334, 0), UDim2.fromOffset(86, 25), 12, muted)
|
||||
local rows: {ResultRow} = {}
|
||||
for i = 1, limit do
|
||||
local row = UI.element("PlayerRow", card, UDim2.fromOffset(12, 102 + (i - 1) * 35), UDim2.fromOffset(422, 32))
|
||||
row.Name = "Player" .. i
|
||||
UI.hoverRow(row, color)
|
||||
local avatar = portrait(row, UDim2.fromOffset(5, 3), 26, color)
|
||||
local nameLabel = UI.label(row, "DisplayName", "", UDim2.fromOffset(40, 0), UDim2.fromOffset(196, 32), 15, ink)
|
||||
nameLabel.TextXAlignment = Enum.TextXAlignment.Left
|
||||
nameLabel.TextTruncate = Enum.TextTruncate.AtEnd
|
||||
local kills = UI.label(row, "Kills", "", UDim2.fromOffset(241, 0), UDim2.fromOffset(93, 32), 18, color)
|
||||
local deaths = UI.label(row, "Deaths", "", UDim2.fromOffset(334, 0), UDim2.fromOffset(86, 32), 16, muted)
|
||||
kills.FontFace = UI.Display
|
||||
rows[i] = {body = row, avatar = avatar, name = nameLabel, kills = kills, deaths = deaths}
|
||||
end
|
||||
local empty = UI.label(card, "Empty", "В команде не было игроков", UDim2.fromOffset(12, 105), UDim2.fromOffset(422, 54), 15, muted)
|
||||
return {card = card, score = score, empty = empty, accent = color, rows = rows}
|
||||
end
|
||||
|
||||
local blueResult = resultTeam("Blue", 23, "СИНИЕ", blue, blueDark)
|
||||
local orangeResult = resultTeam("Orange", 491, "ОРАНЖЕВЫЕ", orange, orangeDark)
|
||||
local nextRound = UI.label(resultsPanel, "NextRound", "", UDim2.fromOffset(25, 573), UDim2.fromOffset(910, 31), 16, ink)
|
||||
local resultTrack = UI.element("ProgressBar", resultsPanel, UDim2.fromOffset(25, 609), UDim2.fromOffset(910, 3))
|
||||
local resultFill = resultTrack:WaitForChild("Fill") :: Frame
|
||||
UI.sheen(resultFill)
|
||||
local resultEndsAt = 0
|
||||
local lastResultSecond = -1
|
||||
local resultsCountdown = "ГОЛОСОВАНИЕ ЧЕРЕЗ %d С"
|
||||
local summaryView: SummaryView? = nil
|
||||
local resultSlide: Tween? = nil
|
||||
local resultFade: Tween? = nil
|
||||
local resultDrain: Tween? = nil
|
||||
|
||||
local function populateResults(team: ResultTeam, score: number, players: {ResultPlayer})
|
||||
team.score.Text = tostring(score)
|
||||
team.empty.Visible = #players == 0
|
||||
team.empty.Text = if summaryView == "Live" then "В команде пока нет игроков" else "В команде не было игроков"
|
||||
for i, row in team.rows do
|
||||
local member = players[i]
|
||||
row.body.Visible = member ~= nil
|
||||
row.body.Interactable = member ~= nil
|
||||
setPortrait(row.avatar, member and member.userId, member and member.displayName)
|
||||
if member then
|
||||
local self = member.userId == player.UserId
|
||||
row.name.Text = (if self then "Вы · " else "") .. member.displayName
|
||||
row.kills.Text = tostring(member.kills)
|
||||
row.deaths.Text = tostring(member.deaths)
|
||||
row.body.BackgroundColor3 = panelColor:Lerp(team.accent, if self then .34 elseif i % 2 == 0 then .08 else .15)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function setSummaryTeams(bluePlayers: {ResultPlayer}, orangePlayers: {ResultPlayer}, blueTotal: number, orangeTotal: number)
|
||||
populateResults(blueResult, blueTotal, bluePlayers)
|
||||
populateResults(orangeResult, orangeTotal, orangePlayers)
|
||||
local rowSpace = 35 * math.max(3, #bluePlayers, #orangePlayers)
|
||||
local height = 280 + rowSpace
|
||||
if resultsPanel.Size.Y.Offset == height then return end
|
||||
resultsPanel.Size = UDim2.fromOffset(960, height)
|
||||
blueResult.card.Size = UDim2.fromOffset(446, 117 + rowSpace)
|
||||
orangeResult.card.Size = blueResult.card.Size
|
||||
nextRound.Position = UDim2.fromOffset(25, height - 57)
|
||||
resultTrack.Position = UDim2.fromOffset(25, height - 21)
|
||||
fitResults()
|
||||
end
|
||||
|
||||
local function startSummary(view: SummaryView, ruleId: unknown)
|
||||
summaryView = view
|
||||
resultTitle.Text = if view == "Live" then "СТАТИСТИКА МАТЧА" else "ИТОГИ РАУНДА"
|
||||
local rule = Rules.get(ruleId)
|
||||
resultMode.Text = rule.title .. " · Динамическая арена"
|
||||
if view == "Live" then
|
||||
resultWinner.Text = "СЧЁТ · " .. rule.score
|
||||
resultWinner.TextColor3 = muted
|
||||
end
|
||||
resultsPanel.Position = UDim2.fromScale(.5, .53)
|
||||
resultsShade.BackgroundTransparency = 1
|
||||
resultsShade.Visible = true
|
||||
local arrival = TweenInfo.new(.25, Enum.EasingStyle.Quart, Enum.EasingDirection.Out)
|
||||
resultSlide = TweenService:Create(resultsPanel, arrival, {Position = UDim2.fromScale(.5, .5)})
|
||||
resultFade = TweenService:Create(resultsShade, arrival, {BackgroundTransparency = if view == "Live" then .32 else .14})
|
||||
resultSlide:Play()
|
||||
resultFade:Play()
|
||||
end
|
||||
|
||||
local function hideResults()
|
||||
clearOutcome()
|
||||
summaryView = nil
|
||||
resultsShade.Visible = false
|
||||
if resultSlide then resultSlide:Cancel() end
|
||||
if resultFade then resultFade:Cancel() end
|
||||
if resultDrain then resultDrain:Cancel() end
|
||||
end
|
||||
|
||||
local connections: {[Player]: {RBXScriptConnection}} = {}
|
||||
|
||||
local function killsFor(member: Player): number
|
||||
return (member:GetAttribute("RoundKills") :: number?) or 0
|
||||
end
|
||||
|
||||
local function refreshLiveStats()
|
||||
if summaryView ~= "Live" then return end
|
||||
local items: {[string]: {ResultPlayer}} = {Blue = {}, Orange = {}}
|
||||
local arenaMode = currentMode()
|
||||
for member in connections do
|
||||
local side = member:GetAttribute("ArenaTeam")
|
||||
if (side == "Blue" or side == "Orange") and Modes.of(member) == arenaMode then
|
||||
table.insert(items[side], {
|
||||
userId = member.UserId,
|
||||
displayName = member.DisplayName,
|
||||
kills = killsFor(member),
|
||||
deaths = (member:GetAttribute("RoundDeaths") :: number?) or 0,
|
||||
})
|
||||
end
|
||||
end
|
||||
local function byPerformance(a: ResultPlayer, b: ResultPlayer): boolean
|
||||
if a.kills ~= b.kills then return a.kills > b.kills end
|
||||
if a.deaths ~= b.deaths then return a.deaths < b.deaths end
|
||||
return a.userId < b.userId
|
||||
end
|
||||
table.sort(items.Blue, byPerformance)
|
||||
table.sort(items.Orange, byPerformance)
|
||||
local match = activeState()
|
||||
setSummaryTeams(items.Blue, items.Orange, (match:GetAttribute("BlueScore") :: number?) or 0,
|
||||
(match:GetAttribute("OrangeScore") :: number?) or 0)
|
||||
end
|
||||
|
||||
local function scoreUpdater(score: TextLabel, attribute: string)
|
||||
local scale = Instance.new("UIScale", score)
|
||||
local motion: Tween? = nil
|
||||
local function refresh(animated: boolean)
|
||||
local value = (activeState():GetAttribute(attribute) :: number?) or 0
|
||||
if animated and value > (tonumber(score.Text) or 0) then
|
||||
if motion then motion:Cancel() end
|
||||
scale.Scale = 1.17
|
||||
motion = TweenService:Create(scale, TweenInfo.new(.23, Enum.EasingStyle.Quart), {Scale = 1})
|
||||
motion:Play()
|
||||
end
|
||||
score.Text = tostring(value)
|
||||
end
|
||||
for _, id in modeIds do
|
||||
Modes.state(state, id):GetAttributeChangedSignal(attribute):Connect(function()
|
||||
if currentMode() == id then refresh(true) end
|
||||
end)
|
||||
end
|
||||
refresh(false)
|
||||
return refresh
|
||||
end
|
||||
local refreshBlue = scoreUpdater(blueScore, "BlueScore")
|
||||
local refreshOrange = scoreUpdater(orangeScore, "OrangeScore")
|
||||
|
||||
local function remaining(): number
|
||||
local deadline = (activeState():GetAttribute("EndsAt") :: number?) or 0
|
||||
return math.max(0, math.ceil(deadline - workspace:GetServerTimeNow()))
|
||||
end
|
||||
|
||||
local function updateLiveClock(seconds: number, phase: string, duration: number)
|
||||
local remainingText = if phase == "Round" then "ДО КОНЦА РАУНДА" else "ДО СЛЕДУЮЩЕГО РАУНДА"
|
||||
nextRound.Text = string.format("%s %02d:%02d · ОТПУСТИТЕ TAB, ЧТОБЫ ЗАКРЫТЬ", remainingText, seconds // 60, seconds % 60)
|
||||
if resultDrain then resultDrain:Cancel() end
|
||||
resultDrain = TweenService:Create(resultFill, TweenInfo.new(.22, Enum.EasingStyle.Linear), {
|
||||
Size = UDim2.fromScale(math.clamp(seconds / math.max(duration, 1), 0, 1), 1),
|
||||
})
|
||||
resultDrain:Play()
|
||||
end
|
||||
|
||||
local function refreshControls()
|
||||
gui:SetAttribute("LobbyAvailable", player:GetAttribute("ArenaTeam") == nil
|
||||
and not resultsShade.Visible and playerGui:GetAttribute("HunterVoting") ~= true)
|
||||
end
|
||||
|
||||
local function refreshRoster()
|
||||
local members: {[string]: {Player}} = {Blue = {}, Orange = {}}
|
||||
local arenaMode = currentMode()
|
||||
for participant in connections do
|
||||
local id = participant:GetAttribute("ArenaTeam")
|
||||
if (id == "Blue" or id == "Orange") and Modes.of(participant) == arenaMode then
|
||||
table.insert(members[id], participant)
|
||||
end
|
||||
end
|
||||
local team = player:GetAttribute("ArenaTeam")
|
||||
local allies = if team == "Blue" or team == "Orange" then members[team] else {}
|
||||
table.sort(allies, function(a, b)
|
||||
local aKills, bKills = killsFor(a), killsFor(b)
|
||||
if aKills ~= bKills then return aKills > bKills end
|
||||
return a.Name:lower() < b.Name:lower()
|
||||
end)
|
||||
shownMembers = #allies
|
||||
teamStats.Visible = shownMembers > 0
|
||||
fitHud()
|
||||
local accent = if team == "Orange" then orange else blue
|
||||
teamContour:SetAttribute("Accent", accent)
|
||||
for i, badge in killBadges do
|
||||
local member = allies[i]
|
||||
badge.card.Visible = member ~= nil
|
||||
setPortrait(badge.avatar, member and member.UserId, member and member.DisplayName)
|
||||
if member then
|
||||
badge.card:SetAttribute("DisplayName", member.DisplayName)
|
||||
badge.kills.TextColor3 = if member == player then accent else ink
|
||||
local edge = badge.avatar:FindFirstChildOfClass("UIStroke")
|
||||
if edge then edge.Color = accent end
|
||||
badge.kills.Text = tostring(killsFor(member))
|
||||
badge.teamLine.BackgroundColor3 = accent
|
||||
end
|
||||
end
|
||||
refreshLiveStats()
|
||||
refreshObjective()
|
||||
refreshCapture()
|
||||
refreshControls()
|
||||
end
|
||||
|
||||
local function watch(participant: Player)
|
||||
if connections[participant] then return end
|
||||
connections[participant] = {
|
||||
participant:GetAttributeChangedSignal("ArenaTeam"):Connect(refreshRoster),
|
||||
participant:GetAttributeChangedSignal("ArenaMode"):Connect(refreshRoster),
|
||||
participant:GetAttributeChangedSignal("RoundKills"):Connect(refreshRoster),
|
||||
participant:GetAttributeChangedSignal("RoundDeaths"):Connect(refreshLiveStats),
|
||||
}
|
||||
refreshRoster()
|
||||
end
|
||||
|
||||
Players.PlayerAdded:Connect(watch)
|
||||
Players.PlayerRemoving:Connect(function(participant)
|
||||
for _, connection in connections[participant] or {} do connection:Disconnect() end
|
||||
connections[participant] = nil
|
||||
refreshRoster()
|
||||
end)
|
||||
for _, participant in Players:GetPlayers() do watch(participant) end
|
||||
|
||||
player:GetAttributeChangedSignal("InArena"):Connect(function()
|
||||
if summaryView == "Live" or (summaryView == "Final" and player:GetAttribute("InArena") == true) then hideResults() end
|
||||
refreshRoster()
|
||||
refreshBlue(false)
|
||||
refreshOrange(false)
|
||||
end)
|
||||
results.OnClientEvent:Connect(function(result: RoundResult, participantSide: string?)
|
||||
local left = result.endsAt - workspace:GetServerTimeNow()
|
||||
if left <= 0 then return end
|
||||
if resultsShade.Visible then hideResults() end
|
||||
startSummary("Final", result.ruleset)
|
||||
setSummaryTeams(result.blue, result.orange, result.blueScore, result.orangeScore)
|
||||
local winnerColor = if result.winner == "Blue" then blue elseif result.winner == "Orange" then orange else UI.Gold
|
||||
resultWinner.Text = if result.winner == "Blue" then "СИНИЕ ПОБЕДИЛИ"
|
||||
elseif result.winner == "Orange" then "ОРАНЖЕВЫЕ ПОБЕДИЛИ" else "НИЧЬЯ"
|
||||
if result.siegeReason then resultWinner.Text = result.siegeReason end
|
||||
if result.ruleset == "Siege" and (participantSide == "Blue" or participantSide == "Orange") then
|
||||
if result.winner == "Draw" then
|
||||
showOutcome("НИЧЬЯ", ink)
|
||||
elseif result.winner == participantSide then
|
||||
showOutcome("ПОБЕДА", UI.Gold)
|
||||
else
|
||||
showOutcome("ПОРАЖЕНИЕ", Color3.fromRGB(255, 105, 111))
|
||||
end
|
||||
end
|
||||
resultWinner.TextColor3 = winnerColor
|
||||
resultArc:SetAttribute("Accent", winnerColor)
|
||||
resultFill.BackgroundColor3 = winnerColor
|
||||
resultFill.Size = UDim2.fromScale(math.clamp(left / result.duration, 0, 1), 1)
|
||||
resultEndsAt = result.endsAt
|
||||
lastResultSecond = math.ceil(left)
|
||||
resultsCountdown = if result.allowModeChange == false then "СЛЕДУЮЩИЙ РАУНД ЧЕРЕЗ %d С" else "ГОЛОСОВАНИЕ ЧЕРЕЗ %d С"
|
||||
nextRound.Text = string.format(resultsCountdown, lastResultSecond)
|
||||
resultDrain = TweenService:Create(resultFill, TweenInfo.new(left, Enum.EasingStyle.Linear), {Size = UDim2.fromScale(0, 1)})
|
||||
resultDrain:Play()
|
||||
refreshRoster()
|
||||
refreshBlue(false)
|
||||
refreshOrange(false)
|
||||
end)
|
||||
local scoreConnections: {RBXScriptConnection} = {}
|
||||
for _, id in modeIds do
|
||||
local match = Modes.state(state, id)
|
||||
match:GetAttributeChangedSignal("Phase"):Connect(function()
|
||||
if currentMode() ~= id then return end
|
||||
refreshControls()
|
||||
end)
|
||||
for _, attribute in {"BlueScore", "OrangeScore"} do
|
||||
table.insert(scoreConnections, match:GetAttributeChangedSignal(attribute):Connect(function()
|
||||
if currentMode() == id then refreshLiveStats() end
|
||||
end))
|
||||
end
|
||||
for _, attribute in {"ObjectiveStatus", "Ruleset", "Phase"} do
|
||||
table.insert(scoreConnections, match:GetAttributeChangedSignal(attribute):Connect(function()
|
||||
if currentMode() ~= id then return end
|
||||
refreshObjective()
|
||||
if attribute ~= "ObjectiveStatus" then refreshCapture() end
|
||||
if attribute == "Ruleset" then refreshControls() end
|
||||
end))
|
||||
end
|
||||
for _, attribute in {"HotPointProgress", "HotPointTeam", "HotPointPhase"} do
|
||||
table.insert(scoreConnections, match:GetAttributeChangedSignal(attribute):Connect(refreshCapture))
|
||||
end
|
||||
end
|
||||
for _, attribute in {"ArenaTokens", "ArenaFlag", "ArenaLeader"} do
|
||||
table.insert(scoreConnections, player:GetAttributeChangedSignal(attribute):Connect(refreshObjective))
|
||||
end
|
||||
local votingChanged = playerGui:GetAttributeChangedSignal("HunterVoting"):Connect(function()
|
||||
if playerGui:GetAttribute("HunterVoting") == true then
|
||||
if summaryView == "Live" then hideResults() end
|
||||
end
|
||||
refreshControls()
|
||||
end)
|
||||
|
||||
local nativePlayerList = StarterGui:GetCoreGuiEnabled(Enum.CoreGuiType.PlayerList)
|
||||
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
|
||||
local scoreboardAction = "HunterScoreboard"
|
||||
local function closeLiveScoreboard()
|
||||
if summaryView ~= "Live" then return end
|
||||
hideResults()
|
||||
refreshControls()
|
||||
end
|
||||
local scoreboardFocus = UserInputService.WindowFocusReleased:Connect(closeLiveScoreboard)
|
||||
ContextActionService:BindActionAtPriority(scoreboardAction, function(_, inputState)
|
||||
if inputState == Enum.UserInputState.End or inputState == Enum.UserInputState.Cancel then closeLiveScoreboard() end
|
||||
if UserInputService:GetFocusedTextBox() then return Enum.ContextActionResult.Pass end
|
||||
if inputState == Enum.UserInputState.Begin and summaryView == nil and playerGui:GetAttribute("HunterVoting") ~= true
|
||||
and playerGui:GetAttribute("HunterArenaCreator") ~= true then
|
||||
local match = activeState()
|
||||
startSummary("Live", match:GetAttribute("Ruleset"))
|
||||
resultArc:SetAttribute("Accent", blue)
|
||||
resultFill.BackgroundColor3 = blue
|
||||
resultFill.Size = UDim2.fromScale(0, 1)
|
||||
refreshLiveStats()
|
||||
updateLiveClock(remaining(), (match:GetAttribute("Phase") :: string?) or "Round", (match:GetAttribute("PhaseDuration") :: number?) or 1)
|
||||
refreshControls()
|
||||
end
|
||||
return Enum.ContextActionResult.Sink
|
||||
end, false, Enum.ContextActionPriority.High.Value, Enum.KeyCode.Tab)
|
||||
|
||||
local lastSecond = -1
|
||||
local lastPhase = ""
|
||||
local lastTeam: string? = nil
|
||||
local lastMode = ""
|
||||
local lastInArena = false
|
||||
local clockMotion: Tween? = nil
|
||||
local function updateClock()
|
||||
if summaryView == "Final" then
|
||||
local left = math.ceil(resultEndsAt - workspace:GetServerTimeNow())
|
||||
if left <= 0 then
|
||||
hideResults()
|
||||
refreshControls()
|
||||
elseif left ~= lastResultSecond then
|
||||
lastResultSecond = left
|
||||
nextRound.Text = string.format(resultsCountdown, left)
|
||||
end
|
||||
end
|
||||
local seconds = remaining()
|
||||
local phase = activeState():GetAttribute("Phase") :: string
|
||||
local team = player:GetAttribute("ArenaTeam") :: string?
|
||||
local arenaMode = currentMode()
|
||||
local inArena = player:GetAttribute("InArena") == true
|
||||
if seconds == lastSecond and phase == lastPhase and team == lastTeam and arenaMode == lastMode and inArena == lastInArena then return end
|
||||
local finishing = inArena and phase == "Round" and seconds > 0 and seconds <= 5
|
||||
local hadCountdown = countdown.Visible
|
||||
if finishing then
|
||||
if not countdown.Visible or seconds ~= lastSecond or arenaMode ~= lastMode then showCountdownBeat(seconds) end
|
||||
elseif countdown.Visible then
|
||||
countdown.Visible = false
|
||||
clearCountdownBeat()
|
||||
end
|
||||
if captureHud.Visible and hadCountdown ~= countdown.Visible then fitHud() end
|
||||
lastSecond, lastPhase, lastTeam, lastMode, lastInArena = seconds, phase, team, arenaMode, inArena
|
||||
local rule = Rules.get(activeState():GetAttribute("Ruleset"))
|
||||
if rule.id == "Siege" and inArena then refreshObjective() end
|
||||
mode.Visible = true
|
||||
mode.Text = if phase == "Vote" then "ГОЛОСОВАНИЕ" elseif phase == "Reveal" then "ДО НАЧАЛА РАУНДА"
|
||||
elseif phase == "Break" then (if activeState():GetAttribute("AllowModeChange") == false then "ДО НАЧАЛА РАУНДА" else "ДО ГОЛОСОВАНИЯ")
|
||||
elseif phase == "Round" then (if inArena then "ДО КОНЦА РАУНДА" else rule.title)
|
||||
else "ПОДГОТОВКА АРЕНЫ"
|
||||
clock.Position = UDim2.fromOffset(0, 14)
|
||||
clock.TextSize = 32
|
||||
clock.Text = string.format("%02d:%02d", seconds // 60, seconds % 60)
|
||||
clock.TextColor3 = if seconds <= 15 and phase == "Round" then Color3.fromRGB(255, 218, 148) else ink
|
||||
mode.TextColor3 = if team == "Blue" then blue elseif team == "Orange" then orange else muted
|
||||
roundFill.BackgroundColor3 = if seconds <= 15 and phase == "Round" then orange else mode.TextColor3:Lerp(blue, .32)
|
||||
if clockMotion then clockMotion:Cancel() end
|
||||
local duration = (activeState():GetAttribute("PhaseDuration") :: number?) or math.max(seconds, 1)
|
||||
if summaryView == "Live" then updateLiveClock(seconds, phase, duration) end
|
||||
clockMotion = TweenService:Create(roundFill, TweenInfo.new(.8, Enum.EasingStyle.Linear), {
|
||||
Size = UDim2.fromScale(math.clamp(seconds / duration, 0, 1), 1),
|
||||
})
|
||||
clockMotion:Play()
|
||||
refreshControls()
|
||||
end
|
||||
local timerConnection = RunService.Heartbeat:Connect(updateClock)
|
||||
script.Destroying:Once(function()
|
||||
timerConnection:Disconnect()
|
||||
votingChanged:Disconnect()
|
||||
scoreboardFocus:Disconnect()
|
||||
ContextActionService:UnbindAction(scoreboardAction)
|
||||
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, nativePlayerList)
|
||||
for _, connection in scoreConnections do connection:Disconnect() end
|
||||
if captureTween then captureTween:Cancel() end
|
||||
clearCountdownBeat()
|
||||
hideResults()
|
||||
resultsGui:Destroy()
|
||||
end)
|
||||
updateClock()
|
||||
Reference in new issue
Block a user