166 lines
7.9 KiB
Plaintext
166 lines
7.9 KiB
Plaintext
<roblox xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.roblox.com/roblox.xsd" version="4">
|
|
<Item class="LocalScript" referent="RBX1"><Properties><string name="Name">Loading</string><ProtectedString name="Source"><![CDATA[-- Loading (LocalScript) -> ReplicatedFirst
|
|
-- Экран загрузки. Закрывает картинку при входе в игру и при каждом телепорте: игрок уже стоит на месте,
|
|
-- сцена прогружается, клиент ставит свет локации — и только потом экран плавно уходит.
|
|
--
|
|
-- FishingClient управляет экраном через атрибуты ScreenGui «LoadingScreen»:
|
|
-- Visible = true — показать (при телепорте);
|
|
-- Ready = true — свет и террейн локации выставлены;
|
|
-- StartAt / MinUntil — os.clock() начала и минимального конца показа (полоска заполняется за это время);
|
|
-- Title — подпись под названием игры (куда идём).
|
|
-- Экран уходит, когда Ready = true и минимальное время прошло.
|
|
|
|
local Players = game:GetService("Players")
|
|
local ReplicatedFirst = game:GetService("ReplicatedFirst")
|
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
|
local RunService = game:GetService("RunService")
|
|
local TweenService = game:GetService("TweenService")
|
|
|
|
local player = Players.LocalPlayer
|
|
pcall(function() ReplicatedFirst:RemoveDefaultLoadingScreen() end)
|
|
|
|
local GOLD = Color3.fromRGB(255, 205, 90)
|
|
local TIPS = {
|
|
"Чем реже рыба, тем быстрее бегает метка — нужна точность!",
|
|
"Улучшай удочку в магазине: рыба клюёт быстрее, удача выше.",
|
|
"Собери все виды одной редкости — получишь награду в коллекции (C).",
|
|
"Каждый день заходи за наградой из сундука в лобби.",
|
|
"Новые миры открываются с уровнем: следи за опытом!",
|
|
}
|
|
|
|
local function new(class, props)
|
|
local o = Instance.new(class)
|
|
for k, v in pairs(props) do
|
|
if k ~= "Parent" then
|
|
o[k] = v
|
|
end
|
|
end
|
|
o.Parent = props.Parent
|
|
return o
|
|
end
|
|
|
|
local gui = new("ScreenGui", {
|
|
Name = "LoadingScreen", ResetOnSpawn = false, IgnoreGuiInset = true, DisplayOrder = 200,
|
|
ZIndexBehavior = Enum.ZIndexBehavior.Sibling, Parent = player:WaitForChild("PlayerGui"),
|
|
})
|
|
-- фон: арт лобби (временная заглушка); пока картинка грузится, виден тёплый закатный градиент
|
|
local BG_IMAGE = "rbxassetid://118616665961176"
|
|
local root = new("CanvasGroup", { Size = UDim2.fromScale(1, 1), BackgroundColor3 = Color3.fromRGB(255, 190, 120), BorderSizePixel = 0, Parent = gui })
|
|
new("UIGradient", {
|
|
Rotation = 90,
|
|
Color = ColorSequence.new(Color3.fromRGB(120, 200, 255), Color3.fromRGB(255, 170, 110)),
|
|
Parent = root,
|
|
})
|
|
local bg = new("ImageLabel", {
|
|
Size = UDim2.fromScale(1, 1), BackgroundTransparency = 1, Image = BG_IMAGE,
|
|
ScaleType = Enum.ScaleType.Crop, Parent = root,
|
|
})
|
|
task.spawn(function()
|
|
pcall(function() game:GetService("ContentProvider"):PreloadAsync({ bg }) end)
|
|
end)
|
|
|
|
-- плашка снизу: куда идём, полоска загрузки, совет
|
|
local panel = new("Frame", {
|
|
AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -28), Size = UDim2.fromOffset(560, 118),
|
|
BackgroundColor3 = Color3.fromRGB(70, 40, 22), BackgroundTransparency = 0.18, BorderSizePixel = 0, Parent = root,
|
|
})
|
|
new("UICorner", { CornerRadius = UDim.new(0, 18), Parent = panel })
|
|
new("UIStroke", { Color = GOLD, Thickness = 3, Transparency = 0.1, Parent = panel })
|
|
new("UIGradient", {
|
|
Rotation = 90,
|
|
Color = ColorSequence.new(Color3.fromRGB(150, 95, 50), Color3.fromRGB(95, 55, 28)),
|
|
Parent = panel,
|
|
})
|
|
local float = new("TextLabel", {
|
|
AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromOffset(44, 32), Size = UDim2.fromOffset(46, 46),
|
|
BackgroundTransparency = 1, Text = "🎣", TextScaled = true, Font = Enum.Font.FredokaOne, Parent = panel,
|
|
})
|
|
local title = new("TextLabel", {
|
|
Position = UDim2.fromOffset(78, 12), Size = UDim2.new(1, -96, 0, 38), BackgroundTransparency = 1,
|
|
Text = "", TextColor3 = Color3.fromRGB(255, 240, 200), TextScaled = true, TextXAlignment = Enum.TextXAlignment.Left,
|
|
Font = Enum.Font.FredokaOne, Parent = panel,
|
|
})
|
|
new("UIStroke", { Color = Color3.fromRGB(60, 30, 10), Thickness = 2, Parent = title })
|
|
local barBack = new("Frame", {
|
|
AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 62), Size = UDim2.new(1, -36, 0, 16),
|
|
BackgroundColor3 = Color3.fromRGB(40, 22, 10), BackgroundTransparency = 0.15, BorderSizePixel = 0, Parent = panel,
|
|
})
|
|
new("UICorner", { CornerRadius = UDim.new(1, 0), Parent = barBack })
|
|
local bar = new("Frame", { Size = UDim2.fromScale(0, 1), BackgroundColor3 = GOLD, BorderSizePixel = 0, Parent = barBack })
|
|
new("UICorner", { CornerRadius = UDim.new(1, 0), Parent = bar })
|
|
new("UIGradient", { Color = ColorSequence.new(Color3.fromRGB(255, 230, 120), Color3.fromRGB(255, 160, 60)), Parent = bar })
|
|
local tip = new("TextLabel", {
|
|
Position = UDim2.fromOffset(18, 86), Size = UDim2.new(1, -36, 0, 22), BackgroundTransparency = 1,
|
|
Text = "", TextColor3 = Color3.fromRGB(255, 228, 185), TextScaled = true,
|
|
Font = Enum.Font.GothamMedium, Parent = panel,
|
|
})
|
|
|
|
local rng = Random.new()
|
|
local function showTip()
|
|
tip.Text = "💡 " .. TIPS[rng:NextInteger(1, #TIPS)]
|
|
end
|
|
|
|
-- при входе: экран виден сразу, минимум — из FishConfig, когда он загрузится
|
|
local now = os.clock()
|
|
gui:SetAttribute("Visible", true)
|
|
gui:SetAttribute("Ready", false)
|
|
gui:SetAttribute("StartAt", now)
|
|
gui:SetAttribute("MinUntil", now + 3)
|
|
gui:SetAttribute("Title", "Загрузка…")
|
|
showTip()
|
|
|
|
task.spawn(function()
|
|
if not game:IsLoaded() then
|
|
game.Loaded:Wait()
|
|
end
|
|
local ok, Config = pcall(require, ReplicatedStorage:WaitForChild("FishConfig"))
|
|
if ok and Config.Loading then
|
|
gui:SetAttribute("MinUntil", gui:GetAttribute("StartAt") + Config.Loading.firstJoin)
|
|
end
|
|
end)
|
|
|
|
local hiding = false
|
|
gui:GetAttributeChangedSignal("Visible"):Connect(function()
|
|
-- новый телепорт мог прийти, пока экран ещё уходил: тогда возвращаем его
|
|
if gui:GetAttribute("Visible") and (hiding or not gui.Enabled) then
|
|
hiding = false
|
|
showTip()
|
|
gui.Enabled = true
|
|
TweenService:Create(root, TweenInfo.new(0.25), { GroupTransparency = 0 }):Play()
|
|
end
|
|
end)
|
|
gui:GetAttributeChangedSignal("Title"):Connect(function()
|
|
title.Text = gui:GetAttribute("Title") or ""
|
|
end)
|
|
title.Text = gui:GetAttribute("Title")
|
|
|
|
RunService.RenderStepped:Connect(function()
|
|
if not gui.Enabled then
|
|
return
|
|
end
|
|
local t = os.clock()
|
|
float.Rotation = math.sin(t * 2.2) * 12
|
|
float.Position = UDim2.fromOffset(44, 32 + math.sin(t * 3) * 3)
|
|
local startAt, minUntil = gui:GetAttribute("StartAt") or t, gui:GetAttribute("MinUntil") or t
|
|
local p = math.clamp((t - startAt) / math.max(0.01, minUntil - startAt), 0, 1)
|
|
local ready = gui:GetAttribute("Ready") == true
|
|
if not ready then
|
|
p = math.min(p, 0.95) -- пока локация не готова, полоска не доходит до конца
|
|
end
|
|
bar.Size = UDim2.fromScale(p, 1)
|
|
local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
|
|
if ready and hrp and t >= minUntil and not hiding then
|
|
hiding = true
|
|
local tw = TweenService:Create(root, TweenInfo.new(0.6), { GroupTransparency = 1 })
|
|
tw.Completed:Connect(function()
|
|
if hiding then
|
|
gui.Enabled = false
|
|
gui:SetAttribute("Visible", false)
|
|
end
|
|
end)
|
|
tw:Play()
|
|
end
|
|
end)
|
|
]]></ProtectedString></Properties></Item>
|
|
</roblox>
|