Экономика v3: таймер подарка в HUD, аренда в окне дома, отладочные команды
This commit is contained in:
1 parent
9623681f57
commit
f9c2ff77bd
3 files changed
+51
-1
No files matched your search
@@ -2254,6 +2254,27 @@ if RunService:IsStudio() then
|
|||||||
end
|
end
|
||||||
elseif op == "action" then
|
elseif op == "action" then
|
||||||
onRemote(player, a, b, c)
|
onRemote(player, a, b, c)
|
||||||
|
elseif op == "xp" then
|
||||||
|
-- опыт как за поимку (проверка наград за уровень)
|
||||||
|
local data = profiles[player]
|
||||||
|
if data then
|
||||||
|
addXp(player, data, a, "Debug")
|
||||||
|
end
|
||||||
|
return data and data.level
|
||||||
|
elseif op == "giftIn" then
|
||||||
|
-- следующий подарок за время — через a секунд
|
||||||
|
local g = Config.PlaytimeGifts[(giftIndex[player] or 0) + 1]
|
||||||
|
if g then
|
||||||
|
sessionStart[player] = os.time() - g.minutes * 60 + (a or 0)
|
||||||
|
setGiftAttr(player)
|
||||||
|
end
|
||||||
|
return player:GetAttribute("GiftNextAt")
|
||||||
|
elseif op == "houses" then
|
||||||
|
-- вызвать Houses[a](player, b, c) (spin, upgrade, collectRent с профилем)
|
||||||
|
if a == "collectRent" then
|
||||||
|
return Houses.collectRent(player, profiles[player])
|
||||||
|
end
|
||||||
|
return Houses[a](player, b, c)
|
||||||
elseif op == "grant" then
|
elseif op == "grant" then
|
||||||
-- выдать рыбу как пойманную (для проверок рынка)
|
-- выдать рыбу как пойманную (для проверок рынка)
|
||||||
local data = profiles[player]
|
local data = profiles[player]
|
||||||
|
|||||||
@@ -3137,6 +3137,24 @@ do
|
|||||||
new("Frame", { Size = UDim2.new(1, 0, 0, 1), Position = UDim2.new(0, 0, 1, 1), BackgroundColor3 = C.goldDark, BorderSizePixel = 0, Parent = title })
|
new("Frame", { Size = UDim2.new(1, 0, 0, 1), Position = UDim2.new(0, 0, 1, 1), BackgroundColor3 = C.goldDark, BorderSizePixel = 0, Parent = title })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- подарок за время в игре: плашка под свитком «Цели» (атрибут GiftNextAt — время в секундах, 0 — подарки кончились)
|
||||||
|
do
|
||||||
|
H.giftChip, H.giftText = Theme.chip(rightCol, "gift", 3, C.goldBright)
|
||||||
|
H.giftChip.Visible = false
|
||||||
|
Theme.tooltip(H.giftChip, "Подарки за время в игре: серебро, наживка, жемчуг")
|
||||||
|
task.spawn(function()
|
||||||
|
while true do
|
||||||
|
local at = player:GetAttribute("GiftNextAt") or 0
|
||||||
|
H.giftChip.Visible = at > 0
|
||||||
|
if at > 0 then
|
||||||
|
local left = at - os.time()
|
||||||
|
H.giftText.Text = left > 0 and ("Подарок через %s"):format(timeStr(left)) or "Подарок вот-вот!"
|
||||||
|
end
|
||||||
|
task.wait(1)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
local function trackerLine(order, onClick)
|
local function trackerLine(order, onClick)
|
||||||
local root = new("TextButton", { Size = UDim2.new(1, 0, 0, 38), BackgroundTransparency = 1, AutoButtonColor = false, Text = "", LayoutOrder = order, Parent = tracker })
|
local root = new("TextButton", { Size = UDim2.new(1, 0, 0, 38), BackgroundTransparency = 1, AutoButtonColor = false, Text = "", LayoutOrder = order, Parent = tracker })
|
||||||
local label = text({ Size = UDim2.new(1, 0, 0, 22), Font = BODY, TextSize = 14, RichText = true, TextTruncate = Enum.TextTruncate.AtEnd, Text = "",
|
local label = text({ Size = UDim2.new(1, 0, 0, 22), Font = BODY, TextSize = 14, RichText = true, TextTruncate = Enum.TextTruncate.AtEnd, Text = "",
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ local function render()
|
|||||||
local coins = player:GetAttribute("Coins") or 0
|
local coins = player:GetAttribute("Coins") or 0
|
||||||
local plot = player:GetAttribute("HousePlot")
|
local plot = player:GetAttribute("HousePlot")
|
||||||
|
|
||||||
local head = card(list, 1, 96, C.gold)
|
local head = card(list, 1, 120, C.gold)
|
||||||
text({ Size = UDim2.new(1, -24, 0, 30), Position = UDim2.fromOffset(12, 8), Font = TITLE, TextSize = 24, TextColor3 = C.goldBright,
|
text({ Size = UDim2.new(1, -24, 0, 30), Position = UDim2.fromOffset(12, 8), Font = TITLE, TextSize = 24, TextColor3 = C.goldBright,
|
||||||
Text = ("Ур. %d · %s"):format(lvl, HC.name(lvl)), Parent = head })
|
Text = ("Ур. %d · %s"):format(lvl, HC.name(lvl)), Parent = head })
|
||||||
text({ Size = UDim2.new(1, -24, 0, 20), Position = UDim2.fromOffset(12, 38), TextSize = 15, TextColor3 = C.muted,
|
text({ Size = UDim2.new(1, -24, 0, 20), Position = UDim2.fromOffset(12, 38), TextSize = 15, TextColor3 = C.muted,
|
||||||
@@ -112,6 +112,11 @@ local function render()
|
|||||||
new("Frame", { Size = UDim2.fromScale(lvl / HC.MaxLevel, 1), BackgroundColor3 = Color3.fromRGB(110, 200, 110), BorderSizePixel = 0, Parent = bar }, { corner(7) })
|
new("Frame", { Size = UDim2.fromScale(lvl / HC.MaxLevel, 1), BackgroundColor3 = Color3.fromRGB(110, 200, 110), BorderSizePixel = 0, Parent = bar }, { corner(7) })
|
||||||
text({ Size = UDim2.fromScale(1, 1), TextSize = 12, TextXAlignment = CENTER, Font = TITLE, Text = lvl .. " / " .. HC.MaxLevel,
|
text({ Size = UDim2.fromScale(1, 1), TextSize = 12, TextXAlignment = CENTER, Font = TITLE, Text = lvl .. " / " .. HC.MaxLevel,
|
||||||
TextStrokeTransparency = 0.4, TextStrokeColor3 = C.ink, Parent = bar })
|
TextStrokeTransparency = 0.4, TextStrokeColor3 = C.ink, Parent = bar })
|
||||||
|
-- аренда: дом приносит серебро, пока тебя нет (копится до HC.Rent.maxHours часов)
|
||||||
|
local rent = HC.rentPerHour(lvl)
|
||||||
|
text({ Size = UDim2.new(1, -24, 0, 22), Position = UDim2.fromOffset(12, 90), TextSize = 16, TextColor3 = rent > 0 and Color3.fromRGB(160, 240, 160) or C.muted,
|
||||||
|
Text = rent > 0 and ("Аренда: %s %s/ч · копится до %d ч"):format(fmt(rent), Theme.SILVER, HC.Rent.maxHours)
|
||||||
|
or ("Аренда начнётся с 1-го уровня · копится до %d ч"):format(HC.Rent.maxHours), Parent = head })
|
||||||
|
|
||||||
if lvl < HC.MaxLevel then
|
if lvl < HC.MaxLevel then
|
||||||
local nextLv = lvl + 1
|
local nextLv = lvl + 1
|
||||||
@@ -158,6 +163,12 @@ local cos = { owned = {}, equip = {} } -- последнее состояние
|
|||||||
local lastSpin = {} -- [категория] = { [id] = сколько выпало в последней крутке }
|
local lastSpin = {} -- [категория] = { [id] = сколько выпало в последней крутке }
|
||||||
local spinning = false -- идёт открытие: строки не перерисовываем, повторно не крутим
|
local spinning = false -- идёт открытие: строки не перерисовываем, повторно не крутим
|
||||||
|
|
||||||
|
task.spawn(function() -- для снимков в Studio: DevOpen = "house"
|
||||||
|
while not K.windows do
|
||||||
|
task.wait(0.2)
|
||||||
|
end
|
||||||
|
K.windows.house = win
|
||||||
|
end)
|
||||||
local pcWin = K.makeWindow("💻 Компьютер", Color3.fromRGB(70, 200, 120), { { id = "spin", label = "🎲 Улучшения" } })
|
local pcWin = K.makeWindow("💻 Компьютер", Color3.fromRGB(70, 200, 120), { { id = "spin", label = "🎲 Улучшения" } })
|
||||||
local pcList = K.scrollArea(pcWin.pages.spin)
|
local pcList = K.scrollArea(pcWin.pages.spin)
|
||||||
closeButton(pcWin.frame, function()
|
closeButton(pcWin.frame, function()
|
||||||
|
|||||||
Reference in new issue
Block a user