Lobby 3d
This commit is contained in:
1 parent
fd5e92d0f5
commit
9f898c04dd
415 files changed
+6241617
-633464
No files matched your search
@@ -53,7 +53,7 @@ Config.Worlds = {
|
||||
desc = "Бирюзовое море, пальмы и яркая рифовая рыба.",
|
||||
clock = 13,
|
||||
waterY = 0,
|
||||
sea = 119, -- всё дальше этого радиуса от центра — море
|
||||
sea = 74, -- всё дальше этого радиуса от центра — море (лагуна вокруг острова, пляж — кольцо ~r 64..79)
|
||||
},
|
||||
{
|
||||
id = "World3", name = "Ледяной фьорд", icon = "❄", level = 18, mult = 12,
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
-- Icons (ModuleScript) -> ReplicatedStorage
|
||||
-- Рисованные иконки HUD (PNG из assets/icons, генератор tools/icons/make-icons.js).
|
||||
-- Номера — картинки, загруженные через Asset Manager (аккаунт pwdwildfire, 07.11.2026).
|
||||
-- Пока номер 0 — интерфейс показывает запасной эмодзи из FALLBACK.
|
||||
|
||||
local IDS = {
|
||||
bag = 72379738631656, fish = 123074166054483, book = 119159503091420, map = 113035977723975,
|
||||
scroll = 83828746597138, crystal = 107568887298480, horn = 91661926494530, guild = 107735648256690,
|
||||
coin = 70550177026494, pearl = 125123387622549, seal = 129656313507508, clover = 107892249463982,
|
||||
xp = 128133189614399, level = 72381648345352, rod = 110567511760929, worm = 91729644078578,
|
||||
sun = 136296700546459, cloud = 137462479141692, rain = 129058475131394, storm = 129830118520087,
|
||||
fog = 130081503861437, moon = 118742348752612, lock = 111707502076403, gift = 127962936383649,
|
||||
chest = 85688956823822, trap = 74060056959034, target = 124065062735562, gear = 121131244742417,
|
||||
}
|
||||
|
||||
local FALLBACK = {
|
||||
bag = "🎒", fish = "🐟", book = "📖", map = "🗺", scroll = "📜", crystal = "💎", horn = "🔊", guild = "⚔",
|
||||
coin = "⚪", pearl = "🦪", seal = "🏵", clover = "🍀", xp = "⭐", level = "🔶", rod = "🎣", worm = "🐛",
|
||||
sun = "☀", cloud = "☁", rain = "🌧", storm = "⛈", fog = "🌫", moon = "🌙",
|
||||
lock = "🔒", gift = "🎁", chest = "🧰", trap = "🧺", target = "🎯", gear = "⚙",
|
||||
}
|
||||
|
||||
local Icons = {}
|
||||
|
||||
-- "rbxassetid://…" или nil, если иконка ещё не загружена
|
||||
function Icons.image(name)
|
||||
local id = IDS[name]
|
||||
return (id and id ~= 0) and ("rbxassetid://" .. id) or nil
|
||||
end
|
||||
|
||||
function Icons.emoji(name)
|
||||
return FALLBACK[name] or "•"
|
||||
end
|
||||
|
||||
-- Ставит иконку в контейнер: ImageLabel с картинкой, а если её нет — TextLabel с эмодзи.
|
||||
-- Возвращает созданный элемент (размер — на весь parent, если не указан size).
|
||||
function Icons.put(parent, name, size, position)
|
||||
local img = Icons.image(name)
|
||||
local el
|
||||
if img then
|
||||
el = Instance.new("ImageLabel")
|
||||
el.Image = img
|
||||
el.ScaleType = Enum.ScaleType.Fit
|
||||
else
|
||||
el = Instance.new("TextLabel")
|
||||
el.Text = Icons.emoji(name)
|
||||
el.TextScaled = true
|
||||
el.Font = Enum.Font.GothamBold
|
||||
el.TextColor3 = Color3.new(1, 1, 1)
|
||||
end
|
||||
el.Name = "Icon"
|
||||
el.BackgroundTransparency = 1
|
||||
el.Size = size or UDim2.fromScale(1, 1)
|
||||
el.Position = position or UDim2.fromScale(0.5, 0.5)
|
||||
el.AnchorPoint = Vector2.new(0.5, 0.5)
|
||||
el.Parent = parent
|
||||
return el
|
||||
end
|
||||
|
||||
return Icons
|
||||
@@ -0,0 +1,49 @@
|
||||
-- UiImages (ModuleScript) -> ReplicatedStorage
|
||||
-- Текстуры интерфейса в фэнтези-стиле (PNG из assets/ui3, генератор tools/ui3/make-ui3.js; часть — из assets/ui).
|
||||
-- Номера — картинки из Asset Manager (pwdwildfire). Номер 0 — запасной вид из рамок и градиентов UiTheme.
|
||||
|
||||
local UiImages = {}
|
||||
|
||||
UiImages.IDS = {
|
||||
-- окна
|
||||
frame_window = 99070789948828, banner = 119948701689755, seal = 134178613371004,
|
||||
tab_on = 92933570972655, tab_off = 107689227645675, slot = 90618845736350, parchment = 127177301867977,
|
||||
divider = 117975799186217, medallion = 127745379008559, bar_frame = 126000512275713, bar_fill = 98838142353113,
|
||||
btn_wood = 117657508626917, btn_wood_down = 139058509909232, btn_green = 119648550843278, btn_green_down = 89311968758635,
|
||||
btn_red = 114476377432139, btn_red_down = 114998359108536, btn_gold = 75336662483544, btn_gold_down = 107875467440070,
|
||||
-- главный экран
|
||||
frame_small = 128753562500086, diamond = 125386825460398, chip = 72800269450328, roller = 75796379613455,
|
||||
menu_btn = 113300211302539, menu_btn_down = 90370634217744, gold_dot = 119904739243675,
|
||||
-- из прошлого набора (assets/ui)
|
||||
planks_dark = 84008321934239, card_frame = 119987262904306, empty_basket = 91278106715680,
|
||||
}
|
||||
-- старые имена ведут на новые картинки
|
||||
UiImages.ALIAS = { panel_wood = "frame_window", ribbon = "banner" }
|
||||
|
||||
-- { ширина, высота, срез по X, срез по Y (если другой), scale = SliceScale по умолчанию, tile = повторять }
|
||||
-- срез 0 — картинка целиком (ScaleType.Fit)
|
||||
UiImages.SLICES = {
|
||||
frame_window = { 512, 512, 140, scale = 0.5 }, banner = { 640, 200, 210, 1, scale = 0.36 },
|
||||
tab_on = { 256, 96, 44, scale = 0.42 }, tab_off = { 256, 96, 44, scale = 0.42 },
|
||||
slot = { 192, 192, 52, scale = 0.34 }, parchment = { 512, 512, 110, scale = 0.24 },
|
||||
divider = { 512, 48, 0 }, medallion = { 160, 160, 0 }, seal = { 160, 160, 0 },
|
||||
bar_frame = { 384, 64, 52, 24, scale = 0.3 }, bar_fill = { 384, 40, 20, 18, scale = 0.3 },
|
||||
btn_wood = { 256, 96, 44, scale = 0.34 }, btn_wood_down = { 256, 96, 44, scale = 0.34 },
|
||||
btn_green = { 256, 96, 44, scale = 0.34 }, btn_green_down = { 256, 96, 44, scale = 0.34 },
|
||||
btn_red = { 256, 96, 44, scale = 0.34 }, btn_red_down = { 256, 96, 44, scale = 0.34 },
|
||||
btn_gold = { 256, 96, 44, scale = 0.34 }, btn_gold_down = { 256, 96, 44, scale = 0.34 },
|
||||
frame_small = { 256, 256, 64, scale = 0.4 }, diamond = { 128, 128, 0 }, chip = { 160, 56, 26, scale = 0.46 },
|
||||
roller = { 512, 56, 60, 27, scale = 0.5 }, menu_btn = { 192, 192, 0 }, menu_btn_down = { 192, 192, 0 }, gold_dot = { 64, 64, 0 },
|
||||
planks_dark = { 128, 128, 0, tile = true }, card_frame = { 96, 96, 20, scale = 0.6 }, empty_basket = { 192, 160, 0 },
|
||||
}
|
||||
|
||||
function UiImages.resolve(name)
|
||||
return UiImages.ALIAS[name] or name
|
||||
end
|
||||
|
||||
function UiImages.get(name)
|
||||
local id = UiImages.IDS[UiImages.resolve(name)]
|
||||
return (id and id ~= 0) and ("rbxassetid://" .. id) or nil
|
||||
end
|
||||
|
||||
return UiImages
|
||||
@@ -150,14 +150,24 @@ local function kit(rig)
|
||||
end
|
||||
end
|
||||
-- длинная юбка/подол (у женщин, у длинных кафтанов и плащей): трапеция из двух блоков
|
||||
-- приварен к LowerTorso и шире размаха ног при ходьбе; длинный подол (length >= 0.7) прячет ноги под собой,
|
||||
-- чтобы при шаге они не вылезали сквозь ткань (видны только башмаки под краем)
|
||||
function K.skirt(color, length, hem)
|
||||
local legs = K.size("RightUpperLeg").Y + K.size("RightLowerLeg").Y + K.size("RightFoot").Y
|
||||
local long = (length or 0.9) >= 0.7
|
||||
length = legs * (length or 0.9)
|
||||
local top = -LT.Y * 0.3
|
||||
K.part("LowerTorso", K.BLOCK, Vector3.new(UT.X * 1.12, length * 0.5, UT.Z * 1.35), CFrame.new(0, top - length * 0.25, 0), color, K.FABRIC)
|
||||
K.part("LowerTorso", K.BLOCK, Vector3.new(UT.X * 1.4, length * 0.52, UT.Z * 1.7), CFrame.new(0, top - length * 0.74, 0), color, K.FABRIC)
|
||||
K.part("LowerTorso", K.BLOCK, Vector3.new(UT.X * 1.18, length * 0.5, UT.Z * 1.6), CFrame.new(0, top - length * 0.25, 0), color, K.FABRIC)
|
||||
K.part("LowerTorso", K.BLOCK, Vector3.new(UT.X * 1.5, length * 0.52, UT.Z * 2.3), CFrame.new(0, top - length * 0.74, 0), color, K.FABRIC)
|
||||
if hem then
|
||||
K.part("LowerTorso", K.BLOCK, Vector3.new(UT.X * 1.44, 0.22, UT.Z * 1.74), CFrame.new(0, top - length + 0.12, 0), hem, K.FABRIC)
|
||||
K.part("LowerTorso", K.BLOCK, Vector3.new(UT.X * 1.54, 0.22, UT.Z * 2.34), CFrame.new(0, top - length + 0.12, 0), hem, K.FABRIC)
|
||||
end
|
||||
if long then
|
||||
for _, s in ipairs(LEFT_RIGHT) do
|
||||
K.hide(s .. "UpperLeg")
|
||||
K.hide(s .. "LowerLeg")
|
||||
end
|
||||
K.legsHidden = true
|
||||
end
|
||||
end
|
||||
function K.belt(color, buckle, z)
|
||||
@@ -203,47 +213,131 @@ local function kit(rig)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------- голова
|
||||
function K.hair(color, long)
|
||||
K.part("Head", K.BLOCK, Vector3.new(H.X * 1.02, H.Y * (long and 0.9 or 0.45), H.Z * 0.3), CFrame.new(0, long and -H.Y * 0.05 or H.Y * 0.08, H.Z * 0.4), color)
|
||||
-- Голова R15 — скруглённая (лицо плоское только посередине, к бокам уходит назад), а размеры Head.Size —
|
||||
-- это коробка вокруг неё. Поэтому всё на лице ставится через K.onFace: точка на скруглённой поверхности
|
||||
-- и поворот по её изгибу; волосы — шаром чуть больше головы, сдвинутым назад (спереди он прячется в лицо).
|
||||
-- face(x, y, out): x, y — доли ширины/высоты головы; out — насколько выступить из лица (studs).
|
||||
function K.onFace(x, y, out)
|
||||
local r = 0.5 -- радиус скругления в долях ширины
|
||||
local z = -math.sqrt(math.max(0, r * r - math.max(0, math.abs(x) - 0.12) ^ 2)) -- середина лица плоская
|
||||
local yaw = math.asin(math.clamp((math.abs(x) - 0.12) / r, 0, 1)) * (x < 0 and 1 or -1)
|
||||
return CFrame.new(x * H.X, y * H.Y, z * H.Z) * CFrame.Angles(0, yaw, 0) * CFrame.new(0, 0, -(out or 0))
|
||||
end
|
||||
-- глаза и рот — блоками на лице (вместо наклейки face.png: её широкая улыбка вылезала из-под усов на щёки)
|
||||
function K.face(mouth)
|
||||
local head = rig:FindFirstChild("Head")
|
||||
for _, d in ipairs(head and head:GetChildren() or {}) do
|
||||
if d:IsA("Decal") then
|
||||
d:Destroy()
|
||||
end
|
||||
end
|
||||
-- у динамической головы Roblox лицо (глаза и широкая улыбка) нарисовано в текстуре самой головы:
|
||||
-- убираем текстуру, голова остаётся цвета кожи (Color), глаза и рот — наши блоки
|
||||
if head and head:IsA("MeshPart") then
|
||||
head.TextureID = ""
|
||||
end
|
||||
-- Roblox может добавить лицо из HumanoidDescription позже — убираем и его
|
||||
if head then
|
||||
head.ChildAdded:Connect(function(d)
|
||||
if d:IsA("Decal") then
|
||||
task.defer(function()
|
||||
d:Destroy()
|
||||
end)
|
||||
end
|
||||
end)
|
||||
end
|
||||
local EYE = Color3.fromRGB(34, 26, 22)
|
||||
for _, x in ipairs({ -1, 1 }) do
|
||||
K.part("Head", K.BLOCK, Vector3.new(H.X * 0.12, H.Y * (long and 0.75 or 0.4), H.Z * 0.5), CFrame.new(x * H.X * 0.47, long and -H.Y * 0.05 or H.Y * 0.05, H.Z * 0.1), color)
|
||||
K.part("Head", K.BLOCK, Vector3.new(H.X * 0.09, H.Y * 0.13, 0.05), K.onFace(x * 0.16, 0.06, -0.01), EYE)
|
||||
K.part("Head", K.BLOCK, Vector3.new(H.X * 0.035, H.Y * 0.04, 0.03), K.onFace(x * 0.16 + 0.02, 0.1, 0.012), Color3.fromRGB(240, 236, 226))
|
||||
end
|
||||
if mouth then
|
||||
K.part("Head", K.BLOCK, Vector3.new(H.X * 0.2, H.Y * 0.035, 0.04), K.onFace(0, -0.24, -0.01), Color3.fromRGB(120, 60, 50))
|
||||
end
|
||||
end
|
||||
-- бороды: full (окладистая), long (до груди), goatee (клинышком), stubble (щетина)
|
||||
-- спереди торса (в осях головы, в позе, где NPC одевают): за эту плоскость низ бороды не заходит
|
||||
function K.torsoFrontZ()
|
||||
local head, torso = rig:FindFirstChild("Head"), rig:FindFirstChild("UpperTorso")
|
||||
if not (head and torso) then
|
||||
return -H.Z * 0.45
|
||||
end
|
||||
return head.CFrame:PointToObjectSpace(torso.CFrame * Vector3.new(0, 0, -torso.Size.Z / 2 - 0.16)).Z
|
||||
end
|
||||
function K.hair(color, long)
|
||||
-- шапка волос: шар 1.06 головы, сдвинут назад — сверху, сзади и по бокам, а лоб и лицо открыты
|
||||
K.part("Head", K.BALL, Vector3.new(H.X * 1.06, H.Y * 1.0, H.Z * 1.02), CFrame.new(0, H.Y * 0.08, H.Z * 0.14), color)
|
||||
if long then
|
||||
K.part("Head", K.BALL, Vector3.new(H.X * 0.98, H.Y * 0.95, H.Z * 0.7), CFrame.new(0, -H.Y * 0.28, H.Z * 0.2), color)
|
||||
end
|
||||
end
|
||||
-- бакенбарды теперь часть бороды (боковые блоки), отдельно не ставятся
|
||||
function K.sideburns() end
|
||||
-- бороды в блочном стиле лавок: full (окладистая), long (до груди), goatee (клинышком), stubble (щетина).
|
||||
-- Всё приварено к голове. Верхний блок обнимает низ лица и щёки вплотную к голове; блоки ниже подбородка
|
||||
-- сужаются и стоят перед грудью (их задняя грань — на передней плоскости торса), поэтому при повороте
|
||||
-- головы не проходят сквозь тело.
|
||||
function K.beard(color, style, dark)
|
||||
dark = dark or color
|
||||
if style == "long" then
|
||||
K.part("Head", K.BALL, Vector3.new(H.X * 0.95, H.Y * 0.62, H.Z * 0.6), CFrame.new(0, -H.Y * 0.42, -H.Z * 0.28), color)
|
||||
K.part("Head", K.BLOCK, Vector3.new(H.X * 0.66, H.Y * 1.1, H.Z * 0.4), CFrame.new(0, -H.Y * 0.95, -H.Z * 0.34), color)
|
||||
K.part("Head", K.BALL, Vector3.new(H.X * 0.4, H.Y * 0.4, H.Z * 0.34), CFrame.new(0, -H.Y * 1.48, -H.Z * 0.36), dark)
|
||||
elseif style == "goatee" then
|
||||
K.part("Head", K.BLOCK, Vector3.new(H.X * 0.32, H.Y * 0.5, H.Z * 0.3), CFrame.new(0, -H.Y * 0.6, -H.Z * 0.38) * CFrame.Angles(math.rad(10), 0, 0), color)
|
||||
elseif style == "stubble" then
|
||||
K.part("Head", K.BLOCK, Vector3.new(H.X * 0.8, H.Y * 0.32, H.Z * 0.1), CFrame.new(0, -H.Y * 0.3, -H.Z * 0.5), color)
|
||||
else
|
||||
K.part("Head", K.BALL, Vector3.new(H.X * 0.98, H.Y * 0.7, H.Z * 0.62), CFrame.new(0, -H.Y * 0.42, -H.Z * 0.28), color)
|
||||
K.part("Head", K.BALL, Vector3.new(H.X * 0.72, H.Y * 0.6, H.Z * 0.5), CFrame.new(0, -H.Y * 0.72, -H.Z * 0.34), dark)
|
||||
local tf = K.torsoFrontZ()
|
||||
-- передняя плоскость бороды: не ближе к лицу, чем подбородок, и перед грудью
|
||||
local fz = math.min(-H.Z * 0.5, tf - 0.08)
|
||||
local function slab(w, y0, y1, z0, z1, c) -- блок между высотами y0..y1 и глубинами z0 (перед)..z1 (зад)
|
||||
K.part("Head", K.BLOCK, Vector3.new(H.X * w, H.Y * (y1 - y0), z1 - z0), CFrame.new(0, H.Y * (y0 + y1) / 2, (z0 + z1) / 2), c or color)
|
||||
end
|
||||
local function below(w, h, y, c) -- блок ниже подбородка: перед грудью, вплотную к блоку над ним
|
||||
slab(w, y - h / 2, y + h / 2 + 0.02, fz, math.min(fz + H.Z * 0.24, math.max(tf, fz + 0.1)), c)
|
||||
end
|
||||
if style == "stubble" then
|
||||
K.part("Head", K.BLOCK, Vector3.new(H.X * 0.84, H.Y * 0.26, H.Z * 0.5), CFrame.new(0, -H.Y * 0.36, -H.Z * 0.26), color)
|
||||
return
|
||||
elseif style == "goatee" then
|
||||
K.part("Head", K.BLOCK, Vector3.new(H.X * 0.28, H.Y * 0.22, H.Z * 0.2), CFrame.new(0, -H.Y * 0.43, -H.Z * 0.42), color)
|
||||
below(0.18, 0.18, -0.6, dark)
|
||||
return
|
||||
end
|
||||
-- низ лица и щёки (вплотную: задняя часть блока утоплена в голову)
|
||||
K.part("Head", K.BLOCK, Vector3.new(H.X * 0.9, H.Y * 0.36, H.Z * 0.62), CFrame.new(0, -H.Y * 0.33, -H.Z * 0.2), color)
|
||||
-- подбородок: от лица вперёд до передней плоскости бороды — без щели с нижними блоками
|
||||
slab(0.66, -0.68, -0.48, fz, -H.Z * 0.05, color)
|
||||
if style == "long" then
|
||||
below(0.64, 0.34, -0.85, color)
|
||||
below(0.42, 0.26, -1.15, dark)
|
||||
else
|
||||
below(0.42, 0.2, -0.78, dark)
|
||||
end
|
||||
K.beardTurn = 35 -- с бородой голова поворачивается не так сильно (LobbyLife)
|
||||
end
|
||||
-- усы: bushy (пышные), brush (щёткой), thin (тонкие подкрученные)
|
||||
-- усы: два блока под носом; bushy — пошире и с опущенными концами, brush — щёткой, thin — тонкие
|
||||
function K.moustache(color, style)
|
||||
for _, x in ipairs({ -1, 1 }) do
|
||||
if style == "brush" then
|
||||
K.part("Head", K.BLOCK, Vector3.new(H.X * 0.3, H.Y * 0.14, H.Z * 0.16), CFrame.new(x * H.X * 0.14, -H.Y * 0.14, -H.Z * 0.53), color)
|
||||
K.part("Head", K.BLOCK, Vector3.new(H.X * 0.2, H.Y * 0.1, 0.1), K.onFace(x * 0.1, -0.13, 0.0), color)
|
||||
elseif style == "thin" then
|
||||
K.part("Head", K.BLOCK, Vector3.new(H.X * 0.34, H.Y * 0.06, 0.08), CFrame.new(x * H.X * 0.2, -H.Y * 0.14, -H.Z * 0.53) * CFrame.Angles(0, 0, x * math.rad(-18)), color)
|
||||
K.part("Head", K.BLOCK, Vector3.new(H.X * 0.24, H.Y * 0.045, 0.06), K.onFace(x * 0.14, -0.13, -0.01) * CFrame.Angles(0, 0, x * math.rad(-15)), color)
|
||||
else
|
||||
K.part("Head", K.BALL, Vector3.new(H.X * 0.42, H.Y * 0.2, H.Z * 0.22), CFrame.new(x * H.X * 0.2, -H.Y * 0.14, -H.Z * 0.52) * CFrame.Angles(0, 0, x * math.rad(-12)), color)
|
||||
K.part("Head", K.BLOCK, Vector3.new(H.X * 0.28, H.Y * 0.12, 0.12), K.onFace(x * 0.15, -0.14, 0.0) * CFrame.Angles(0, 0, x * math.rad(-10)), color)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- брови: тонкие объёмные планки вплотную к лицу. Ставятся в конце (K.finish) и только если лоб не закрыт
|
||||
-- головным убором: иначе они торчали бы сквозь капюшон, платок или шапку
|
||||
local browsWanted
|
||||
function K.brows(color, angry)
|
||||
for _, x in ipairs({ -1, 1 }) do
|
||||
K.part("Head", K.BLOCK, Vector3.new(H.X * 0.24, H.Y * 0.07, 0.08), CFrame.new(x * H.X * 0.2, H.Y * 0.2, -H.Z * 0.5) * CFrame.Angles(0, 0, x * math.rad(angry and 14 or -8)), color)
|
||||
browsWanted = { color, angry }
|
||||
end
|
||||
function K.finish()
|
||||
if browsWanted and not K.forehead then
|
||||
local color, angry = browsWanted[1], browsWanted[2]
|
||||
for _, x in ipairs({ -1, 1 }) do
|
||||
K.part("Head", K.BLOCK, Vector3.new(H.X * 0.17, H.Y * 0.05, 0.05), K.onFace(x * 0.17, 0.18, -0.005) * CFrame.Angles(0, 0, x * math.rad(angry and 14 or -8)), color)
|
||||
end
|
||||
end
|
||||
if K.beardTurn then
|
||||
rig:SetAttribute("HeadTurnMax", K.beardTurn)
|
||||
end
|
||||
end
|
||||
function K.nose(color)
|
||||
K.part("Head", K.BALL, Vector3.new(H.X * 0.22, H.Y * 0.2, H.Z * 0.2), CFrame.new(0, 0, -H.Z * 0.55), color)
|
||||
K.part("Head", K.BALL, Vector3.new(H.X * 0.2, H.Y * 0.18, 0.2), K.onFace(0, 0.0, 0.0), color)
|
||||
end
|
||||
-- очки: тонкая квадратная оправа без стёкол (глаза видно), перемычка и дужки
|
||||
function K.glasses(color)
|
||||
@@ -273,6 +367,10 @@ local function kit(rig)
|
||||
|
||||
---------------------------------------------------------------- головные уборы
|
||||
function K.hat(kind, c1, c2)
|
||||
-- эти уборы закрывают лоб: бровей не будет
|
||||
if kind == "hood" or kind == "scarf" or kind == "ushanka" or kind == "bandana" or kind == "kokoshnik" or kind == "headband" then
|
||||
K.forehead = true
|
||||
end
|
||||
if kind == "straw" then -- соломенная шляпа с широкими полями
|
||||
K.part("Head", K.CYL, Vector3.new(0.14, H.X * 2.3, H.Z * 2.3), CFrame.new(0, H.Y * 0.4, 0) * K.UP, c1)
|
||||
K.part("Head", K.CYL, Vector3.new(H.Y * 0.5, H.X * 1.08, H.Z * 1.08), CFrame.new(0, H.Y * 0.62, 0) * K.UP, c1)
|
||||
@@ -448,16 +546,12 @@ LOOKS["Скупщик Гриша"] = {
|
||||
K.part("LowerTorso", K.CYL, Vector3.new(0.08, 0.3, 0.3), side * CFrame.new(-0.02, -0.1, 0), P.iron, K.METAL) -- кольцо
|
||||
|
||||
-- голова: пышная рыжая борода, усы, брови, бакенбарды, нос картошкой
|
||||
K.part("Head", K.BALL, Vector3.new(H.X * 0.98, H.Y * 0.7, H.Z * 0.62), CFrame.new(0, -H.Y * 0.42, -H.Z * 0.28), P.ginger)
|
||||
K.part("Head", K.BALL, Vector3.new(H.X * 0.72, H.Y * 0.6, H.Z * 0.5), CFrame.new(0, -H.Y * 0.72, -H.Z * 0.34), P.ginger)
|
||||
K.part("Head", K.BALL, Vector3.new(H.X * 0.4, H.Y * 0.36, H.Z * 0.32), CFrame.new(0, -H.Y * 0.98, -H.Z * 0.36), P.gingerDark)
|
||||
for _, x in ipairs({ -1, 1 }) do
|
||||
K.part("Head", K.BALL, Vector3.new(H.X * 0.42, H.Y * 0.2, H.Z * 0.22), CFrame.new(x * H.X * 0.2, -H.Y * 0.14, -H.Z * 0.52) * CFrame.Angles(0, 0, x * math.rad(-12)), P.gingerDark) -- усы
|
||||
K.part("Head", K.BLOCK, Vector3.new(H.X * 0.24, H.Y * 0.07, 0.08), CFrame.new(x * H.X * 0.2, H.Y * 0.2, -H.Z * 0.5) * CFrame.Angles(0, 0, x * math.rad(-8)), P.gingerDark) -- брови
|
||||
K.part("Head", K.BLOCK, Vector3.new(H.X * 0.14, H.Y * 0.5, H.Z * 0.46), CFrame.new(x * H.X * 0.47, -H.Y * 0.06, -H.Z * 0.08), P.ginger) -- бакенбарды
|
||||
end
|
||||
K.part("Head", K.BALL, Vector3.new(H.X * 0.24, H.Y * 0.22, H.Z * 0.2), CFrame.new(0, -H.Y * 0.0, -H.Z * 0.55), Color3.fromRGB(214, 146, 118)) -- нос
|
||||
K.part("Head", K.BLOCK, Vector3.new(H.X * 1.0, H.Y * 0.34, H.Z * 0.26), CFrame.new(0, H.Y * 0.04, H.Z * 0.42), P.ginger) -- волосы сзади
|
||||
K.beard(P.ginger, "full", P.gingerDark)
|
||||
K.moustache(P.gingerDark)
|
||||
K.brows(P.gingerDark)
|
||||
K.sideburns(P.ginger)
|
||||
K.part("Head", K.BALL, Vector3.new(H.X * 0.22, H.Y * 0.2, 0.22), K.onFace(0, 0.0, 0.0), Color3.fromRGB(214, 146, 118)) -- нос картошкой
|
||||
K.hair(P.ginger)
|
||||
|
||||
-- вязаная шапка: колпак в полоску, отворот, помпон
|
||||
K.part("Head", K.BALL, Vector3.new(H.X * 1.1, H.Y * 0.8, H.Z * 1.1), CFrame.new(0, H.Y * 0.55, 0.04), P.green, K.FABRIC)
|
||||
@@ -506,10 +600,8 @@ LOOKS["Продавец Михалыч"] = {
|
||||
K.part("LowerTorso", K.CYL, Vector3.new(0.2, 0.3, 0.3), CFrame.new(UT.X * 0.2, -0.05, -UT.Z * 0.5 - 0.32), P.crimson)
|
||||
-- лысина с венчиком седых волос, очки, усы щёткой
|
||||
local GREY = C(176, 172, 164)
|
||||
K.part("Head", K.BLOCK, Vector3.new(H.X * 1.02, H.Y * 0.36, H.Z * 0.3), CFrame.new(0, H.Y * 0.0, H.Z * 0.4), GREY)
|
||||
for _, x in ipairs({ -1, 1 }) do
|
||||
K.part("Head", K.BLOCK, Vector3.new(H.X * 0.14, H.Y * 0.36, H.Z * 0.6), CFrame.new(x * H.X * 0.48, H.Y * 0.02, H.Z * 0.12), GREY)
|
||||
end
|
||||
-- венчик: шар волос опущен и сдвинут назад — макушка лысая, седина по бокам и на затылке
|
||||
K.part("Head", K.BALL, Vector3.new(H.X * 1.06, H.Y * 0.62, H.Z * 1.0), CFrame.new(0, -H.Y * 0.02, H.Z * 0.16), GREY)
|
||||
K.glasses(P.brass)
|
||||
K.moustache(C(150, 140, 128), "brush")
|
||||
K.brows(GREY)
|
||||
@@ -949,7 +1041,20 @@ end
|
||||
|
||||
-- одеть уже созданный риг
|
||||
function NpcLooks.dress(rig, look)
|
||||
look.dress(rig, kit(rig))
|
||||
local K = kit(rig)
|
||||
look.dress(rig, K)
|
||||
K.face(not K.beardTurn) -- рот виден только у безбородых
|
||||
K.finish()
|
||||
-- одежда ног, спрятанных под длинным подолом, не нужна: штанины торчали бы сквозь юбку при шаге
|
||||
if K.legsHidden then
|
||||
for _, p in ipairs(rig:GetChildren()) do
|
||||
local w = p.Name == "Look" and p:FindFirstChildOfClass("WeldConstraint")
|
||||
local body = w and w.Part0
|
||||
if body and (body.Name:find("UpperLeg") or body.Name:find("LowerLeg")) then
|
||||
p:Destroy()
|
||||
end
|
||||
end
|
||||
end
|
||||
if look.lines then
|
||||
rig:SetAttribute("NpcLines", table.concat(look.lines, "|"))
|
||||
end
|
||||
|
||||
@@ -1967,6 +1967,16 @@ local function spawnNpc(spot, parent)
|
||||
rig:PivotTo(spot.CFrame + Vector3.new(0, hum.HipHeight + root.Size.Y / 2 - 3, 0))
|
||||
end
|
||||
rig.Parent = parent
|
||||
-- продавец под навесом лавки: имя над головой упиралось бы в крышу, а лавку и так подписывает вывеска
|
||||
do
|
||||
local params = RaycastParams.new()
|
||||
params.FilterType = Enum.RaycastFilterType.Exclude
|
||||
params.FilterDescendantsInstances = { rig }
|
||||
local headPos = root.Position + Vector3.new(0, 2, 0)
|
||||
if Workspace:Raycast(headPos, V(0, 8, 0), params) then
|
||||
hum.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
|
||||
end
|
||||
end
|
||||
|
||||
local head = rig:FindFirstChild("Head")
|
||||
if head then
|
||||
|
||||
@@ -237,23 +237,47 @@ end)
|
||||
|
||||
-- в стиле интерфейса (UiTheme): тёмное дерево с золотой рамкой; масштаб — как у основного интерфейса
|
||||
local Theme = require(script.Parent:WaitForChild("UiTheme"))
|
||||
local hud = new("ScreenGui", { Name = "WeatherHud", ResetOnSpawn = false, IgnoreGuiInset = false, Parent = player:WaitForChild("PlayerGui") })
|
||||
-- DisplayOrder −1: плашка под основным интерфейсом, поэтому открытые окна закрывают её, а не наоборот
|
||||
local hud = new("ScreenGui", { Name = "WeatherHud", ResetOnSpawn = false, IgnoreGuiInset = false, DisplayOrder = -1, Parent = player:WaitForChild("PlayerGui") })
|
||||
-- плашка с медальоном: слева круглая золотая оправа с рисованной иконкой погоды, справа погода, время и бонус
|
||||
local pill = new("Frame", {
|
||||
Size = UDim2.fromOffset(230, 48), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -12, 0, 74),
|
||||
BackgroundColor3 = Theme.C.woodDark, BackgroundTransparency = 0.08, Parent = Theme.followScale(hud),
|
||||
Size = UDim2.fromOffset(250, 52), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -12, 0, 74),
|
||||
BackgroundColor3 = Color3.new(1, 1, 1), Parent = Theme.followScale(hud),
|
||||
})
|
||||
new("UICorner", { CornerRadius = UDim.new(0, 8), Parent = pill })
|
||||
local pillStroke = new("UIStroke", { Color = Theme.C.goldDark, Thickness = 2, Transparency = 0, Parent = pill })
|
||||
new("UICorner", { CornerRadius = UDim.new(0, 26), Parent = pill })
|
||||
Theme.woodGradient(Theme.C.wood, Theme.C.woodDark).Parent = pill
|
||||
local pillStroke = new("UIStroke", { Color = Theme.C.goldDark, Thickness = 2, Transparency = 0, ApplyStrokeMode = Enum.ApplyStrokeMode.Border, Parent = pill })
|
||||
local medal = new("Frame", {
|
||||
Size = UDim2.fromOffset(52, 52), BackgroundColor3 = Color3.new(1, 1, 1), ZIndex = 2, Parent = pill,
|
||||
})
|
||||
new("UICorner", { CornerRadius = UDim.new(1, 0), Parent = medal })
|
||||
new("UIGradient", { Color = ColorSequence.new(Color3.fromRGB(46, 70, 96), Color3.fromRGB(24, 32, 48)), Rotation = 90, Parent = medal })
|
||||
new("UIStroke", { Color = Theme.C.gold, Thickness = 3, Parent = medal })
|
||||
-- фэнтези-оформление (assets/ui3): плашка — деревянная табличка, медальон — резное кольцо с листьями
|
||||
if Theme.skin(pill, "chip") then
|
||||
medal.BackgroundTransparency = 1
|
||||
medal:FindFirstChildOfClass("UIStroke").Enabled = false
|
||||
medal:FindFirstChildOfClass("UIGradient").Enabled = false
|
||||
new("ImageLabel", { Size = UDim2.new(1, 16, 1, 16), Position = UDim2.fromOffset(-8, -8), BackgroundTransparency = 1, Image = Theme.UI.get("medallion"), ZIndex = 2, Parent = medal })
|
||||
end
|
||||
local medalIcon = new("Frame", { Size = UDim2.fromOffset(36, 36), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0.5, 0.5), BackgroundTransparency = 1, ZIndex = 3, Parent = medal })
|
||||
local line1 = new("TextLabel", {
|
||||
Size = UDim2.new(1, -16, 0, 24), Position = UDim2.fromOffset(10, 3), BackgroundTransparency = 1,
|
||||
Size = UDim2.new(1, -72, 0, 24), Position = UDim2.fromOffset(62, 4), BackgroundTransparency = 1,
|
||||
FontFace = Theme.TITLE_FACE, TextSize = 16, TextColor3 = Theme.C.parchment, TextXAlignment = Enum.TextXAlignment.Left,
|
||||
Text = "", Parent = pill,
|
||||
TextStrokeColor3 = Theme.C.ink, TextStrokeTransparency = 0.4, TextTruncate = Enum.TextTruncate.AtEnd, Text = "", Parent = pill,
|
||||
})
|
||||
local line2 = new("TextLabel", {
|
||||
Size = UDim2.new(1, -16, 0, 16), Position = UDim2.fromOffset(10, 27), BackgroundTransparency = 1,
|
||||
Size = UDim2.new(1, -72, 0, 16), Position = UDim2.fromOffset(62, 29), BackgroundTransparency = 1,
|
||||
FontFace = Theme.BODY2_FACE, TextSize = 12, TextColor3 = Color3.fromRGB(170, 215, 140), TextXAlignment = Enum.TextXAlignment.Left,
|
||||
Text = "", Parent = pill,
|
||||
TextTruncate = Enum.TextTruncate.AtEnd, Text = "", Parent = pill,
|
||||
})
|
||||
-- на телефоне плашка мельче (как таблица игроков)
|
||||
local pillScale = new("UIScale", { Name = "LayoutScale", Parent = pill })
|
||||
Theme.onLayout(function(compact)
|
||||
pillScale.Scale = compact and 0.72 or 1
|
||||
end)
|
||||
local WEATHER_ICON = { Clear = "sun", Cloudy = "cloud", Rain = "rain", Storm = "storm", Fog = "fog" }
|
||||
local shownIcon = nil
|
||||
|
||||
local function weatherName(w, placeId)
|
||||
return (w.names and w.names[placeId]) or w.name
|
||||
@@ -263,7 +287,13 @@ local lastShownWeather = nil
|
||||
local function refreshPill(clock, night, w, placeId)
|
||||
local h = math.floor(clock)
|
||||
local m = math.floor((clock - h) * 60)
|
||||
line1.Text = ("%s %s · %s %02d:%02d"):format(w.icon, weatherName(w, placeId), night and "🌙" or "☀", h, m)
|
||||
line1.Text = ("%s · %02d:%02d"):format(weatherName(w, placeId), h, m)
|
||||
-- ночью в ясную погоду — луна; иначе иконка погоды (пока картинок нет — эмодзи из конфига)
|
||||
local iconName = (night and w.id == "Clear") and "moon" or (WEATHER_ICON[w.id] or "sun")
|
||||
if shownIcon ~= iconName then
|
||||
shownIcon = iconName
|
||||
Theme.setIcon(medalIcon, iconName, iconName == "moon" and "🌙" or w.icon)
|
||||
end
|
||||
local bonus = {}
|
||||
if w.desc then
|
||||
table.insert(bonus, w.desc)
|
||||
@@ -300,7 +330,8 @@ local function scanLamps()
|
||||
if d:IsA("Light") and d.Parent:IsA("BasePart") and not lamps[d.Parent] then
|
||||
local bulb = d.Parent
|
||||
local s = bulb.Size
|
||||
if bulb.Material == Enum.Material.Neon and math.max(s.X, s.Y, s.Z) <= 2.5 then
|
||||
-- AlwaysLit — свет внутри помещений (люстра и камин в зале гильдии): горит и днём
|
||||
if bulb.Material == Enum.Material.Neon and math.max(s.X, s.Y, s.Z) <= 2.5 and not bulb:GetAttribute("AlwaysLit") then
|
||||
lamps[bulb] = { color = bulb.Color, lights = {} }
|
||||
end
|
||||
end
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,93 @@
|
||||
-- FountainFish (LocalScript) -> StarterPlayer > StarterPlayerScripts
|
||||
-- Рыбки в чаше фонтана лобби (только у этого игрока): плавают по кругу между центральной колонной и бортиком,
|
||||
-- поворачиваются по ходу движения и виляют хвостом (группа Tail модели). Модели — ReplicatedStorage.FountainFishModels
|
||||
-- (их кладёт tools/lobby-fix8.lua из assets/props/fish_*.bbmodel); голова рыбы смотрит в −Z модели.
|
||||
|
||||
local RunService = game:GetService("RunService")
|
||||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||
|
||||
local models = ReplicatedStorage:WaitForChild("FountainFishModels", 30)
|
||||
local map = workspace:WaitForChild("FishingMap")
|
||||
local holder = map:WaitForChild("LobbyFix3", 30)
|
||||
local fountain = holder and holder:WaitForChild("LobbyFountain", 30)
|
||||
if not (models and fountain) then
|
||||
return
|
||||
end
|
||||
local water = fountain:WaitForChild("Water", 10)
|
||||
local basin = water and water:WaitForChild("Water_Basin_0", 10)
|
||||
local tier = water and water:FindFirstChild("Water_Tier2_0")
|
||||
if not basin then
|
||||
return
|
||||
end
|
||||
|
||||
local center = fountain:GetPivot().Position
|
||||
local waterY = basin.Position.Y
|
||||
-- по воде: снаружи — край нижней чаши, внутри — средняя чаша на колонне (+ запас)
|
||||
local outer = basin.Size.X / 2 - 1.2
|
||||
local inner = (tier and tier.Size.X / 2 or outer * 0.5) + 1.4
|
||||
local midR = (outer + inner) / 2
|
||||
local swing = math.max(0.3, (outer - inner) / 2 - 1)
|
||||
|
||||
-- { модель, скорость (рад/с), фаза, направление }
|
||||
local FISH = {
|
||||
{ "fish_gold", 0.32, 0, 1 },
|
||||
{ "fish_koi", 0.26, 2.1, 1 },
|
||||
{ "fish_carp", 0.38, 4.2, -1 },
|
||||
{ "fish_roach", 0.3, 1.0, -1 },
|
||||
}
|
||||
|
||||
local swimmers = {}
|
||||
for _, f in ipairs(FISH) do
|
||||
local src = models:FindFirstChild(f[1])
|
||||
if src then
|
||||
local m = src:Clone()
|
||||
m.Name = "FountainFish"
|
||||
m:PivotTo(CFrame.new())
|
||||
-- детали хвоста: смещение от корня хвоста (виляют), остальные — от центра рыбы
|
||||
local tailRoot = CFrame.new(0, 0, m:GetAttribute("TailPivotZ") or 0.4)
|
||||
local body, tail = {}, {}
|
||||
local tailGroup = m:FindFirstChild("Tail")
|
||||
for _, p in ipairs(m:GetDescendants()) do
|
||||
if p:IsA("BasePart") then
|
||||
if tailGroup and p:IsDescendantOf(tailGroup) then
|
||||
table.insert(tail, { p, tailRoot:ToObjectSpace(p.CFrame) })
|
||||
else
|
||||
table.insert(body, { p, p.CFrame })
|
||||
end
|
||||
end
|
||||
end
|
||||
m.Parent = workspace
|
||||
table.insert(swimmers, { body = body, tail = tail, tailRoot = tailRoot, speed = f[2], phase = f[3], dir = f[4], wobble = math.random() * 10 })
|
||||
end
|
||||
end
|
||||
|
||||
local parts, cframes = {}, {}
|
||||
local t0 = os.clock()
|
||||
RunService.RenderStepped:Connect(function()
|
||||
local cam = workspace.CurrentCamera
|
||||
if cam and (cam.CFrame.Position - center).Magnitude > 160 then
|
||||
return -- игрок в другом мире
|
||||
end
|
||||
local t = os.clock() - t0
|
||||
table.clear(parts)
|
||||
table.clear(cframes)
|
||||
for _, s in ipairs(swimmers) do
|
||||
local a = s.phase + t * s.speed * s.dir
|
||||
-- радиус «дышит» — рыбка не ходит по идеальной окружности
|
||||
local r = midR + math.sin(t * 0.5 + s.phase * 3) * swing
|
||||
local pos = center + Vector3.new(math.cos(a) * r, 0, math.sin(a) * r)
|
||||
pos = Vector3.new(pos.X, waterY - 0.15 + math.sin(t * 1.7 + s.phase) * 0.05, pos.Z)
|
||||
local tangent = Vector3.new(-math.sin(a), 0, math.cos(a)) * s.dir
|
||||
local root = CFrame.lookAt(pos, pos + tangent) * CFrame.Angles(0, math.sin(t * 7 + s.wobble) * math.rad(4), 0)
|
||||
for _, e in ipairs(s.body) do
|
||||
table.insert(parts, e[1])
|
||||
table.insert(cframes, root * e[2])
|
||||
end
|
||||
local wag = root * s.tailRoot * CFrame.Angles(0, math.sin(t * 7 + s.wobble + 1.2) * math.rad(28), 0)
|
||||
for _, e in ipairs(s.tail) do
|
||||
table.insert(parts, e[1])
|
||||
table.insert(cframes, wag * e[2])
|
||||
end
|
||||
end
|
||||
workspace:BulkMoveTo(parts, cframes, Enum.BulkMoveMode.FireCFrameChanged)
|
||||
end)
|
||||
@@ -279,22 +279,36 @@ end)
|
||||
|
||||
---------------------------------------------------------------- HUD: жемчуг, печати, ранг, отдых
|
||||
|
||||
local hud = K.hud
|
||||
hud.Parent.Size = UDim2.fromOffset(290, 198)
|
||||
local guildLine = text({ Size = UDim2.new(1, 0, 0, 20), Position = UDim2.fromOffset(0, 149), TextSize = 14, Font = BODY2, RichText = true, Text = "", Parent = hud })
|
||||
-- отдых: строка видна, только пока есть двойной опыт
|
||||
local restText = text({ Size = UDim2.new(1, 0, 0, 18), Position = UDim2.fromOffset(0, 169), Font = BODY2, TextSize = 13, TextColor3 = Color3.fromRGB(170, 215, 255), Text = "", Parent = hud })
|
||||
local restPlate = restText
|
||||
-- ряд «фишек» в панели игрока: ранг, печати, жемчуг; ниже — отдых (только пока есть двойной опыт)
|
||||
local guildRow = K.hudRow(3)
|
||||
local rankChip, rankText = Theme.chip(guildRow, "guild", 1)
|
||||
local sealChip, sealText = Theme.chip(guildRow, "seal", 2)
|
||||
local pearlChip, pearlText = Theme.chip(guildRow, "pearl", 3, C.pearl)
|
||||
local restPlate = K.hudRow(4, 22)
|
||||
local restText = text({ Size = UDim2.new(1, 0, 1, 0), Font = BODY2, TextSize = 13, TextColor3 = Color3.fromRGB(170, 215, 255), Text = "", Parent = restPlate })
|
||||
Theme.tooltip(rankChip, function()
|
||||
local nextSeals = player:GetAttribute("SealsNext")
|
||||
return nextSeals and ("Ранг гильдии · до следующего нужно %s печатей"):format(fmt(nextSeals)) or "Ранг гильдии · высший"
|
||||
end)
|
||||
Theme.tooltip(sealChip, "Печати гильдии: за заказы, нужны для ранга")
|
||||
Theme.tooltip(pearlChip, "Жемчуг: редкая валюта гильдии")
|
||||
|
||||
local function refreshHud()
|
||||
local idx = player:GetAttribute("RankIdx") or 1
|
||||
local r = rankOf(idx)
|
||||
local nextSeals = player:GetAttribute("SealsNext")
|
||||
guildLine.Text = ("<font color=\"#%s\"><b>⚔ %s</b></font> %s %s%s %s %s"):format(r.color:Lerp(WHITE, 0.3):ToHex(), r.id,
|
||||
Theme.SEAL, fmt(player:GetAttribute("Seals") or 0), nextSeals and ("/" .. fmt(nextSeals)) or "", Theme.PEARL, fmt(player:GetAttribute("Pearls") or 0))
|
||||
local seals = player:GetAttribute("Seals") or 0
|
||||
rankText.Text = ("<b>%s</b>"):format(r.id)
|
||||
rankText.TextColor3 = r.color:Lerp(WHITE, 0.35)
|
||||
sealText.Text = fmt(seals) .. (nextSeals and ("<font color=\"#C0AC88\">/" .. fmt(nextSeals) .. "</font>") or "")
|
||||
pearlText.Text = fmt(player:GetAttribute("Pearls") or 0)
|
||||
local rest = player:GetAttribute("RestLeft") or 0
|
||||
restPlate.Visible = rest > 0
|
||||
restText.Text = ("🛌 Отдых: опыт ×2 ещё %d мин"):format(math.ceil(rest / 60))
|
||||
-- значок на кнопке «Гильдия»: в ловушках есть рыба или хватает печатей на новый ранг
|
||||
if K.sideDots and K.sideDots["Гильдия"] then
|
||||
K.sideDots["Гильдия"].Visible = (player:GetAttribute("TrapFish") or 0) > 0 or (nextSeals ~= nil and seals >= nextSeals)
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------- наживка и автоловля (правый низ, над кнопкой прыжка на телефоне)
|
||||
@@ -309,6 +323,12 @@ end)
|
||||
K.openBait = function()
|
||||
openGuild("bait")
|
||||
end
|
||||
task.spawn(function() -- для снимков в Studio (DevOpen = "guild:orders")
|
||||
while not K.windows do
|
||||
task.wait(0.2)
|
||||
end
|
||||
K.windows.guild = { open = openGuild }
|
||||
end)
|
||||
local autoBtn = btn({ Size = UDim2.fromOffset(130, 52), BackgroundColor3 = C.woodLight, Text = "", TextSize = 15, LayoutOrder = 2, Visible = false, Parent = bar }, function()
|
||||
remote:FireServer("AutoFish", not player:GetAttribute("AutoFish"))
|
||||
end)
|
||||
@@ -391,7 +411,7 @@ remote.OnClientEvent:Connect(function(action, a, b, c, d)
|
||||
end)
|
||||
|
||||
player.AttributeChanged:Connect(function(name)
|
||||
if name == "Seals" or name == "Pearls" or name == "RankIdx" or name == "SealsNext" or name == "RestLeft" then
|
||||
if name == "Seals" or name == "Pearls" or name == "RankIdx" or name == "SealsNext" or name == "RestLeft" or name == "TrapFish" then
|
||||
refreshHud()
|
||||
end
|
||||
if name == "Bait" or name == "BaitCount" or name == "AutoFish" or name == "RankIdx" then
|
||||
|
||||
@@ -46,6 +46,9 @@ task.spawn(hideCore)
|
||||
local function woodPanel(props)
|
||||
local f = new("Frame", props, { corner(10), stroke(C.goldDark, 2.5, 0), Theme.woodGradient(C.wood, C.woodDark) })
|
||||
Theme.innerBorder(f, 4, 7, C.gold, 0.55)
|
||||
task.defer(function()
|
||||
Theme.skin(f, "frame_small") -- резная рамка (assets/ui3), если загружена
|
||||
end)
|
||||
return f
|
||||
end
|
||||
|
||||
@@ -64,7 +67,7 @@ local row = new("Frame", { Size = UDim2.fromScale(0, 1), AutomaticSize = Enum.Au
|
||||
-- ярлычок над слотами
|
||||
do
|
||||
local tag = new("Frame", {
|
||||
Size = UDim2.fromOffset(0, 24), AutomaticSize = Enum.AutomaticSize.X, AnchorPoint = Vector2.new(0, 1), Position = UDim2.new(0, 34, 0, 6),
|
||||
Name = "PickTag", Size = UDim2.fromOffset(0, 24), AutomaticSize = Enum.AutomaticSize.X, AnchorPoint = Vector2.new(0, 1), Position = UDim2.new(0, 34, 0, 6),
|
||||
BackgroundColor3 = WHITE, ZIndex = 3, Parent = bar,
|
||||
}, { corner(8), stroke(C.goldDark, 2, 0), Theme.woodGradient(C.woodLight, C.wood), new("UIPadding", { PaddingLeft = UDim.new(0, 10), PaddingRight = UDim.new(0, 10) }) })
|
||||
text({ Size = UDim2.fromScale(0, 1), AutomaticSize = Enum.AutomaticSize.X, Font = BODY2, TextSize = 13, TextColor3 = C.parchment, Text = "Выбрать удочку", ZIndex = 4, Parent = tag })
|
||||
@@ -175,7 +178,23 @@ for i = 1, SLOTS do
|
||||
local num = new("Frame", { Size = UDim2.fromOffset(18, 18), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, 6), BackgroundColor3 = C.bg, ZIndex = 3, Parent = s },
|
||||
{ corner(9), stroke(C.gold, 1.2) })
|
||||
text({ Size = UDim2.fromScale(1, 1), Font = TITLE, TextSize = 11, TextXAlignment = CENTER, TextColor3 = C.goldBright, Text = tostring(i), ZIndex = 4, Parent = num })
|
||||
-- гнездо в резном дереве вместо кнопки-доски; номер — на золотом сургучном кружке
|
||||
if Theme.UI.get("slot") then
|
||||
Theme.unskin(s)
|
||||
Theme.skin(s, "slot", { keepStroke = true, mult = 0.8 })
|
||||
num.BackgroundTransparency = 1
|
||||
num:FindFirstChildOfClass("UIStroke").Enabled = false
|
||||
num.Size = UDim2.fromOffset(22, 22)
|
||||
new("ImageLabel", { Size = UDim2.fromScale(1, 1), BackgroundTransparency = 1, Image = Theme.UI.get("gold_dot"), ZIndex = 3, Parent = num })
|
||||
num:FindFirstChildOfClass("TextLabel").ZIndex = 4
|
||||
num:FindFirstChildOfClass("TextLabel").TextColor3 = C.ink
|
||||
end
|
||||
slots[i] = { button = s, icon = icon, stroke = s:FindFirstChildOfClass("UIStroke") }
|
||||
Theme.pressFx(s)
|
||||
Theme.tooltip(s, function()
|
||||
local rod = slots[i].rod
|
||||
return rod and ("<b>%s</b> · клавиша %d"):format(rod.name, i) or "Пустой слот: удочки покупают в лавке"
|
||||
end)
|
||||
end
|
||||
arrow(10, "›", 1)
|
||||
|
||||
@@ -192,19 +211,41 @@ new("UITextSizeConstraint", { MaxTextSize = 17, Parent = rodName })
|
||||
local rodCheck = new("Frame", { Size = UDim2.fromOffset(22, 22), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.new(1, -4, 0, 4), BackgroundColor3 = C.forest, ZIndex = 3, Parent = rodCard },
|
||||
{ corner(11), stroke(WHITE, 2) })
|
||||
text({ Size = UDim2.fromScale(1, 1), Font = TITLE, TextSize = 13, TextXAlignment = CENTER, Text = "✓", ZIndex = 4, Parent = rodCheck })
|
||||
Theme.pressFx(rodCard)
|
||||
Theme.tooltip(rodCard, function()
|
||||
return inHand() and "Убрать удочку" or "Взять удочку в руки"
|
||||
end)
|
||||
|
||||
-- наживка
|
||||
local baitCard = new("Frame", { Size = UDim2.fromOffset(190, 60), BackgroundColor3 = WHITE, LayoutOrder = 13, Parent = row },
|
||||
{ corner(8), stroke(C.gold, 1.5, 0.15), Theme.woodGradient(C.woodLight, C.wood) })
|
||||
local baitIcon = text({ Size = UDim2.fromOffset(44, 44), Position = UDim2.fromOffset(6, 8), TextScaled = true, TextXAlignment = CENTER, Text = "🐛", Parent = baitCard })
|
||||
-- значок наживки: у выбранной — её эмодзи из конфига, без наживки — рисованный червяк
|
||||
Theme.skin(baitCard, "btn_wood")
|
||||
local baitIcon = new("Frame", { Size = UDim2.fromOffset(44, 44), Position = UDim2.fromOffset(6, 8), BackgroundTransparency = 1, Parent = baitCard })
|
||||
local function setBaitIcon(b)
|
||||
local key = b and b.id or ""
|
||||
if baitIcon:GetAttribute("Shown") == key then
|
||||
return
|
||||
end
|
||||
baitIcon:SetAttribute("Shown", key)
|
||||
local el = Theme.setIcon(baitIcon, "worm")
|
||||
if b and b.icon then
|
||||
el:Destroy()
|
||||
text({ Name = "Icon", Size = UDim2.fromScale(1, 1), TextScaled = true, TextXAlignment = CENTER, Text = b.icon, Parent = baitIcon })
|
||||
end
|
||||
end
|
||||
local baitName = text({ Size = UDim2.new(1, -104, 0, 24), Position = UDim2.fromOffset(54, 6), Font = TITLE, TextScaled = true, Text = "", Parent = baitCard })
|
||||
new("UITextSizeConstraint", { MaxTextSize = 17, Parent = baitName })
|
||||
local baitCount = text({ Size = UDim2.new(1, -104, 0, 20), Position = UDim2.fromOffset(54, 32), Font = BODY2, TextSize = 14, TextColor3 = C.muted, Text = "", Parent = baitCard })
|
||||
btn({ Size = UDim2.fromOffset(40, 40), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -8, 0.5, 0), BackgroundColor3 = C.wood, Text = "⇄", TextSize = 20, Parent = baitCard }, function()
|
||||
if K.openBait then
|
||||
K.openBait()
|
||||
end
|
||||
end)
|
||||
do
|
||||
local swap = btn({ Size = UDim2.fromOffset(40, 40), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -8, 0.5, 0), BackgroundColor3 = C.wood, Text = "⇄", TextSize = 20, Parent = baitCard }, function()
|
||||
if K.openBait then
|
||||
K.openBait()
|
||||
end
|
||||
end)
|
||||
Theme.pressFx(swap)
|
||||
Theme.tooltip(swap, "Сменить наживку")
|
||||
end
|
||||
|
||||
---------------------------------------------------------------- рюкзак (правый низ)
|
||||
|
||||
@@ -218,9 +259,30 @@ local pack = btn({
|
||||
end)
|
||||
pack:FindFirstChildOfClass("UIStroke").Color = C.goldDark
|
||||
pack:FindFirstChildOfClass("UIStroke").Thickness = 2.5
|
||||
text({ Size = UDim2.fromOffset(52, 52), Position = UDim2.fromOffset(8, 9), TextScaled = true, TextXAlignment = CENTER, Text = "🎒", Parent = pack })
|
||||
text({ Size = UDim2.new(1, -70, 0, 30), Position = UDim2.fromOffset(64, 8), Font = TITLE, TextSize = 22, Text = "Рюкзак", TextStrokeColor3 = C.ink, TextStrokeTransparency = 0.3, Parent = pack })
|
||||
local packCount = text({ Size = UDim2.new(1, -70, 0, 22), Position = UDim2.fromOffset(64, 38), Font = BODY2, TextSize = 15, Text = "", Parent = pack })
|
||||
local packIcon = new("Frame", { Size = UDim2.fromOffset(50, 50), Position = UDim2.fromOffset(8, 10), BackgroundTransparency = 1, Parent = pack })
|
||||
Theme.icon(packIcon, "bag")
|
||||
local packTitle = text({ Size = UDim2.new(1, -70, 0, 28), Position = UDim2.fromOffset(64, 7), Font = TITLE, TextSize = 21, Text = "Рюкзак", TextStrokeColor3 = C.ink, TextStrokeTransparency = 0.3, Parent = pack })
|
||||
local packCount = text({ Size = UDim2.new(1, -70, 0, 22), Position = UDim2.fromOffset(64, 37), Font = BODY2, TextSize = 15, RichText = true, Text = "", Parent = pack })
|
||||
local packBadge = Theme.badge(pack, UDim2.fromOffset(6, 6))
|
||||
-- телефон: круглая кнопка-иконка, под ней плашка-счётчик «3/12»
|
||||
local packPill = new("Frame", { Size = UDim2.fromOffset(0, 22), AutomaticSize = Enum.AutomaticSize.X, AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.new(0.5, 0, 1, -2),
|
||||
BackgroundColor3 = C.woodDark, Visible = false, ZIndex = 6, Parent = pack }, { corner(11), stroke(C.gold, 1.5), new("UIPadding", { PaddingLeft = UDim.new(0, 7), PaddingRight = UDim.new(0, 7) }) })
|
||||
local packPillText = text({ Size = UDim2.fromOffset(0, 22), AutomaticSize = Enum.AutomaticSize.X, Font = TITLE, TextSize = 14, TextXAlignment = CENTER, Text = "", ZIndex = 7, Parent = packPill })
|
||||
Theme.pressFx(pack)
|
||||
Theme.tooltip(pack, function()
|
||||
return ("<b>Рюкзак</b> (B) · улов ≈ %s серебра"):format(fmt(player:GetAttribute("BagValue") or 0))
|
||||
end)
|
||||
-- полный рюкзак: рамка мигает красным
|
||||
task.spawn(function()
|
||||
local st = pack:FindFirstChildOfClass("UIStroke")
|
||||
while pack.Parent do
|
||||
if packBadge.Visible then
|
||||
st.Color = Color3.fromRGB(230, 70, 60)
|
||||
TweenService:Create(st, TweenInfo.new(0.6), { Color = C.goldDark }):Play()
|
||||
end
|
||||
task.wait(1.2)
|
||||
end
|
||||
end)
|
||||
|
||||
---------------------------------------------------------------- таблица игроков (правый верх)
|
||||
|
||||
@@ -239,10 +301,22 @@ local function cols(parent, y, a, b, c, d, color, font)
|
||||
cell(188, 62, c)
|
||||
cell(250, 50, d)
|
||||
end
|
||||
local header = new("Frame", { Size = UDim2.new(1, 0, 0, 30), BackgroundTransparency = 1, Parent = board })
|
||||
cols(header, 3, "👥 Игроки", "Уровень", "Серебро", "Улов", C.muted)
|
||||
local refreshBoard -- объявлена ниже
|
||||
-- заголовок — кнопка: свернуть/развернуть список (на телефоне он сначала свёрнут, чтобы не занимать угол)
|
||||
local header = new("TextButton", { Size = UDim2.new(1, 0, 0, 30), BackgroundTransparency = 1, Text = "", AutoButtonColor = false, Parent = board })
|
||||
cols(header, 3, " Игроки", "Уровень", "Серебро", "Улов", C.goldBright)
|
||||
Theme.icon(new("Frame", { Size = UDim2.fromOffset(20, 20), Position = UDim2.fromOffset(8, 8), BackgroundTransparency = 1, Parent = header }), "guild")
|
||||
local foldMark = text({ Size = UDim2.fromOffset(16, 26), Position = UDim2.fromOffset(104, 3), Font = TITLE, TextSize = 13,
|
||||
TextXAlignment = CENTER, TextColor3 = C.gold, Text = "–", Parent = header })
|
||||
local rowsFrame = new("Frame", { Size = UDim2.new(1, 0, 1, -32), Position = UDim2.fromOffset(0, 30), BackgroundTransparency = 1, Parent = board })
|
||||
local collapsed = false
|
||||
local userFolded = nil -- игрок сам свернул/развернул — больше не трогаем
|
||||
header.MouseButton1Click:Connect(function()
|
||||
collapsed = not collapsed
|
||||
userFolded = collapsed
|
||||
refreshBoard()
|
||||
end)
|
||||
Theme.tooltip(header, "Свернуть или развернуть список (Tab)")
|
||||
|
||||
local function stat(p, name)
|
||||
local ls = p:FindFirstChild("leaderstats")
|
||||
@@ -251,21 +325,34 @@ local function stat(p, name)
|
||||
end
|
||||
|
||||
local function placeBelowBoard()
|
||||
-- плашку погоды (Ambience) и баннер события (FishingClient) ставим под таблицей
|
||||
local y = 8 + board.Size.Y.Offset + 8
|
||||
-- под таблицей сверху вниз: плашка погоды (Ambience), баннер события и колонка «Цели» (FishingClient).
|
||||
-- У каждого свой масштаб раскладки (LayoutScale) — высоту считаем с ним
|
||||
local function sc(obj)
|
||||
local s = obj:FindFirstChild("LayoutScale") or obj:FindFirstChildOfClass("UIScale")
|
||||
return s and s.Scale or 1
|
||||
end
|
||||
local x = Theme.compact and -8 or -12
|
||||
local y = 8 + board.Size.Y.Offset * sc(board) + 8
|
||||
local weather = player.PlayerGui:FindFirstChild("WeatherHud")
|
||||
local pill = weather and weather:FindFirstChild("Root") and weather.Root:FindFirstChildOfClass("Frame")
|
||||
if pill then
|
||||
pill.Position = UDim2.new(1, -12, 0, y)
|
||||
y += pill.Size.Y.Offset + 8
|
||||
pill.Position = UDim2.new(1, x, 0, y)
|
||||
y += pill.Size.Y.Offset * sc(pill) + 8
|
||||
end
|
||||
local ev = K.screen:FindFirstChild("EventBanner")
|
||||
if ev then
|
||||
ev.Position = UDim2.new(1, -12, 0, y)
|
||||
ev.Position = UDim2.new(1, x, 0, y)
|
||||
if ev.Visible then
|
||||
y += ev.Size.Y.Offset * sc(ev) + 8
|
||||
end
|
||||
end
|
||||
local col = K.screen:FindFirstChild("RightCol")
|
||||
if col then
|
||||
col.Position = UDim2.new(1, x, 0, y)
|
||||
end
|
||||
end
|
||||
|
||||
local function refreshBoard()
|
||||
refreshBoard = function()
|
||||
for _, c in ipairs(rowsFrame:GetChildren()) do
|
||||
c:Destroy()
|
||||
end
|
||||
@@ -286,6 +373,7 @@ local function refreshBoard()
|
||||
cols(r, -1, p.DisplayName, fmt(stat(p, "Уровень")), fmt(stat(p, "Серебро")), fmt(stat(p, "Улов")), me and C.goldBright or C.parchment, me and TITLE or BODY2)
|
||||
end
|
||||
board.Size = UDim2.fromOffset(310, 34 + shown * ROW_H + (shown > 0 and 6 or 0))
|
||||
foldMark.Text = collapsed and "+" or "–"
|
||||
placeBelowBoard()
|
||||
end
|
||||
|
||||
@@ -293,6 +381,7 @@ end
|
||||
UserInputService.InputBegan:Connect(function(input, processed)
|
||||
if not processed and input.KeyCode == Enum.KeyCode.Tab then
|
||||
collapsed = not collapsed
|
||||
userFolded = collapsed
|
||||
refreshBoard()
|
||||
end
|
||||
end)
|
||||
@@ -326,13 +415,16 @@ refresh = function()
|
||||
-- наживка
|
||||
local id = player:GetAttribute("Bait")
|
||||
local b = id and id ~= "" and Config.Find(Config.Baits, id)
|
||||
baitIcon.Text = b and b.icon or "🐛"
|
||||
setBaitIcon(b or nil)
|
||||
baitName.Text = b and b.name or "Наживка"
|
||||
baitCount.Text = b and ("×%d"):format(player:GetAttribute("BaitCount") or 0) or "не выбрана"
|
||||
-- рюкзак
|
||||
local count, cap = player:GetAttribute("BagCount") or 0, player:GetAttribute("BagCap") or 10
|
||||
packCount.Text = ("📦 %d / %d"):format(count, cap)
|
||||
packCount.Text = count >= cap and ("<b>%d / %d</b> · полон!"):format(count, cap) or ("%d / %d"):format(count, cap)
|
||||
packCount.TextColor3 = count >= cap and Color3.fromRGB(255, 130, 120) or C.parchment
|
||||
packBadge.Visible = count >= cap
|
||||
packPillText.Text = ("%d/%d"):format(count, cap)
|
||||
packPillText.TextColor3 = count >= cap and Color3.fromRGB(255, 130, 120) or C.goldBright
|
||||
end
|
||||
|
||||
-- клавиши 1–3: удочка из слота (взять в руки; повторно — убрать)
|
||||
@@ -352,20 +444,95 @@ UserInputService.InputBegan:Connect(function(input, processed)
|
||||
end
|
||||
end)
|
||||
|
||||
-- круглый «Рюкзак» на телефоне — слева от кнопки прыжка Roblox, низом вровень с ней.
|
||||
-- Кнопку прыжка ищем в TouchGui; пока её нет — запасное место у правого нижнего угла
|
||||
local jumpConn
|
||||
local function placePack()
|
||||
if not Theme.compact then
|
||||
return
|
||||
end
|
||||
local touch = player.PlayerGui:FindFirstChild("TouchGui")
|
||||
local jump = touch and touch:FindFirstChild("JumpButton", true)
|
||||
local root = K.screen
|
||||
local s = math.max(Theme.scale, 0.3)
|
||||
if jump and jump.AbsoluteSize.X > 0 then
|
||||
if not jumpConn then
|
||||
jumpConn = jump:GetPropertyChangedSignal("AbsolutePosition"):Connect(placePack)
|
||||
end
|
||||
local right = (root.AbsolutePosition.X + root.AbsoluteSize.X) - jump.AbsolutePosition.X + 10
|
||||
local bottom = (root.AbsolutePosition.Y + root.AbsoluteSize.Y) - (jump.AbsolutePosition.Y + jump.AbsoluteSize.Y)
|
||||
pack.Position = UDim2.new(1, -right / s, 1, -math.max(bottom, 8) / s - 8)
|
||||
else
|
||||
pack.Position = UDim2.new(1, -140, 1, -40)
|
||||
end
|
||||
end
|
||||
task.spawn(function()
|
||||
for _ = 1, 20 do
|
||||
task.wait(1)
|
||||
placePack()
|
||||
end
|
||||
end)
|
||||
|
||||
Theme.onLayout(function(compact)
|
||||
local function scale(obj, s)
|
||||
local sc = obj:FindFirstChild("LayoutScale") or new("UIScale", { Name = "LayoutScale", Parent = obj })
|
||||
sc.Scale = s
|
||||
end
|
||||
-- телефон: всё мельче; рюкзак левее кнопки прыжка, таблица игроков — компактнее
|
||||
scale(bar, compact and 0.62 or 1)
|
||||
-- телефон: нижняя панель компактнее и по центру, без ярлычка; «Рюкзак» — круглая кнопка со счётчиком
|
||||
-- слева от кнопки прыжка Roblox (её место: маленький экран — 70 px в 95 px от правого края и 20 px от низа,
|
||||
-- большой — 120 px в 170 px от края и 90 px от низа; в холсте делим на масштаб интерфейса)
|
||||
scale(bar, compact and 0.56 or 1)
|
||||
bar.Position = compact and UDim2.new(0.5, 0, 1, -4) or UDim2.new(0.5, 0, 1, -10)
|
||||
scale(pack, compact and 0.7 or 1)
|
||||
pack.Position = compact and UDim2.new(1, -140, 1, -6) or UDim2.new(1, -12, 1, -12)
|
||||
scale(board, compact and 0.75 or 1)
|
||||
local tag = bar:FindFirstChild("PickTag")
|
||||
if tag then
|
||||
tag.Visible = not compact
|
||||
end
|
||||
scale(pack, 1)
|
||||
packTitle.Visible, packCount.Visible, packPill.Visible = not compact, not compact, compact
|
||||
if compact then
|
||||
Theme.unskin(pack)
|
||||
if Theme.UI.get("medallion") and not pack:FindFirstChild("Medal") then
|
||||
-- круглый резной медальон
|
||||
pack.BackgroundTransparency = 1
|
||||
pack:FindFirstChildOfClass("UIStroke").Enabled = false
|
||||
pack:FindFirstChildOfClass("UIGradient").Enabled = false
|
||||
new("ImageLabel", { Name = "Medal", Size = UDim2.new(1, 12, 1, 12), Position = UDim2.fromOffset(-6, -6), BackgroundTransparency = 1, Image = Theme.UI.get("medallion"), ZIndex = 0, Parent = pack })
|
||||
packPill:FindFirstChildOfClass("UIStroke").Enabled = false
|
||||
Theme.skin(packPill, "chip", { mult = 0.6 })
|
||||
end
|
||||
pack.Size = UDim2.fromOffset(62, 62)
|
||||
pack:FindFirstChildOfClass("UICorner").CornerRadius = UDim.new(1, 0)
|
||||
packIcon.Size = UDim2.fromOffset(40, 40)
|
||||
packIcon.Position = UDim2.fromOffset(11, 8)
|
||||
placePack()
|
||||
else
|
||||
-- обычная плашка: снять медальон телефона (если раскладка успела побыть телефонной) и вернуть табличку
|
||||
local medal = pack:FindFirstChild("Medal")
|
||||
if medal then
|
||||
medal:Destroy()
|
||||
end
|
||||
pack:FindFirstChildOfClass("UICorner").CornerRadius = UDim.new(0, 8)
|
||||
Theme.skinButton(pack)
|
||||
pack.Size = UDim2.fromOffset(170, 70)
|
||||
packIcon.Size = UDim2.fromOffset(50, 50)
|
||||
packIcon.Position = UDim2.fromOffset(8, 10)
|
||||
pack.Position = UDim2.new(1, -12, 1, -12)
|
||||
end
|
||||
scale(board, compact and 0.72 or 1)
|
||||
board.Position = compact and UDim2.new(1, -8, 0, 8) or UDim2.new(1, -12, 0, 8)
|
||||
MAX_ROWS = compact and 4 or 6
|
||||
-- на телефоне список игроков сначала свёрнут (угол нужен погоде и целям); раскрыть — нажать на заголовок
|
||||
if userFolded == nil then
|
||||
collapsed = compact
|
||||
end
|
||||
refreshBoard()
|
||||
end)
|
||||
do
|
||||
local ev = K.screen:FindFirstChild("EventBanner")
|
||||
if ev then
|
||||
ev:GetPropertyChangedSignal("Visible"):Connect(placeBelowBoard)
|
||||
end
|
||||
end
|
||||
|
||||
player.AttributeChanged:Connect(refresh)
|
||||
local function watchChar(char)
|
||||
|
||||
@@ -97,7 +97,9 @@ local function updateNpcs(dt)
|
||||
local rel = n.torso.CFrame:PointToObjectSpace(myHead.Position)
|
||||
local headRel = n.torso.CFrame:PointToObjectSpace(n.head.Position)
|
||||
local d = rel - headRel
|
||||
wantYaw = math.clamp(math.atan2(-d.X, -d.Z), math.rad(-70), math.rad(70))
|
||||
-- у бородатых голова поворачивается меньше (HeadTurnMax ставит NpcLooks): борода не заходит на плечо
|
||||
local maxTurn = math.rad(rig:GetAttribute("HeadTurnMax") or 70)
|
||||
wantYaw = math.clamp(math.atan2(-d.X, -d.Z), -maxTurn, maxTurn)
|
||||
wantPitch = math.clamp(math.atan2(d.Y, math.sqrt(d.X * d.X + d.Z * d.Z)), math.rad(-20), math.rad(30))
|
||||
-- голову к игроку, только если он перед NPC, а не за спиной
|
||||
if math.abs(math.atan2(-d.X, -d.Z)) > math.rad(110) then
|
||||
|
||||
@@ -0,0 +1,209 @@
|
||||
-- Ветер для камыша и рогоза у озера (workspace.LakeReeds). Работает только на клиенте.
|
||||
-- Каждый куст сварен в несколько Union: стебли с початками и пучки листьев.
|
||||
-- Каждая такая деталь плавно качается вокруг основания куста со своим сдвигом по фазе.
|
||||
-- Ветер спокойный: порывы медленно бегут по берегу, направление понемногу гуляет,
|
||||
-- а время от времени наступает затишье: всё плавно замирает и потом так же плавно оживает.
|
||||
-- В дождь и шторм (атрибут workspace.Weather от WeatherServer) ветер сильнее.
|
||||
-- Атрибуты от ServerStorage.ReedBaker: у куста WindBase (точка основания) и WindHeight,
|
||||
-- у детали WindK (насколько гнётся: стебель 1, листья 0.7, кувшинки 0 — не двигаются).
|
||||
|
||||
local RunService = game:GetService("RunService")
|
||||
|
||||
local ROOT_NAME = "LakeReeds"
|
||||
local NEAR = 180 -- кусты дальше этого расстояния от камеры не качаются
|
||||
local NEAR_CHECK = 0.5 -- как часто пересчитывать, какие кусты рядом (сек)
|
||||
|
||||
local LEAN = math.rad(2) -- наклон по ветру
|
||||
local GUST = math.rad(5.5) -- добавка от порыва
|
||||
local SWAY = math.rad(2.4) -- мягкое покачивание туда-обратно
|
||||
local SWAY_SPEED = 0.8 -- частота покачивания (рад/сек)
|
||||
local GUST_SPEED = 6 -- скорость, с которой порыв бежит по берегу (studs/сек)
|
||||
local LULL_SPEED = 0.08 -- как часто меняются ветер и затишье (меньше = реже, затишья длиннее)
|
||||
local LULL_BIAS = 0.62 -- больше = затишья реже и короче (сейчас примерно раз в минуту на 6–8 сек)
|
||||
local WEATHER_WIND = { Rain = 1.4, Storm = 2.2 }
|
||||
|
||||
local camera = workspace.CurrentCamera
|
||||
local clumps = {}
|
||||
local byModel = {}
|
||||
|
||||
local function hash(v)
|
||||
return (v.X * 12.9898 + v.Y * 4.1414 + v.Z * 78.233) % 6.283
|
||||
end
|
||||
|
||||
local function addClump(m)
|
||||
if byModel[m] or not m:IsA("Model") then
|
||||
return
|
||||
end
|
||||
local base = m:GetAttribute("WindBase")
|
||||
local height = m:GetAttribute("WindHeight")
|
||||
if typeof(base) ~= "Vector3" then
|
||||
local cf, size = m:GetBoundingBox()
|
||||
base = cf.Position - Vector3.new(0, size.Y / 2, 0)
|
||||
height = size.Y
|
||||
end
|
||||
height = math.max(height or 1, 1)
|
||||
local pivotInv = CFrame.new(base):Inverse()
|
||||
local parts, rels, ks, phases, rest = {}, {}, {}, {}, {}
|
||||
for _, p in ipairs(m:GetDescendants()) do
|
||||
if p:IsA("BasePart") then
|
||||
local k = p:GetAttribute("WindK")
|
||||
if k == nil then
|
||||
-- старые кусты без запекания: гнём по высоте детали
|
||||
k = math.clamp((p.Position.Y - base.Y) / height, 0, 1) ^ 1.5
|
||||
end
|
||||
if k > 0.05 then
|
||||
table.insert(parts, p)
|
||||
table.insert(rels, pivotInv * p.CFrame)
|
||||
table.insert(ks, k)
|
||||
table.insert(phases, hash(p.Position) * 0.25)
|
||||
table.insert(rest, p.CFrame)
|
||||
end
|
||||
end
|
||||
end
|
||||
if #parts == 0 then
|
||||
return
|
||||
end
|
||||
local c = {
|
||||
base = base,
|
||||
baseCF = CFrame.new(base),
|
||||
parts = parts,
|
||||
rels = rels,
|
||||
ks = ks,
|
||||
phases = phases,
|
||||
rest = rest,
|
||||
seed = hash(base),
|
||||
near = false,
|
||||
moved = false,
|
||||
}
|
||||
byModel[m] = c
|
||||
table.insert(clumps, c)
|
||||
end
|
||||
|
||||
local function removeClump(m)
|
||||
local c = byModel[m]
|
||||
if not c then
|
||||
return
|
||||
end
|
||||
byModel[m] = nil
|
||||
local i = table.find(clumps, c)
|
||||
if i then
|
||||
table.remove(clumps, i)
|
||||
end
|
||||
end
|
||||
|
||||
local function watch(root)
|
||||
local function onFolder(folder)
|
||||
for _, m in ipairs(folder:GetChildren()) do
|
||||
addClump(m)
|
||||
end
|
||||
folder.ChildAdded:Connect(function(m)
|
||||
task.defer(addClump, m) -- дать модели собраться целиком
|
||||
end)
|
||||
folder.ChildRemoved:Connect(removeClump)
|
||||
end
|
||||
for _, f in ipairs(root:GetChildren()) do
|
||||
onFolder(f)
|
||||
end
|
||||
root.ChildAdded:Connect(onFolder)
|
||||
end
|
||||
|
||||
task.spawn(function()
|
||||
local root = workspace:WaitForChild(ROOT_NAME, 60)
|
||||
if root then
|
||||
watch(root)
|
||||
end
|
||||
end)
|
||||
|
||||
local function smoothstep(x)
|
||||
x = math.clamp(x, 0, 1)
|
||||
return x * x * (3 - 2 * x)
|
||||
end
|
||||
|
||||
-- сила ветра плавно подстраивается под погоду
|
||||
local strength = 1
|
||||
local function targetStrength()
|
||||
return WEATHER_WIND[workspace:GetAttribute("Weather")] or 1
|
||||
end
|
||||
|
||||
local lastNearCheck = 0
|
||||
local still = false -- все кусты уже стоят ровно (затишье), можно не двигать
|
||||
-- насколько поле порывов уехало по ветру; копится по кадрам, чтобы смена направления не давала рывков
|
||||
local gustOffX, gustOffZ = 0, 0
|
||||
local moveParts, moveCFs = {}, {}
|
||||
|
||||
local function restAll()
|
||||
for _, c in ipairs(clumps) do
|
||||
if c.moved then
|
||||
workspace:BulkMoveTo(c.parts, c.rest, Enum.BulkMoveMode.FireCFrameChanged)
|
||||
c.moved = false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
RunService.RenderStepped:Connect(function(dt)
|
||||
if #clumps == 0 then
|
||||
return
|
||||
end
|
||||
local now = os.clock()
|
||||
strength += (targetStrength() - strength) * math.min(1, dt * 0.3)
|
||||
|
||||
-- затишье: медленный шум; когда он проседает, ветер плавно стихает до нуля
|
||||
local calm = smoothstep(math.noise(now * LULL_SPEED, 9.1) * 2.6 + LULL_BIAS)
|
||||
if calm < 0.002 then
|
||||
if not still then
|
||||
restAll()
|
||||
still = true
|
||||
end
|
||||
return
|
||||
end
|
||||
still = false
|
||||
|
||||
-- какие кусты рядом с камерой; ушедшие ставим ровно
|
||||
if now - lastNearCheck > NEAR_CHECK then
|
||||
lastNearCheck = now
|
||||
local camPos = camera.CFrame.Position
|
||||
for _, c in ipairs(clumps) do
|
||||
local near = (c.base - camPos).Magnitude < NEAR
|
||||
if not near and c.moved then
|
||||
workspace:BulkMoveTo(c.parts, c.rest, Enum.BulkMoveMode.FireCFrameChanged)
|
||||
c.moved = false
|
||||
end
|
||||
c.near = near
|
||||
end
|
||||
end
|
||||
|
||||
-- направление ветра медленно гуляет
|
||||
local dirAngle = 0.7 + math.noise(now * 0.01, 3.7) * 1.4
|
||||
local dx, dz = math.cos(dirAngle), math.sin(dirAngle)
|
||||
local amp = strength * calm
|
||||
gustOffX += dx * GUST_SPEED * dt
|
||||
gustOffZ += dz * GUST_SPEED * dt
|
||||
|
||||
table.clear(moveParts)
|
||||
table.clear(moveCFs)
|
||||
local n = 0
|
||||
for _, c in ipairs(clumps) do
|
||||
if c.near then
|
||||
local b = c.base
|
||||
-- порыв: мягкое шумовое поле, которое едет по ветру
|
||||
local gx = (b.X - gustOffX) * 0.025
|
||||
local gz = (b.Z - gustOffZ) * 0.025
|
||||
local gust = smoothstep(math.noise(gx, gz, 0.37) * 1.2 + 0.5)
|
||||
local lean = amp * (LEAN + GUST * gust)
|
||||
local sway = amp * SWAY * (0.5 + 0.5 * gust)
|
||||
local t = now * SWAY_SPEED + c.seed
|
||||
local parts, rels, ks, phases = c.parts, c.rels, c.ks, c.phases
|
||||
local baseCF = c.baseCF
|
||||
for i = 1, #parts do
|
||||
local a = ks[i] * (lean + sway * math.sin(t + phases[i]))
|
||||
n += 1
|
||||
moveParts[n] = parts[i]
|
||||
moveCFs[n] = baseCF * CFrame.Angles(dz * a, 0, -dx * a) * rels[i]
|
||||
end
|
||||
c.moved = true
|
||||
end
|
||||
end
|
||||
if n > 0 then
|
||||
workspace:BulkMoveTo(moveParts, moveCFs, Enum.BulkMoveMode.FireCFrameChanged)
|
||||
end
|
||||
end)
|
||||
@@ -5,6 +5,8 @@
|
||||
local UserInputService = game:GetService("UserInputService")
|
||||
|
||||
local Theme = {}
|
||||
-- номера текстур интерфейса (нужны и панелям/фишкам выше по файлу)
|
||||
local UiImages = require(game:GetService("ReplicatedStorage"):WaitForChild("UiImages"))
|
||||
|
||||
---------------------------------------------------------------- палитра
|
||||
-- старые ключи (bg, panel, blue…) оставлены, чтобы весь интерфейс перекрасился сразу
|
||||
@@ -114,6 +116,498 @@ function Theme.woodGradient(top, bottom)
|
||||
return make("UIGradient", { Color = ColorSequence.new(top or C.wood, bottom or C.woodDark), Rotation = 90 })
|
||||
end
|
||||
|
||||
---------------------------------------------------------------- иконки и общие детали HUD
|
||||
-- Иконки — рисованные PNG (ReplicatedStorage.Icons); пока их номера не вписаны, вместо картинки эмодзи.
|
||||
|
||||
local TweenService = game:GetService("TweenService")
|
||||
local Icons = require(game:GetService("ReplicatedStorage"):WaitForChild("Icons"))
|
||||
Theme.Icons = Icons
|
||||
|
||||
-- иконка в контейнере (ImageLabel или эмодзи). size/position — UDim2, по умолчанию на весь контейнер
|
||||
function Theme.icon(parent, name, size, position)
|
||||
local el = Icons.put(parent, name, size, position)
|
||||
el.ZIndex = parent:IsA("GuiObject") and parent.ZIndex + 1 or 1
|
||||
return el
|
||||
end
|
||||
|
||||
-- поменять иконку в контейнере (старая удаляется); fallback — свой эмодзи вместо стандартного
|
||||
function Theme.setIcon(parent, name, fallback)
|
||||
local old = parent:FindFirstChild("Icon")
|
||||
if old then
|
||||
old:Destroy()
|
||||
end
|
||||
local el = Theme.icon(parent, name)
|
||||
if fallback and el:IsA("TextLabel") then
|
||||
el.Text = fallback
|
||||
end
|
||||
return el
|
||||
end
|
||||
|
||||
-- деревянная панель HUD: тёмное золото снаружи, светлая линия внутри, заклёпки
|
||||
function Theme.panel(props, rivetSize)
|
||||
local f = make("Frame", props)
|
||||
f.BackgroundColor3 = Color3.new(1, 1, 1)
|
||||
make("UICorner", { CornerRadius = UDim.new(0, 10), Parent = f })
|
||||
make("UIStroke", { Color = C.goldDark, Thickness = 2.5, ApplyStrokeMode = Enum.ApplyStrokeMode.Border, Parent = f })
|
||||
Theme.woodGradient(C.wood, C.woodDark).Parent = f
|
||||
Theme.innerBorder(f, 4, 7, C.gold, 0.5)
|
||||
if rivetSize ~= false then
|
||||
Theme.rivets(f, rivetSize or 7, 6)
|
||||
end
|
||||
-- резная рамка с узлами (если загружена) — вместо плоской заливки
|
||||
task.defer(function()
|
||||
Theme.skin(f, "frame_small")
|
||||
end)
|
||||
return f
|
||||
end
|
||||
|
||||
-- «фишка»: тёмная плашка с иконкой и числом (валюта, удача, сумка). Возвращает плашку и подпись
|
||||
function Theme.chip(parent, iconName, order, color)
|
||||
local chip = make("Frame", {
|
||||
Name = "Chip_" .. iconName, Size = UDim2.fromOffset(0, 26), AutomaticSize = Enum.AutomaticSize.X,
|
||||
BackgroundColor3 = C.dark, BackgroundTransparency = 0.25, LayoutOrder = order or 0, Parent = parent,
|
||||
})
|
||||
make("UICorner", { CornerRadius = UDim.new(1, 0), Parent = chip })
|
||||
make("UIStroke", { Color = C.goldDark, Thickness = 1.2, Transparency = 0.2, ApplyStrokeMode = Enum.ApplyStrokeMode.Border, Parent = chip })
|
||||
make("UIPadding", { PaddingLeft = UDim.new(0, 3), PaddingRight = UDim.new(0, 9), Parent = chip })
|
||||
make("UIListLayout", { FillDirection = Enum.FillDirection.Horizontal, VerticalAlignment = Enum.VerticalAlignment.Center, Padding = UDim.new(0, 4), SortOrder = Enum.SortOrder.LayoutOrder, Parent = chip })
|
||||
local holder = make("Frame", { Size = UDim2.fromOffset(22, 22), BackgroundTransparency = 1, LayoutOrder = 1, Parent = chip })
|
||||
Theme.icon(holder, iconName)
|
||||
local label = make("TextLabel", {
|
||||
Size = UDim2.fromOffset(0, 22), AutomaticSize = Enum.AutomaticSize.X, BackgroundTransparency = 1, LayoutOrder = 2,
|
||||
FontFace = Theme.BODY_FACE, TextSize = 15, RichText = true, TextColor3 = color or C.parchment, Text = "",
|
||||
TextStrokeColor3 = C.ink, TextStrokeTransparency = 0.5, Parent = chip,
|
||||
})
|
||||
-- деревянная табличка с золотым ободком
|
||||
if UiImages and UiImages.get("chip") then
|
||||
chip:FindFirstChildOfClass("UIPadding").PaddingLeft = UDim.new(0, 6)
|
||||
chip:FindFirstChildOfClass("UIPadding").PaddingRight = UDim.new(0, 12)
|
||||
Theme.skin(chip, "chip")
|
||||
end
|
||||
return chip, label
|
||||
end
|
||||
|
||||
-- красный значок уведомления в углу кнопки: badge.Visible, badge.Label.Text ("!" или число)
|
||||
function Theme.badge(parent, position)
|
||||
local b = make("Frame", {
|
||||
Name = "Badge", Size = UDim2.fromOffset(18, 18), AnchorPoint = Vector2.new(0.5, 0.5), Position = position or UDim2.fromOffset(4, 4),
|
||||
BackgroundColor3 = Color3.fromRGB(200, 44, 36), Visible = false, ZIndex = 8, Parent = parent,
|
||||
})
|
||||
make("UICorner", { CornerRadius = UDim.new(1, 0), Parent = b })
|
||||
make("UIStroke", { Color = C.goldBright, Thickness = 1.5, Parent = b })
|
||||
-- сургучная печать: золотой кружок, перекрашенный в красный
|
||||
if UiImages and UiImages.get("gold_dot") then
|
||||
b.Size = UDim2.fromOffset(22, 22)
|
||||
Theme.skin(b, "gold_dot", { tint = Color3.fromRGB(255, 70, 60) })
|
||||
end
|
||||
make("TextLabel", {
|
||||
Name = "Label", Size = UDim2.fromScale(1, 1), BackgroundTransparency = 1, FontFace = Theme.TITLE_FACE, TextSize = 12,
|
||||
TextColor3 = Color3.new(1, 1, 1), Text = "!", ZIndex = 9, Parent = b,
|
||||
})
|
||||
-- при появлении — короткий «прыжок»
|
||||
local sc = make("UIScale", { Parent = b })
|
||||
b:GetPropertyChangedSignal("Visible"):Connect(function()
|
||||
if b.Visible then
|
||||
sc.Scale = 0.3
|
||||
TweenService:Create(sc, TweenInfo.new(0.35, Enum.EasingStyle.Back, Enum.EasingDirection.Out), { Scale = 1 }):Play()
|
||||
end
|
||||
end)
|
||||
return b
|
||||
end
|
||||
|
||||
-- кнопка «проседает» при нажатии и чуть светлеет рамкой при наведении
|
||||
function Theme.pressFx(button)
|
||||
local sc = button:FindFirstChild("PressScale") or make("UIScale", { Name = "PressScale", Parent = button })
|
||||
local st = button:FindFirstChildOfClass("UIStroke")
|
||||
local base = st and st.Color
|
||||
local function to(s)
|
||||
TweenService:Create(sc, TweenInfo.new(0.08, Enum.EasingStyle.Quad), { Scale = s }):Play()
|
||||
end
|
||||
button.MouseButton1Down:Connect(function()
|
||||
to(0.9)
|
||||
end)
|
||||
button.MouseButton1Up:Connect(function()
|
||||
to(1)
|
||||
end)
|
||||
button.MouseEnter:Connect(function()
|
||||
if st then
|
||||
st.Color = C.goldBright
|
||||
end
|
||||
end)
|
||||
button.MouseLeave:Connect(function()
|
||||
to(1)
|
||||
if st then
|
||||
st.Color = base
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- всплывающая подсказка у курсора (только на компьютере)
|
||||
local tipGui, tipFrame, tipLabel
|
||||
function Theme.tooltip(gui, textOrFn)
|
||||
if UserInputService.TouchEnabled then
|
||||
return
|
||||
end
|
||||
if not tipGui then
|
||||
local pg = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui")
|
||||
tipGui = make("ScreenGui", { Name = "Tooltip", ResetOnSpawn = false, DisplayOrder = 50, IgnoreGuiInset = true, Parent = pg })
|
||||
tipFrame = make("Frame", {
|
||||
Size = UDim2.fromOffset(0, 28), AutomaticSize = Enum.AutomaticSize.X, BackgroundColor3 = C.woodDark,
|
||||
BackgroundTransparency = 0.05, Visible = false, Parent = tipGui,
|
||||
})
|
||||
make("UICorner", { CornerRadius = UDim.new(0, 6), Parent = tipFrame })
|
||||
make("UIStroke", { Color = C.gold, Thickness = 1.5, Parent = tipFrame })
|
||||
make("UIPadding", { PaddingLeft = UDim.new(0, 10), PaddingRight = UDim.new(0, 10), Parent = tipFrame })
|
||||
tipLabel = make("TextLabel", {
|
||||
Size = UDim2.fromScale(0, 1), AutomaticSize = Enum.AutomaticSize.X, BackgroundTransparency = 1, RichText = true,
|
||||
FontFace = Theme.BODY_FACE, TextSize = 15, TextColor3 = C.parchment, Text = "", Parent = tipFrame,
|
||||
})
|
||||
end
|
||||
local inside = false
|
||||
local function place()
|
||||
local m = UserInputService:GetMouseLocation()
|
||||
tipFrame.Position = UDim2.fromOffset(m.X + 16, m.Y + 10)
|
||||
end
|
||||
gui.MouseEnter:Connect(function()
|
||||
inside = true
|
||||
local t = type(textOrFn) == "function" and textOrFn() or textOrFn
|
||||
if not t or t == "" then
|
||||
return
|
||||
end
|
||||
tipLabel.Text = t
|
||||
place()
|
||||
task.delay(0.35, function()
|
||||
if inside then
|
||||
place()
|
||||
tipFrame.Visible = true
|
||||
end
|
||||
end)
|
||||
end)
|
||||
gui.MouseMoved:Connect(function()
|
||||
if tipFrame.Visible then
|
||||
place()
|
||||
end
|
||||
end)
|
||||
gui.MouseLeave:Connect(function()
|
||||
inside = false
|
||||
tipFrame.Visible = false
|
||||
end)
|
||||
gui:GetPropertyChangedSignal("Visible"):Connect(function()
|
||||
if not gui.Visible then
|
||||
inside = false
|
||||
tipFrame.Visible = false
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------- текстуры окон (9-slice)
|
||||
-- Если у текстуры есть номер (ReplicatedStorage.UiImages) — под элемент кладётся картинка, а его
|
||||
-- заливка и рамка прячутся. Нет номера — элемент остаётся как есть (запасной вид из рамок и градиентов).
|
||||
|
||||
Theme.UI = UiImages
|
||||
|
||||
local function sliceProps(img, name)
|
||||
local s = UiImages.SLICES[UiImages.resolve(name)]
|
||||
if not s then
|
||||
return
|
||||
end
|
||||
if s.tile then
|
||||
img.ScaleType = Enum.ScaleType.Tile
|
||||
img.TileSize = UDim2.fromOffset(s[1], s[2])
|
||||
elseif s[3] > 0 then
|
||||
local sy = s[4] or s[3]
|
||||
img.ScaleType = Enum.ScaleType.Slice
|
||||
img.SliceCenter = Rect.new(s[3], sy, s[1] - s[3], s[2] - sy)
|
||||
else
|
||||
img.ScaleType = Enum.ScaleType.Fit
|
||||
end
|
||||
return s
|
||||
end
|
||||
|
||||
-- картинка-подложка под obj. opts: tint (Color3), scale (SliceScale), keepStroke, inset (px за края)
|
||||
function Theme.skin(obj, name, opts)
|
||||
local id = UiImages.get(name)
|
||||
if not id then
|
||||
return nil
|
||||
end
|
||||
opts = opts or {}
|
||||
local old = obj:FindFirstChild("Skin")
|
||||
if old then
|
||||
old:Destroy()
|
||||
end
|
||||
-- у элемента своя раскладка (UIListLayout/Grid) — картинка в неё попала бы как ещё один пункт.
|
||||
-- Поэтому раскладка, отступы и всё содержимое переезжают во внутреннюю рамку Content
|
||||
local layout = obj:FindFirstChildWhichIsA("UIGridStyleLayout")
|
||||
if layout and not obj:FindFirstChild("Content") then
|
||||
local content = make("Frame", { Name = "Content", BackgroundTransparency = 1, Size = UDim2.fromScale(1, 1), ZIndex = obj.ZIndex })
|
||||
if obj:IsA("GuiObject") and obj.AutomaticSize ~= Enum.AutomaticSize.None then
|
||||
content.AutomaticSize = obj.AutomaticSize
|
||||
content.Size = UDim2.new(obj.AutomaticSize == Enum.AutomaticSize.Y and 1 or 0, 0, obj.AutomaticSize == Enum.AutomaticSize.X and 1 or 0, 0)
|
||||
end
|
||||
for _, c in ipairs(obj:GetChildren()) do
|
||||
if c:IsA("GuiObject") or c:IsA("UIGridStyleLayout") or c:IsA("UIPadding") then
|
||||
c.Parent = content
|
||||
end
|
||||
end
|
||||
content.Parent = obj
|
||||
end
|
||||
-- знамя: три куска картинки (края 210×200 сохраняют пропорции по высоте элемента, середина тянется)
|
||||
if UiImages.resolve(name) == "banner" then
|
||||
local h = math.max(obj.Size.Y.Offset, 20)
|
||||
local capW = math.floor(h * 210 / 200 + 0.5)
|
||||
local holder = make("Frame", { Name = "Skin", BackgroundTransparency = 1, Size = UDim2.fromScale(1, 1), ZIndex = 0, Parent = obj })
|
||||
for i, part in ipairs({ { 0, 210, UDim2.fromOffset(0, 0), UDim2.new(0, capW, 1, 0) }, { 210, 220, UDim2.fromOffset(capW, 0), UDim2.new(1, -capW * 2, 1, 0) },
|
||||
{ 430, 210, UDim2.new(1, -capW, 0, 0), UDim2.new(0, capW, 1, 0) } }) do
|
||||
make("ImageLabel", { Name = "Part" .. i, BackgroundTransparency = 1, Image = id, ImageRectOffset = Vector2.new(part[1], 0), ImageRectSize = Vector2.new(part[2], 200),
|
||||
ScaleType = Enum.ScaleType.Stretch, Position = part[3], Size = part[4], ZIndex = 0, Parent = holder })
|
||||
end
|
||||
obj.BackgroundTransparency = 1
|
||||
for _, c in ipairs(obj:GetChildren()) do
|
||||
if c:IsA("UIStroke") or c:IsA("UIGradient") then
|
||||
c.Enabled = false
|
||||
end
|
||||
end
|
||||
-- лента растёт по тексту: сама она больше не растёт (картинка внутри раздувала бы её),
|
||||
-- ширину берём у содержимого (Content растёт по тексту и от ширины ленты не зависит)
|
||||
local content = obj:FindFirstChild("Content")
|
||||
if content and obj.AutomaticSize == Enum.AutomaticSize.X then
|
||||
obj.AutomaticSize = Enum.AutomaticSize.None
|
||||
local function sync()
|
||||
local k = obj.AbsoluteSize.Y / math.max(obj.Size.Y.Offset, 1) -- масштаб интерфейса над лентой
|
||||
if k > 0 and content.AbsoluteSize.X > 0 then
|
||||
obj.Size = UDim2.new(0, math.ceil(content.AbsoluteSize.X / k), obj.Size.Y.Scale, obj.Size.Y.Offset)
|
||||
end
|
||||
end
|
||||
content:GetPropertyChangedSignal("AbsoluteSize"):Connect(sync)
|
||||
obj:GetPropertyChangedSignal("AbsoluteSize"):Connect(sync)
|
||||
task.defer(sync)
|
||||
end
|
||||
return holder
|
||||
end
|
||||
-- у растущих по содержимому элементов картинка ровно по размеру (иначе выход за края раздувал бы их)
|
||||
local inset = (obj:IsA("GuiObject") and obj.AutomaticSize ~= Enum.AutomaticSize.None) and 0 or (opts.inset or 0)
|
||||
local img = make("ImageLabel", {
|
||||
Name = "Skin", BackgroundTransparency = 1, Image = id, ImageColor3 = opts.tint or Color3.new(1, 1, 1),
|
||||
Size = UDim2.new(1, inset * 2, 1, inset * 2), Position = UDim2.fromOffset(-inset, -inset), ZIndex = 0, Parent = obj,
|
||||
})
|
||||
-- толщина краёв: своя у каждой картинки (SLICES.scale), opts.mult — во сколько раз тоньше/толще
|
||||
local s = sliceProps(img, name)
|
||||
img.SliceScale = ((s and s.scale) or opts.scale or 1) * (opts.mult or 1)
|
||||
obj.BackgroundTransparency = 1
|
||||
for _, c in ipairs(obj:GetChildren()) do
|
||||
if (c:IsA("UIStroke") and not opts.keepStroke) or c:IsA("UIGradient") then
|
||||
c.Enabled = false
|
||||
elseif c.Name == "InnerBorder" or c.Name == "Rivet" then
|
||||
c.Visible = false
|
||||
end
|
||||
end
|
||||
return img
|
||||
end
|
||||
|
||||
-- кнопка с текстурой: картинка по цвету кнопки (зелёная/багровая/золотая/дерево), при нажатии — «нажатая».
|
||||
-- Текст TextButton рисуется под детьми, поэтому он переносится в дочернюю подпись (и следует за изменениями).
|
||||
local BTN_KINDS = {
|
||||
{ "btn_green", C.forest }, { "btn_red", C.crimson }, { "btn_gold", C.gold }, { "btn_wood", C.woodLight },
|
||||
}
|
||||
local function nearestKind(color)
|
||||
if color == C.grey or (math.abs(color.R - color.G) < 0.06 and math.abs(color.G - color.B) < 0.08 and color.R < 0.45) then
|
||||
return "btn_wood", Color3.fromRGB(150, 150, 150) -- неактивная — серое дерево
|
||||
end
|
||||
local best, bestD = "btn_wood", math.huge
|
||||
for _, k in ipairs(BTN_KINDS) do
|
||||
local c = k[2]
|
||||
local d = (c.R - color.R) ^ 2 + (c.G - color.G) ^ 2 + (c.B - color.B) ^ 2
|
||||
if d < bestD then
|
||||
best, bestD = k[1], d
|
||||
end
|
||||
end
|
||||
return best, Color3.new(1, 1, 1)
|
||||
end
|
||||
local skinConns = setmetatable({}, { __mode = "k" })
|
||||
-- вернуть кнопке обычный вид (для круглых кнопок: картинка квадратная)
|
||||
function Theme.unskin(b)
|
||||
for _, c in ipairs(skinConns[b] or {}) do
|
||||
c:Disconnect()
|
||||
end
|
||||
skinConns[b] = nil
|
||||
local label = b:FindFirstChild("SkinText")
|
||||
if label then
|
||||
b.TextStrokeTransparency = label.TextStrokeTransparency
|
||||
label:Destroy()
|
||||
end
|
||||
local img = b:FindFirstChild("Skin")
|
||||
if img then
|
||||
img:Destroy()
|
||||
end
|
||||
b.TextTransparency = 0
|
||||
b.BackgroundTransparency = 0
|
||||
for _, c in ipairs(b:GetChildren()) do
|
||||
if c:IsA("UIStroke") or c:IsA("UIGradient") then
|
||||
c.Enabled = true
|
||||
end
|
||||
end
|
||||
end
|
||||
local MIRROR = { "Text", "TextColor3", "TextSize", "TextScaled", "FontFace", "RichText", "TextWrapped", "TextStrokeColor3", "TextStrokeTransparency", "TextXAlignment", "TextYAlignment" }
|
||||
function Theme.skinButton(b)
|
||||
if not UiImages.get("btn_wood") or b:FindFirstChild("Skin") then
|
||||
return
|
||||
end
|
||||
local list = {}
|
||||
skinConns[b] = list
|
||||
local function on(sig, fn)
|
||||
table.insert(list, sig:Connect(fn))
|
||||
end
|
||||
local kind, tint = nearestKind(b.BackgroundColor3)
|
||||
local img = Theme.skin(b, kind, { tint = tint, scale = 0.8 })
|
||||
if not img then
|
||||
return
|
||||
end
|
||||
local label = make("TextLabel", { Name = "SkinText", BackgroundTransparency = 1, Size = UDim2.fromScale(1, 1), ZIndex = 2, Parent = b })
|
||||
for _, p in ipairs(MIRROR) do
|
||||
label[p] = b[p]
|
||||
on(b:GetPropertyChangedSignal(p), function()
|
||||
label[p] = b[p]
|
||||
end)
|
||||
end
|
||||
local cons = b:FindFirstChildOfClass("UITextSizeConstraint")
|
||||
if cons then
|
||||
cons:Clone().Parent = label
|
||||
end
|
||||
b.TextTransparency = 1
|
||||
b.TextStrokeTransparency = 1
|
||||
on(b:GetPropertyChangedSignal("TextStrokeTransparency"), function()
|
||||
if b.TextStrokeTransparency < 1 then
|
||||
label.TextStrokeTransparency = b.TextStrokeTransparency
|
||||
b.TextStrokeTransparency = 1
|
||||
end
|
||||
end)
|
||||
on(b:GetPropertyChangedSignal("BackgroundColor3"), function()
|
||||
kind, tint = nearestKind(b.BackgroundColor3)
|
||||
img.Image = UiImages.get(kind)
|
||||
img.ImageColor3 = tint
|
||||
end)
|
||||
on(b:GetPropertyChangedSignal("BackgroundTransparency"), function()
|
||||
if b.BackgroundTransparency < 1 then
|
||||
b.BackgroundTransparency = 1
|
||||
end
|
||||
end)
|
||||
on(b.MouseButton1Down, function()
|
||||
img.Image = UiImages.get(kind .. "_down") or img.Image
|
||||
end)
|
||||
local function up()
|
||||
img.Image = UiImages.get(kind)
|
||||
end
|
||||
on(b.MouseButton1Up, up)
|
||||
on(b.MouseLeave, up)
|
||||
end
|
||||
|
||||
-- декоративный разделитель с завитком по центру (картинка или запасной: золотая линия с ромбом)
|
||||
function Theme.divider(parent, order, height)
|
||||
local holder = make("Frame", { Name = "Divider", Size = UDim2.new(1, 0, 0, height or 18), BackgroundTransparency = 1, LayoutOrder = order or 0, Parent = parent })
|
||||
local id = UiImages.get("divider")
|
||||
if id then
|
||||
local img = make("ImageLabel", { BackgroundTransparency = 1, Image = id, Size = UDim2.fromScale(1, 1), ScaleType = Enum.ScaleType.Fit, Parent = holder })
|
||||
return holder, img
|
||||
end
|
||||
for _, side in ipairs({ -1, 1 }) do
|
||||
local line = make("Frame", {
|
||||
Size = UDim2.new(0.5, -16, 0, 2), AnchorPoint = Vector2.new(side < 0 and 1 or 0, 0.5), Position = UDim2.new(0.5, side * 14, 0.5, 0),
|
||||
BackgroundColor3 = C.gold, BorderSizePixel = 0, Parent = holder,
|
||||
})
|
||||
make("UIGradient", {
|
||||
Transparency = side < 0 and NumberSequence.new(1, 0) or NumberSequence.new(0, 1), Parent = line,
|
||||
})
|
||||
end
|
||||
local gem = make("Frame", { Size = UDim2.fromOffset(10, 10), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0.5, 0.5), Rotation = 45,
|
||||
BackgroundColor3 = C.goldBright, Parent = holder })
|
||||
make("UIStroke", { Color = C.ink, Thickness = 1.5, Parent = gem })
|
||||
return holder
|
||||
end
|
||||
|
||||
-- заголовок раздела: короткая багровая лента с иконкой и подписью (слева)
|
||||
function Theme.section(parent, order, title, iconName, rightText)
|
||||
local row = make("Frame", { Name = "Section", Size = UDim2.new(1, 0, 0, 36), BackgroundTransparency = 1, LayoutOrder = order or 0, Parent = parent })
|
||||
local rib = make("Frame", {
|
||||
Size = UDim2.new(0, 0, 0, 32), AutomaticSize = Enum.AutomaticSize.X, Position = UDim2.fromOffset(0, 2),
|
||||
BackgroundColor3 = Color3.new(1, 1, 1), Parent = row,
|
||||
})
|
||||
make("UICorner", { CornerRadius = UDim.new(0, 4), Parent = rib })
|
||||
make("UIGradient", { Color = ColorSequence.new(Color3.fromRGB(184, 58, 48), Color3.fromRGB(118, 28, 26)), Rotation = 90, Parent = rib })
|
||||
make("UIStroke", { Color = C.gold, Thickness = 1.5, ApplyStrokeMode = Enum.ApplyStrokeMode.Border, Parent = rib })
|
||||
make("UIPadding", { PaddingLeft = UDim.new(0, 8), PaddingRight = UDim.new(0, 14), Parent = rib })
|
||||
make("UIListLayout", { FillDirection = Enum.FillDirection.Horizontal, VerticalAlignment = Enum.VerticalAlignment.Center, Padding = UDim.new(0, 6), SortOrder = Enum.SortOrder.LayoutOrder, Parent = rib })
|
||||
if iconName then
|
||||
Theme.icon(make("Frame", { Size = UDim2.fromOffset(24, 24), BackgroundTransparency = 1, LayoutOrder = 1, Parent = rib }), iconName)
|
||||
end
|
||||
local label = make("TextLabel", {
|
||||
Size = UDim2.fromOffset(0, 28), AutomaticSize = Enum.AutomaticSize.X, BackgroundTransparency = 1, LayoutOrder = 2, RichText = true,
|
||||
FontFace = Theme.TITLE_FACE, TextSize = 17, TextColor3 = C.goldBright, TextStrokeColor3 = C.ink, TextStrokeTransparency = 0.3, Text = title, Parent = rib,
|
||||
})
|
||||
if Theme.skin(rib, "ribbon") then
|
||||
-- текст — на полотнище знамени (оно в верхних 2/3 картинки), края шире под кисти
|
||||
local pad = rib:FindFirstChild("Content") and rib.Content:FindFirstChildOfClass("UIPadding")
|
||||
if pad then
|
||||
pad.PaddingLeft, pad.PaddingRight, pad.PaddingBottom = UDim.new(0, 30), UDim.new(0, 34), UDim.new(0, 7)
|
||||
end
|
||||
end
|
||||
local right
|
||||
if rightText then
|
||||
right = make("TextLabel", {
|
||||
Size = UDim2.new(0.5, 0, 1, 0), AnchorPoint = Vector2.new(1, 0), Position = UDim2.fromScale(1, 0), BackgroundTransparency = 1, RichText = true,
|
||||
FontFace = Theme.BODY_FACE, TextSize = 15, TextColor3 = C.muted, TextXAlignment = Enum.TextXAlignment.Right, Text = rightText, Parent = row,
|
||||
})
|
||||
end
|
||||
return row, label, right
|
||||
end
|
||||
|
||||
-- полоса прогресса в рамке; возвращает рамку и функцию set(доля, цвет)
|
||||
function Theme.bar(parent, props, color)
|
||||
local back = make("Frame", props)
|
||||
back.BackgroundColor3 = C.dark
|
||||
make("UICorner", { CornerRadius = UDim.new(1, 0), Parent = back })
|
||||
make("UIStroke", { Color = C.goldDark, Thickness = 1.5, ApplyStrokeMode = Enum.ApplyStrokeMode.Border, Parent = back })
|
||||
back.Parent = parent
|
||||
local fill = make("Frame", { Name = "Fill", Size = UDim2.fromScale(0, 1), BackgroundColor3 = color or C.gold, BorderSizePixel = 0, Parent = back })
|
||||
make("UICorner", { CornerRadius = UDim.new(1, 0), Parent = fill })
|
||||
make("UIGradient", { Color = ColorSequence.new(Color3.new(1, 1, 1), Color3.fromRGB(170, 170, 170)), Rotation = 90, Parent = fill })
|
||||
if UiImages.get("bar_frame") then
|
||||
Theme.skin(back, "bar_frame", { scale = 0.6 })
|
||||
local f = Theme.skin(fill, "bar_fill", { tint = color or C.gold, scale = 0.6 })
|
||||
if f then
|
||||
f.ZIndex = fill.ZIndex
|
||||
end
|
||||
end
|
||||
local function set(frac, c)
|
||||
fill.Size = UDim2.fromScale(math.clamp(frac, 0, 1), 1)
|
||||
fill.Visible = frac > 0.001
|
||||
if c then
|
||||
fill.BackgroundColor3 = c
|
||||
local s = fill:FindFirstChild("Skin")
|
||||
if s then
|
||||
s.ImageColor3 = c
|
||||
end
|
||||
end
|
||||
end
|
||||
return back, set
|
||||
end
|
||||
|
||||
-- «🎒 Сумка» → "bag", "Сумка": ведущий эмодзи заголовков и вкладок превращается в рисованную иконку
|
||||
local EMOJI_ICON = {
|
||||
["🎒"] = "bag", ["🐟"] = "fish", ["📖"] = "book", ["🌍"] = "map", ["📜"] = "scroll", ["💎"] = "crystal", ["⚙"] = "gear",
|
||||
["⚔"] = "guild", ["🎣"] = "rod", ["✨"] = "xp", ["🍀"] = "clover", ["🎁"] = "gift", ["👑"] = "level", ["⚪"] = "coin",
|
||||
["🐛"] = "worm", ["🧺"] = "trap", ["🔊"] = "horn", ["🦪"] = "pearl", ["🏆"] = "chest", ["🔒"] = "lock",
|
||||
}
|
||||
Theme.EMOJI_ICON = EMOJI_ICON
|
||||
function Theme.splitIcon(str)
|
||||
for emoji, name in pairs(EMOJI_ICON) do
|
||||
if str:sub(1, #emoji) == emoji then
|
||||
local rest = str:sub(#emoji + 1):gsub("^[\239\184\143]*", ""):gsub("^%s+", "")
|
||||
return name, rest
|
||||
end
|
||||
end
|
||||
return nil, str
|
||||
end
|
||||
|
||||
---------------------------------------------------------------- масштаб под экран
|
||||
-- Весь интерфейс лежит в «холсте» Root: он во столько же раз больше экрана, во сколько уменьшен
|
||||
-- UIScale. Поэтому вёрстка в пикселях одинакова на любом экране, а на телефоне всё меньше и плотнее.
|
||||
|
||||
Reference in new issue
Block a user