feat(bunsik): 화면 UI 전면 개편 — 시뮬레이터 스타일(굵은 테두리·그러데이션·입체 버튼·직접 그린 아이콘·애니메이션)
- Theme 모듈: 색, 테두리, 입체 버튼(누르면 들어감, PC 마우스 올리면 커짐), 반짝임, 배지 - 아이콘 32개를 직접 그린 한 장(art/ui_icons.png, tools/icons.py)으로 올리고 Icons 모듈로 잘라 씀 - 돈 알약+동전, +돈 떠오름, 네모 아이콘 버튼, 다음 업그레이드 카드(이름표·아이콘·진행 막대), 업그레이드/설정 창(리본 제목·빨간 X·뒤 어둡게·튀어나오며 열림·다음 줄로 자동 스크롤) - 손님 말풍선·+돈 글자 테두리 색 통일 - 미리보기 도구: tests/cloud/dump_gui.luau + tools/gui_render.py + tools/preview.sh - 통합 테스트 668/668, Layout 1522 검사 통과 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -38,9 +38,10 @@ export type Result = {
|
||||
},
|
||||
}
|
||||
|
||||
local CARD_W, CARD_H = 500, 96
|
||||
local BUY_W, BUY_H = 140, 72
|
||||
local PANEL_W = 520
|
||||
local CARD_W, CARD_H = 500, 112
|
||||
local CARD_TAB = 16 -- 카드 위로 튀어나온 "다음 업그레이드" 이름표 높이(카드 사각형 안)
|
||||
local BUY_W, BUY_H = 140, 70
|
||||
local PANEL_W = 540
|
||||
|
||||
local function rect(x: number, y: number, w: number, h: number): Rect
|
||||
return { x = x, y = y, w = w, h = h }
|
||||
@@ -70,26 +71,28 @@ function Layout.compute(w: number, h: number, touch: boolean, dev: boolean): Res
|
||||
local W, H = w / s, h / s
|
||||
local cx = W / 2
|
||||
|
||||
local money = rect(cx - 150, 6, 300, 62)
|
||||
local carry = rect(cx - 80, 72, 160, 28)
|
||||
-- 돈: 왼쪽에 동전 아이콘이 튀어나온 알약 모양
|
||||
local money = rect(cx - 160, 6, 320, 64)
|
||||
local carry = rect(cx - 60, 74, 120, 30)
|
||||
|
||||
-- 네모 아이콘 버튼(아이콘 위, 이름 아래)
|
||||
local settings, list, double, boost
|
||||
local hintW
|
||||
if touch then
|
||||
-- 오른쪽 위: 설정, 업그레이드 목록. 왼쪽 위: 2배 수익, 돈 부스트(조이스틱 자리 H/3 위쪽).
|
||||
settings = rect(W - 160, 6, 150, 52)
|
||||
list = rect(W - 160, 66, 150, 56)
|
||||
double = rect(10, 6, 170, 58)
|
||||
boost = rect(10, 70, 170, 58)
|
||||
hintW = math.min(640, W - 2 * 190)
|
||||
-- 왼쪽 위: 2배 수익, 돈 부스트(조이스틱 자리 H/3 위쪽). 오른쪽 위: 설정, 업그레이드 목록.
|
||||
double = rect(8, 6, 84, 84)
|
||||
boost = rect(100, 6, 84, 84)
|
||||
list = rect(W - 92, 6, 84, 84)
|
||||
settings = rect(W - 92 - 76, 6, 68, 68)
|
||||
hintW = math.min(640, W - 2 * 196)
|
||||
else
|
||||
settings = rect(W - 140, 6, 130, 44)
|
||||
list = rect(W - 160, H / 2 - 68, 150, 56)
|
||||
double = rect(10, H / 2 - 72, 170, 64)
|
||||
boost = rect(10, H / 2 + 2, 170, 64)
|
||||
settings = rect(W - 78, 6, 68, 68)
|
||||
list = rect(W - 110, H / 2 - 50, 100, 100)
|
||||
double = rect(10, H / 2 - 112, 100, 100)
|
||||
boost = rect(10, H / 2 + 12, 100, 100)
|
||||
hintW = 640
|
||||
end
|
||||
local hint = rect(cx - hintW / 2, 104, hintW, 54)
|
||||
local hint = rect(cx - hintW / 2, 110, hintW, 58)
|
||||
|
||||
-- 아래 카드: 터치 화면에서는 점프 버튼 왼쪽까지 밀어 둡니다.
|
||||
local cardX = cx - CARD_W / 2
|
||||
@@ -99,31 +102,32 @@ function Layout.compute(w: number, h: number, touch: boolean, dev: boolean): Res
|
||||
end
|
||||
cardX = math.max(cardX, 10)
|
||||
local card = rect(cardX, H - 8 - CARD_H, CARD_W, CARD_H)
|
||||
local buy = rect(card.x + CARD_W - 12 - BUY_W, card.y + (CARD_H - BUY_H) / 2, BUY_W, BUY_H)
|
||||
local bodyH = CARD_H - CARD_TAB
|
||||
local buy = rect(card.x + CARD_W - 12 - BUY_W, card.y + CARD_TAB + (bodyH - BUY_H) / 2, BUY_W, BUY_H)
|
||||
|
||||
local toastsW = math.min(560, hintW)
|
||||
local toasts = rect(cx - toastsW / 2, 166, toastsW, math.max(0, card.y - 6 - 166))
|
||||
local toasts = rect(cx - toastsW / 2, 176, toastsW, math.max(0, card.y - 6 - 176))
|
||||
|
||||
local panelH = math.min(430, H - 20)
|
||||
local panelH = math.min(450, H - 12)
|
||||
local panel = rect(cx - PANEL_W / 2, math.max(6, H * 0.48 - panelH / 2), PANEL_W, panelH)
|
||||
|
||||
-- 설정 창 줄: 제목(10~54), 언어 이름(64), 언어 버튼(100~), 마우스(PC만), 효과음, 개발자(주인만)
|
||||
local langButtonH = if touch then 52 else 44
|
||||
local toggleH = if touch then 48 else 40
|
||||
local y = 100 + langButtonH + 12
|
||||
local y = 104 + langButtonH + 16
|
||||
local mouseY: number? = nil
|
||||
if not touch then
|
||||
mouseY = y
|
||||
y += 90
|
||||
y += 92
|
||||
end
|
||||
local sfxY = y
|
||||
y += toggleH + 12
|
||||
y += toggleH + 14
|
||||
local devY: number? = nil
|
||||
if dev then
|
||||
devY = y
|
||||
y += 30 + toggleH + 12
|
||||
y += 34 + toggleH + 14
|
||||
end
|
||||
local setH = y + 4
|
||||
local setH = y + 8
|
||||
local settingsPanel = rect(cx - PANEL_W / 2, math.max(6, H * 0.48 - setH / 2), PANEL_W, setH)
|
||||
|
||||
return {
|
||||
@@ -150,7 +154,7 @@ function Layout.compute(w: number, h: number, touch: boolean, dev: boolean): Res
|
||||
toggleH = toggleH,
|
||||
devY = devY,
|
||||
devButtonH = toggleH,
|
||||
closeH = if touch then 48 else 42,
|
||||
closeH = if touch then 52 else 46,
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
230
bunsik-tycoon/src/client/Theme.luau
Normal file
230
bunsik-tycoon/src/client/Theme.luau
Normal file
@@ -0,0 +1,230 @@
|
||||
--!strict
|
||||
-- 화면 UI 꾸미기 도구: 색, 굵은 테두리, 위아래 그러데이션, 입체 버튼(아래 그림자 판), 반짝 지나가는 빛,
|
||||
-- 누르면 쏙 들어가는 애니메이션, 아이콘. 인기 시뮬레이터·타이쿤 게임의 "굵은 테두리 + 흰 글자" 스타일을 따릅니다.
|
||||
-- 트윈만 쓰고 RenderStepped는 쓰지 않아서 서버(원격 테스트)에서도 만들 수 있습니다.
|
||||
|
||||
local TweenService = game:GetService("TweenService")
|
||||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||
|
||||
local Icons = require(ReplicatedStorage:WaitForChild("Shared"):WaitForChild("Icons"))
|
||||
|
||||
local Theme = {}
|
||||
|
||||
Theme.INK = Color3.fromRGB(59, 30, 18) -- 테두리·글자 외곽선(진한 갈색)
|
||||
Theme.CREAM = Color3.fromRGB(255, 246, 228)
|
||||
Theme.WHITE = Color3.new(1, 1, 1)
|
||||
Theme.BROWN = Color3.fromRGB(120, 72, 40)
|
||||
|
||||
-- 버튼 색(위쪽 밝은 색). 아래쪽·그림자 판은 자동으로 어둡게 만듭니다.
|
||||
Theme.RED = Color3.fromRGB(255, 84, 64)
|
||||
Theme.ORANGE = Color3.fromRGB(255, 150, 40)
|
||||
Theme.YELLOW = Color3.fromRGB(255, 205, 50)
|
||||
Theme.GREEN = Color3.fromRGB(110, 225, 60)
|
||||
Theme.BLUE = Color3.fromRGB(70, 175, 255)
|
||||
Theme.PURPLE = Color3.fromRGB(180, 100, 255)
|
||||
Theme.GRAY = Color3.fromRGB(175, 175, 180)
|
||||
Theme.NAVY = Color3.fromRGB(40, 48, 80)
|
||||
|
||||
Theme.FONT = Font.new("rbxasset://fonts/families/FredokaOne.json", Enum.FontWeight.Bold)
|
||||
|
||||
function Theme.darken(c: Color3, k: number): Color3
|
||||
return c:Lerp(Color3.new(0, 0, 0), k)
|
||||
end
|
||||
|
||||
function Theme.lighten(c: Color3, k: number): Color3
|
||||
return c:Lerp(Color3.new(1, 1, 1), k)
|
||||
end
|
||||
|
||||
function Theme.corner(parent: Instance, r: number, scale: number?): UICorner
|
||||
local c = Instance.new("UICorner")
|
||||
c.CornerRadius = UDim.new(scale or 0, r)
|
||||
c.Parent = parent
|
||||
return c
|
||||
end
|
||||
|
||||
function Theme.stroke(parent: Instance, color: Color3, thickness: number, contextual: boolean?): UIStroke
|
||||
local s = Instance.new("UIStroke")
|
||||
s.Color = color
|
||||
s.Thickness = thickness
|
||||
s.LineJoinMode = Enum.LineJoinMode.Round
|
||||
s.ApplyStrokeMode = if contextual then Enum.ApplyStrokeMode.Contextual else Enum.ApplyStrokeMode.Border
|
||||
s.Parent = parent
|
||||
return s
|
||||
end
|
||||
|
||||
-- 위(밝음) → 아래(어두움) 그러데이션. 배경색은 흰색으로 두고 색은 그러데이션이 냅니다.
|
||||
function Theme.gradient(parent: GuiObject, top: Color3, bottom: Color3): UIGradient
|
||||
local g = parent:FindFirstChildOfClass("UIGradient") or Instance.new("UIGradient")
|
||||
g.Color = ColorSequence.new(top, bottom)
|
||||
g.Rotation = 90
|
||||
g.Parent = parent
|
||||
parent.BackgroundColor3 = Theme.WHITE
|
||||
return g
|
||||
end
|
||||
|
||||
function Theme.frame(parent: Instance, name: string, color: Color3?): Frame
|
||||
local f = Instance.new("Frame")
|
||||
f.Name = name
|
||||
f.BorderSizePixel = 0
|
||||
f.BackgroundColor3 = color or Theme.WHITE
|
||||
f.BackgroundTransparency = if color then 0 else 1
|
||||
f.Parent = parent
|
||||
return f
|
||||
end
|
||||
|
||||
-- 흰 글자 + 진한 테두리(기본). dark=true면 진한 갈색 글자(밝은 바탕용).
|
||||
function Theme.text(parent: Instance, name: string, dark: boolean?, strokeK: number?): TextLabel
|
||||
local t = Instance.new("TextLabel")
|
||||
t.Name = name
|
||||
t.BackgroundTransparency = 1
|
||||
t.FontFace = Theme.FONT
|
||||
t.TextScaled = true
|
||||
t.TextWrapped = true
|
||||
t.AutoLocalize = false
|
||||
t.Text = ""
|
||||
t.TextColor3 = if dark then Theme.INK else Theme.WHITE
|
||||
if not dark then
|
||||
Theme.stroke(t, Theme.INK, strokeK or 2.5, true)
|
||||
end
|
||||
t.Parent = parent
|
||||
return t
|
||||
end
|
||||
|
||||
function Theme.icon(parent: Instance, name: string, icon: string): ImageLabel
|
||||
local i = Instance.new("ImageLabel")
|
||||
i.Name = name
|
||||
i.BackgroundTransparency = 1
|
||||
i.ScaleType = Enum.ScaleType.Fit
|
||||
Icons.apply(i, icon)
|
||||
i.Parent = parent
|
||||
return i
|
||||
end
|
||||
|
||||
Theme.setIcon = Icons.apply
|
||||
|
||||
-- 반짝 지나가는 빛: 같은 모양(둥근 모서리)의 흰 판 위에서 투명도 그러데이션이 왼쪽→오른쪽으로 지나갑니다.
|
||||
function Theme.shine(face: GuiObject, radius: number, period: number): Tween
|
||||
local s = Theme.frame(face, "Shine", Theme.WHITE)
|
||||
s.Size = UDim2.fromScale(1, 1)
|
||||
s.ZIndex = 6
|
||||
Theme.corner(s, radius)
|
||||
local g = Instance.new("UIGradient")
|
||||
g.Rotation = 20
|
||||
g.Transparency = NumberSequence.new({
|
||||
NumberSequenceKeypoint.new(0, 1),
|
||||
NumberSequenceKeypoint.new(0.42, 1),
|
||||
NumberSequenceKeypoint.new(0.5, 0.45),
|
||||
NumberSequenceKeypoint.new(0.58, 1),
|
||||
NumberSequenceKeypoint.new(1, 1),
|
||||
})
|
||||
g.Offset = Vector2.new(-1, 0)
|
||||
g.Parent = s
|
||||
local tw = TweenService:Create(
|
||||
g,
|
||||
TweenInfo.new(0.7, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, -1, false, period),
|
||||
{ Offset = Vector2.new(1, 0) }
|
||||
)
|
||||
tw:Play()
|
||||
return tw
|
||||
end
|
||||
|
||||
export type Button = {
|
||||
button: TextButton, -- 누르는 영역(투명). Layout 사각형이 여기에 들어갑니다.
|
||||
face: Frame, -- 색 있는 윗면
|
||||
base: Frame, -- 아래 그림자 판(입체감)
|
||||
scale: UIScale,
|
||||
setColor: (Color3) -> (),
|
||||
}
|
||||
|
||||
-- 입체 버튼: 아래로 DEPTH만큼 어두운 판이 보이고, 누르면 윗면이 내려가며 살짝 작아집니다.
|
||||
local DEPTH = 5
|
||||
|
||||
function Theme.button(parent: Instance, name: string, color: Color3, radius: number, strokeK: number?): Button
|
||||
local b = Instance.new("TextButton")
|
||||
b.Name = name
|
||||
b.BackgroundTransparency = 1
|
||||
b.AutoButtonColor = false
|
||||
b.Text = ""
|
||||
b.AutoLocalize = false
|
||||
b.Parent = parent
|
||||
local scale = Instance.new("UIScale")
|
||||
scale.Parent = b
|
||||
|
||||
local base = Theme.frame(b, "Base", Theme.darken(color, 0.45))
|
||||
base.Size = UDim2.new(1, 0, 1, -DEPTH)
|
||||
base.Position = UDim2.fromOffset(0, DEPTH)
|
||||
Theme.corner(base, radius)
|
||||
Theme.stroke(base, Theme.INK, strokeK or 3)
|
||||
|
||||
local face = Theme.frame(b, "Face", Theme.WHITE)
|
||||
face.Size = UDim2.new(1, 0, 1, -DEPTH)
|
||||
face.ZIndex = 2
|
||||
Theme.corner(face, radius)
|
||||
Theme.stroke(face, Theme.INK, strokeK or 3)
|
||||
-- 윗부분 반사광(흰 반투명 띠)
|
||||
local gloss = Theme.frame(face, "Gloss", Theme.WHITE)
|
||||
gloss.BackgroundTransparency = 0.72
|
||||
gloss.Size = UDim2.new(1, -10, 0.36, 0)
|
||||
gloss.Position = UDim2.fromOffset(5, 4)
|
||||
gloss.ZIndex = 3
|
||||
Theme.corner(gloss, math.max(4, radius - 4))
|
||||
|
||||
local function setColor(c: Color3)
|
||||
Theme.gradient(face, Theme.lighten(c, 0.12), Theme.darken(c, 0.12))
|
||||
base.BackgroundColor3 = Theme.darken(c, 0.45)
|
||||
end
|
||||
setColor(color)
|
||||
|
||||
local down = false
|
||||
local hover = false
|
||||
local function animate()
|
||||
local target = if down then 0.92 elseif hover then 1.06 else 1
|
||||
TweenService:Create(
|
||||
scale,
|
||||
TweenInfo.new(if down then 0.06 else 0.18, if down then Enum.EasingStyle.Quad else Enum.EasingStyle.Back),
|
||||
{ Scale = target }
|
||||
):Play()
|
||||
face.Position = UDim2.fromOffset(0, if down then DEPTH - 1 else 0)
|
||||
end
|
||||
b.MouseButton1Down:Connect(function()
|
||||
down = true
|
||||
animate()
|
||||
end)
|
||||
b.MouseButton1Up:Connect(function()
|
||||
down = false
|
||||
animate()
|
||||
end)
|
||||
b.InputBegan:Connect(function(input: InputObject)
|
||||
-- 터치에서는 MouseEnter가 같이 와서, 마우스일 때만 커집니다.
|
||||
if input.UserInputType == Enum.UserInputType.MouseMovement then
|
||||
hover = true
|
||||
animate()
|
||||
end
|
||||
end)
|
||||
b.MouseLeave:Connect(function()
|
||||
down = false
|
||||
hover = false
|
||||
animate()
|
||||
end)
|
||||
|
||||
return { button = b, face = face, base = base, scale = scale, setColor = setColor }
|
||||
end
|
||||
|
||||
-- 빨간 동그라미 알림 배지(예: 살 수 있는 업그레이드가 있으면 "!")
|
||||
function Theme.badge(parent: Instance, name: string): (Frame, TextLabel)
|
||||
local f = Theme.frame(parent, name, Theme.RED)
|
||||
f.Size = UDim2.fromOffset(30, 30)
|
||||
f.AnchorPoint = Vector2.new(0.5, 0.5)
|
||||
f.Position = UDim2.new(1, -12, 0, 12)
|
||||
f.ZIndex = 8
|
||||
Theme.corner(f, 1, 1)
|
||||
Theme.stroke(f, Theme.INK, 2.5)
|
||||
Theme.gradient(f, Color3.fromRGB(255, 110, 90), Color3.fromRGB(220, 40, 30))
|
||||
local t = Theme.text(f, "Text", false, 2)
|
||||
t.Size = UDim2.new(1, -6, 1, -6)
|
||||
t.Position = UDim2.fromOffset(3, 3)
|
||||
t.ZIndex = 9
|
||||
return f, t
|
||||
end
|
||||
|
||||
return Theme
|
||||
Reference in New Issue
Block a user