Polish title menu presentation
This commit is contained in:
@@ -1030,17 +1030,17 @@ func _make_button_style(fill: Color, border: Color, border_width: int) -> StyleB
|
||||
return style
|
||||
|
||||
|
||||
func _make_button_texture_style(state_key: String, content_margin: int = 10) -> StyleBoxTexture:
|
||||
func _make_button_texture_style(state_key: String, content_margin: int = 10, texture_margin := Vector2i(92, 42)) -> StyleBoxTexture:
|
||||
var texture := _load_art_texture(BUTTON_TEXTURE_PATH_TEMPLATE % state_key)
|
||||
if texture == null:
|
||||
return null
|
||||
var style := StyleBoxTexture.new()
|
||||
style.texture = texture
|
||||
style.draw_center = true
|
||||
style.texture_margin_left = 92
|
||||
style.texture_margin_right = 92
|
||||
style.texture_margin_top = 42
|
||||
style.texture_margin_bottom = 42
|
||||
style.texture_margin_left = texture_margin.x
|
||||
style.texture_margin_right = texture_margin.x
|
||||
style.texture_margin_top = texture_margin.y
|
||||
style.texture_margin_bottom = texture_margin.y
|
||||
var resolved_margin: int = maxi(content_margin, 8)
|
||||
style.content_margin_left = resolved_margin
|
||||
style.content_margin_right = resolved_margin
|
||||
@@ -1070,11 +1070,14 @@ func _make_icon_button_texture_style(state_key: String, content_margin: int = 6)
|
||||
|
||||
func _apply_generated_button_style(button: Button, important: bool = false) -> bool:
|
||||
var icon_only := bool(button.get_meta("icon_only", false))
|
||||
var normal_style := _make_icon_button_texture_style("pressed" if important else "normal") if icon_only else _make_button_texture_style("pressed" if important else "normal")
|
||||
var hover_style := _make_icon_button_texture_style("hover") if icon_only else _make_button_texture_style("hover")
|
||||
var pressed_style := _make_icon_button_texture_style("pressed") if icon_only else _make_button_texture_style("pressed")
|
||||
var focus_style := _make_icon_button_texture_style("hover") if icon_only else _make_button_texture_style("hover")
|
||||
var disabled_style := _make_icon_button_texture_style("disabled") if icon_only else _make_button_texture_style("disabled")
|
||||
var title_button := bool(button.get_meta("title_menu_button", false))
|
||||
var button_margin := 8 if title_button else 10
|
||||
var button_texture_margin := Vector2i(46, 18) if title_button else Vector2i(92, 42)
|
||||
var normal_style := _make_icon_button_texture_style("pressed" if important else "normal") if icon_only else _make_button_texture_style("pressed" if important else "normal", button_margin, button_texture_margin)
|
||||
var hover_style := _make_icon_button_texture_style("hover") if icon_only else _make_button_texture_style("hover", button_margin, button_texture_margin)
|
||||
var pressed_style := _make_icon_button_texture_style("pressed") if icon_only else _make_button_texture_style("pressed", button_margin, button_texture_margin)
|
||||
var focus_style := _make_icon_button_texture_style("hover") if icon_only else _make_button_texture_style("hover", button_margin, button_texture_margin)
|
||||
var disabled_style := _make_icon_button_texture_style("disabled") if icon_only else _make_button_texture_style("disabled", button_margin, button_texture_margin)
|
||||
if normal_style == null or hover_style == null or pressed_style == null or focus_style == null or disabled_style == null:
|
||||
return false
|
||||
button.add_theme_stylebox_override("normal", normal_style)
|
||||
@@ -2052,6 +2055,31 @@ func _make_title_menu_icon(kind: String) -> Texture2D:
|
||||
return _make_resized_icon_texture(_make_toolbar_icon(kind), TITLE_MENU_ICON_MAX_WIDTH)
|
||||
|
||||
|
||||
func _make_title_portrait_feather_material() -> ShaderMaterial:
|
||||
var shader := Shader.new()
|
||||
shader.code = """
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform float left_feather = 0.18;
|
||||
uniform float right_feather = 0.12;
|
||||
uniform float top_feather = 0.10;
|
||||
uniform float bottom_feather = 0.16;
|
||||
|
||||
void fragment() {
|
||||
vec4 tex = texture(TEXTURE, UV);
|
||||
float alpha = smoothstep(0.0, left_feather, UV.x);
|
||||
alpha *= smoothstep(0.0, right_feather, 1.0 - UV.x);
|
||||
alpha *= smoothstep(0.0, top_feather, UV.y);
|
||||
alpha *= smoothstep(0.0, bottom_feather, 1.0 - UV.y);
|
||||
COLOR = vec4(tex.rgb, tex.a * alpha);
|
||||
}
|
||||
"""
|
||||
var material := ShaderMaterial.new()
|
||||
material.shader = shader
|
||||
material.set_meta("title_portrait_feather_material", true)
|
||||
return material
|
||||
|
||||
|
||||
func _make_resized_icon_texture(texture: Texture2D, max_width: int) -> Texture2D:
|
||||
if texture == null or max_width <= 0:
|
||||
return texture
|
||||
@@ -4355,28 +4383,29 @@ func _create_hud() -> void:
|
||||
|
||||
var title_portrait_shadow := ColorRect.new()
|
||||
title_portrait_shadow.name = "TitlePortraitLacquerField"
|
||||
title_portrait_shadow.position = Vector2(686, 72)
|
||||
title_portrait_shadow.size = Vector2(420, 556)
|
||||
title_portrait_shadow.color = Color(0.10, 0.060, 0.035, 0.10)
|
||||
title_portrait_shadow.position = Vector2(612, 34)
|
||||
title_portrait_shadow.size = Vector2(610, 638)
|
||||
title_portrait_shadow.color = Color(0.13, 0.085, 0.052, 0.055)
|
||||
title_portrait_shadow.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
title_screen_root.add_child(title_portrait_shadow)
|
||||
|
||||
title_portrait_texture_rect = TextureRect.new()
|
||||
title_portrait_texture_rect.name = "TitleCaoCaoPortrait"
|
||||
title_portrait_texture_rect.position = Vector2(684, 50)
|
||||
title_portrait_texture_rect.size = Vector2(436, 606)
|
||||
title_portrait_texture_rect.position = Vector2(646, 42)
|
||||
title_portrait_texture_rect.size = Vector2(492, 626)
|
||||
title_portrait_texture_rect.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
title_portrait_texture_rect.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
|
||||
title_portrait_texture_rect.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_COVERED
|
||||
title_portrait_texture_rect.texture = _load_art_texture(TITLE_PORTRAIT_PATH)
|
||||
title_portrait_texture_rect.modulate = Color(0.96, 0.97, 0.95, 0.96)
|
||||
title_portrait_texture_rect.material = _make_title_portrait_feather_material()
|
||||
title_screen_root.add_child(title_portrait_texture_rect)
|
||||
|
||||
var title_portrait_caption := Label.new()
|
||||
title_portrait_caption.name = "TitlePortraitCaption"
|
||||
title_portrait_caption.text = "조조"
|
||||
title_portrait_caption.position = Vector2(708, 604)
|
||||
title_portrait_caption.size = Vector2(386, 34)
|
||||
title_portrait_caption.position = Vector2(690, 618)
|
||||
title_portrait_caption.size = Vector2(406, 34)
|
||||
title_portrait_caption.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
|
||||
title_portrait_caption.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
||||
title_portrait_caption.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
@@ -11936,11 +11965,10 @@ func _format_briefing_recovery_terrain_text() -> String:
|
||||
var parts := []
|
||||
for summary in recovery_summaries:
|
||||
var name := _terrain_display_name(str(summary.get("name", "지형")))
|
||||
var count := int(summary.get("count", 0))
|
||||
var heal := int(summary.get("heal", 0))
|
||||
if count <= 0 or heal <= 0:
|
||||
if heal <= 0:
|
||||
continue
|
||||
parts.append("%s %d칸 +%d" % [name, count, heal])
|
||||
parts.append("%s 회복 +%d" % [name, heal])
|
||||
if parts.is_empty():
|
||||
return ""
|
||||
return "회복지(차례 시작) %s" % _join_strings(parts, ", ")
|
||||
|
||||
Reference in New Issue
Block a user