Redesign phone calls with a responsive word cloud and user siren

This commit is contained in:
Codex
2026-10-30 01:38:31 +02:00
parent 6549ba9308
commit 56d9af9d2e
15 changed files with 976 additions and 206 deletions
@@ -0,0 +1,139 @@
extends Container
## A rotating word sphere, with enough separation to keep every answer clickable.
var hovered: Control
var yaw := 0.35
var pitch := -0.12
var velocity := Vector2(0.065,0.018)
var pointer := Vector2.ZERO
var pointer_inside := false
var pressed_tag: Control
func _ready() -> void:
mouse_filter=Control.MOUSE_FILTER_STOP
mouse_exited.connect(func():
pointer_inside=false
hovered=null)
func pick_tag(point: Vector2) -> Control:
var selected: Control = null
for child in get_children():
if not child is Button or child.disabled: continue
var rect := Rect2(child.position+child.pivot_offset*(Vector2.ONE-child.scale),child.size*child.scale)
if rect.has_point(point) and (selected==null or child.z_index>selected.z_index): selected=child
return selected
func _gui_input(event: InputEvent) -> void:
if event is InputEventMouseMotion:
pointer=event.position
pointer_inside=true
hovered=pick_tag(pointer)
elif event is InputEventMouseButton and event.button_index==MOUSE_BUTTON_LEFT:
pointer=event.position
hovered=pick_tag(pointer)
if event.pressed:
pressed_tag=hovered
else:
var selected := pressed_tag
pressed_tag=null
if is_instance_valid(selected) and selected==hovered and not selected.disabled:
selected.pressed.emit()
accept_event()
func _get_minimum_size() -> Vector2:
return Vector2(0,300)
func _notification(what: int) -> void:
if what == NOTIFICATION_SORT_CHILDREN: arrange()
func arrange() -> void:
var count := get_child_count()
for i in range(count):
var child := get_child(i) as Control
if child == null: continue
# Canvas z-order does not define native Control mouse order. Pick the visibly
# frontmost tag in this container, rather than an invisible rear rectangle.
child.mouse_filter=Control.MOUSE_FILTER_IGNORE
var dimensions := child.get_combined_minimum_size()
fit_child_in_rect(child,Rect2(child.position,dimensions))
child.pivot_offset = dimensions/2
var latitude := 1.0-2.0*(i+0.5)/maxf(1,count)
var ring := sqrt(maxf(0,1-latitude*latitude))
child.set_meta("cloud_seed",Vector3(cos(i*2.39996)*ring,latitude,sin(i*2.39996)*ring))
if not child is Button: child.position=(size-dimensions)/2
func _process(delta: float) -> void:
if size.x<1 or size.y<1: return
if not is_instance_valid(hovered): hovered=null
if pointer_inside: hovered=pick_tag(pointer)
mouse_default_cursor_shape=Control.CURSOR_POINTING_HAND if hovered!=null else Control.CURSOR_ARROW
var tags: Array[Control] = []
var active: Control = null
var largest := Vector2.ZERO
for child in get_children():
if not child is Button: continue
tags.append(child)
largest.x=maxf(largest.x,child.size.x)
largest.y=maxf(largest.y,child.size.y)
if not child.disabled and (child==hovered or child.has_focus()): active=child
if tags.is_empty(): return
var mouse := pointer
var direction := Vector2(0.065,0.018)
if pointer_inside and Rect2(Vector2.ZERO,size).has_point(mouse):
var relative := (mouse-size/2)/(size/2)
direction=Vector2(0.04+relative.x*0.15,-relative.y*0.10)
velocity=velocity.lerp(direction,1.0-exp(-delta/0.65))
if active==null:
yaw+=delta*velocity.x
pitch+=delta*velocity.y
var rotation_basis := Basis(Vector3.UP,yaw)*Basis(Vector3.RIGHT,pitch)
var cloud_origin := Vector2(size.x/2,size.y*0.60)
var radius := Vector2(maxf(90,(size.x-largest.x*1.18)/2-20),maxf(55,size.y*0.40-largest.y*0.59-14))
var targets: Array[Vector2] = []
var scales: Array[float] = []
var depths: Array[float] = []
for child in tags:
var point: Vector3 = rotation_basis*child.get_meta("cloud_seed",Vector3.ZERO)
var depth := (point.z+1)/2
var scale_factor := 0.68+depth*0.37
var target := cloud_origin+Vector2(point.x*radius.x,point.y*radius.y)*scale_factor
if child==active:
if not child.get_meta("cloud_active",false): child.set_meta("cloud_hold",child.position+child.size/2)
target=child.get_meta("cloud_hold")
scale_factor=1.18
child.set_meta("cloud_active",child==active)
targets.append(target)
scales.append(scale_factor)
depths.append(depth)
# Separate intersecting words without losing their depth or curved movement.
for iteration in range(7):
for i in range(tags.size()):
for j in range(i+1,tags.size()):
var a := tags[i].size*scales[i]+Vector2(12,8)
var b := tags[j].size*scales[j]+Vector2(12,8)
var difference := targets[i]-targets[j]
var overlap := (a+b)/2-difference.abs()
if overlap.x<=0 or overlap.y<=0: continue
var push := Vector2.ZERO
if overlap.x<overlap.y*1.4:
push.x=(overlap.x+2)*0.52*(1.0 if difference.x>=0 else -1.0)
else:
push.y=(overlap.y+2)*0.52*(1.0 if difference.y>=0 else -1.0)
if tags[i]!=active: targets[i]+=push*(2 if tags[j]==active else 1)
if tags[j]!=active: targets[j]-=push*(2 if tags[i]==active else 1)
for i in range(tags.size()):
if tags[i]==active: continue
var edge := tags[i].size*scales[i]/2+Vector2(9,9)
targets[i]=targets[i].clamp(edge,size-edge)
for i in range(tags.size()):
var child := tags[i]
var center: Vector2 = child.get_meta("cloud_center",targets[i])
center=targets[i] if child==active else center.lerp(targets[i],1.0-exp(-delta/0.35))
var growth: float = lerpf(child.get_meta("cloud_scale",scales[i]),scales[i],1.0-exp(-delta/0.13))
child.set_meta("cloud_center",center)
child.set_meta("cloud_scale",growth)
child.position=center-child.size/2
child.scale=Vector2.ONE*growth
child.modulate.a=1.0 if child==active else 0.48+depths[i]*0.52
var ink := Color("e4a3c0") if child==active else Color("ddd1e5")
if child.get_theme_color("font_color")!=ink: child.add_theme_color_override("font_color",ink)
child.z_index=50 if child==active else int(depths[i]*20)
+102
View File
@@ -0,0 +1,102 @@
extends Control
## Vector phone shells. Screens are ordinary controls, so notifications stay clickable.
var smartphone := true
var dialing := false
var pulse := 0.0
var display: Control
func build(smart: bool) -> void:
smartphone = smart
mouse_filter = Control.MOUSE_FILTER_IGNORE
custom_minimum_size = Vector2(274, 558) if smart else Vector2(232, 448)
size = custom_minimum_size
display = Control.new()
display.position = Vector2(12, 15) if smart else Vector2(24, 68)
display.size = Vector2(250, 528) if smart else Vector2(184, 155)
display.clip_contents = true
display.mouse_filter = Control.MOUSE_FILTER_IGNORE
add_child(display)
func rounded(rect: Rect2, color: Color, border: Color, radius: int, width: int = 1) -> void:
var box := StyleBoxFlat.new()
box.bg_color = color
box.border_color = border
box.set_border_width_all(width)
box.set_corner_radius_all(radius)
draw_style_box(box, rect)
func text_at(at: Vector2, text: String, font_size: int, color: Color) -> void:
var font := ThemeDB.fallback_font
var width := font.get_string_size(text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size).x
draw_string(font, at - Vector2(width / 2, 0), text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, color)
func handset(center: Vector2, color: Color) -> void:
draw_polyline(PackedVector2Array([center+Vector2(-12,3), center+Vector2(-11,-2), center+Vector2(-5,-5), center+Vector2(5,-5), center+Vector2(11,-2), center+Vector2(12,3)]), color, 3, true)
draw_line(center+Vector2(-12,3), center+Vector2(-7,3), color, 3, true)
draw_line(center+Vector2(7,3), center+Vector2(12,3), color, 3, true)
func _draw() -> void:
if smartphone:
rounded(Rect2(5, 13, 274, 558), Color(0,0,0,0.28), Color.TRANSPARENT, 42)
rounded(Rect2(0, 0, 274, 558), Color("25232e"), Color("5b5666"), 40, 2)
rounded(Rect2(5, 5, 264, 548), Color("07080d"), Color("101117"), 36)
rounded(Rect2(12, 15, 250, 528), Color("171420"), Color.TRANSPARENT, 30)
rounded(Rect2(99, 17, 76, 18), Color("07080d"), Color.TRANSPARENT, 10)
draw_circle(Vector2(156,26), 3, Color("202733"))
rounded(Rect2(-3, 100, 3, 42), Color("4a4554"), Color.TRANSPARENT, 1)
rounded(Rect2(274, 140, 3, 54), Color("4a4554"), Color.TRANSPARENT, 1)
var center := Vector2(137, 196)
if dialing:
for i in range(3):
var progress := fmod(pulse * 0.55 + i / 3.0, 1.0)
draw_arc(center, 42 + progress * 38, 0, TAU, 70, Color(0.86,0.45,0.65,(1-progress)*0.18), 1.5, true)
draw_circle(center, 42, Color("393044"))
text_at(center + Vector2(0,12), "М", 34, Color("e5c8df"))
for i in range(3):
var point := Vector2(67 + i * 70, 413)
draw_circle(point, 21, Color("2a2633"))
if i == 0:
rounded(Rect2(point-Vector2(3,9), Vector2(6,14)), Color("a39aa9"), Color.TRANSPARENT, 3)
draw_arc(point-Vector2(0,2), 7, 0, PI, 20, Color("a39aa9"), 1.5, true)
draw_line(point+Vector2(0,5),point+Vector2(0,10),Color("a39aa9"),1.5,true)
elif i == 1:
for row in range(3):
for col in range(3): draw_circle(point + Vector2(col*5-5,row*5-5),1.1,Color("a39aa9"))
else:
draw_colored_polygon(PackedVector2Array([point+Vector2(-8,-3),point+Vector2(-3,-3),point+Vector2(2,-7),point+Vector2(2,7),point+Vector2(-3,3),point+Vector2(-8,3)]),Color("a39aa9"))
draw_arc(point+Vector2(1,0),9,-0.8,0.8,12,Color("a39aa9"),1.4,true)
draw_circle(Vector2(137,493),25,Color("a94760"))
handset(Vector2(137,493),Color("f9e7ef"))
rounded(Rect2(106, 530, 62, 4),Color("948894"),Color.TRANSPARENT,2)
else:
rounded(Rect2(5, 12, 232, 448),Color(0,0,0,0.3),Color.TRANSPARENT,34)
rounded(Rect2(0, 0, 232, 448),Color("3a3b3e"),Color("67686b"),32,2)
rounded(Rect2(7, 7, 218, 434),Color("27292c"),Color("1b1d21"),26)
for row in range(3):
for col in range(9): draw_circle(Vector2(91+col*6,27+row*4),1.2,Color("111317"))
text_at(Vector2(116,55),"mobile",10,Color("777a7c"))
rounded(Rect2(18,62,196,167),Color("101513"),Color("555b57"),6,2)
rounded(Rect2(24,68,184,155),Color("a3b58c"),Color("80916e"),2)
rounded(Rect2(76,241,80,56),Color("66696c"),Color("85888a"),14)
rounded(Rect2(85,249,62,40),Color("3e4246"),Color("272b2e"),10)
text_at(Vector2(116,274),"OK",13,Color("cbced0"))
for i in range(2):
var x := 22.0 if i == 0 else 166.0
rounded(Rect2(x,243,44,24),Color("44474b"),Color("1f2226"),7)
draw_line(Vector2(x+14,254),Vector2(x+30,254),Color("969c9e"),2,true)
rounded(Rect2(x,272,44,24),Color("363a3d"),Color("1e2025"),7)
handset(Vector2(x+22,284),Color("8ca887") if i==0 else Color("b47878"))
var legends := ["", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz", "", "+", ""]
for row in range(4):
for col in range(3):
var index := row*3+col
var rect := Rect2(22+col*64,307+row*30,58,26)
rounded(rect,Color("373a3e"),Color("191d20"),7)
var digit: String = str(index+1) if index<9 else ["*","0","#"][index-9]
text_at(rect.position+Vector2(17,18),digit,16,Color("d5d7d5"))
text_at(rect.position+Vector2(40,16),legends[index],7,Color("939997"))
func animate(delta: float, connecting: bool) -> void:
dialing = connecting
pulse += delta
if smartphone: queue_redraw()
+171 -184
View File
@@ -2,12 +2,13 @@ extends Node3D
## Phone prototype: one physical task at a time; only heard facts persist.
const Profile = preload("res://scripts/profile.gd")
const Soundscape = preload("res://scripts/phone_soundscape.gd")
const PhoneStage = preload("res://scripts/phone_stage.gd")
const SAVE_PATH := "user://profile/phone_memory.cfg"
const BG := Color("10171d")
const CARD := Color("19232c")
const BG := Color("0b0a12")
const CARD := Color("1c1826")
const INK := Color("eee9dd")
const MUTED := Color("a2afb9")
const ACCENT := Color("e3bd7b")
const ACCENT := Color("c5addf")
const RED := Color("db8b80")
const GREEN := Color("9bc4b0")
@@ -42,7 +43,7 @@ var voice_enabled := true
var master_volume := 0.65
var ui: Control
var overlay: Control
var command_list: VBoxContainer
var command_list: Container
var transcript: VBoxContainer
var transcript_scroll: ScrollContainer
var journal: RichTextLabel
@@ -63,13 +64,16 @@ var effect: AudioStreamPlayer
var hum: AudioStreamPlayer
var notification_sound: AudioStreamPlayer
var notification_card: PanelContainer
var inbox_button: Button
var notifications: Array = []
var notification_cursor := 0
var unread := 0
var toast_until := 0.0
var viewing_messages := false
var wave_bars: Array[ColorRect] = []
var stage: Control
var dialing := false
var dial_epoch := 0
var voice_meter: AudioEffectSpectrumAnalyzerInstance
var caption_tween: Tween
var screen_fade: ColorRect
func _ready() -> void:
@@ -117,9 +121,9 @@ func button(text: String, id: String, callback: Callable) -> Button:
node.set_meta("action", id)
node.custom_minimum_size.y = 48
node.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
node.add_theme_stylebox_override("normal", style(Color("25323c"), Color("35434e"), 10))
node.add_theme_stylebox_override("hover", style(Color("35434b"), ACCENT, 10))
node.add_theme_stylebox_override("pressed", style(Color("435049"), GREEN, 10))
node.add_theme_stylebox_override("normal", style(Color("282230"), Color("483e55"), 12))
node.add_theme_stylebox_override("hover", style(Color("3b2e46"), ACCENT, 12))
node.add_theme_stylebox_override("pressed", style(Color("51405d"), ACCENT, 12))
node.add_theme_stylebox_override("disabled", style(Color("1b252c"), Color("2b353d"), 10))
node.add_theme_color_override("font_color", INK)
node.add_theme_color_override("font_hover_color", INK)
@@ -152,110 +156,9 @@ func make_ui() -> void:
theme.default_font_size = 19
ui.theme = theme
layer.add_child(ui)
var background := ColorRect.new()
background.color = BG
background.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
ui.add_child(background)
var margins := MarginContainer.new()
margins.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
for edge in ["left", "right", "top", "bottom"]:
margins.add_theme_constant_override("margin_" + edge, 24)
ui.add_child(margins)
var root := column(margins)
var top := HBoxContainer.new()
root.add_child(top)
var brand := label("ДО ОТБОЯ / НЕ КЛАДИ ТРУБКУ", 22, ACCENT)
brand.size_flags_horizontal = Control.SIZE_EXPAND_FILL
top.add_child(brand)
inbox_button = button("Сообщения", "messages", show_messages)
inbox_button.custom_minimum_size.x = 185
inbox_button.size_flags_vertical = Control.SIZE_SHRINK_CENTER
top.add_child(inbox_button)
var menu_button := button("Меню", "menu", func(): show_menu())
menu_button.custom_minimum_size.x = 120
menu_button.size_flags_vertical = Control.SIZE_SHRINK_CENTER
top.add_child(menu_button)
var body := HBoxContainer.new()
body.add_theme_constant_override("separation", 18)
body.size_flags_vertical = Control.SIZE_EXPAND_FILL
root.add_child(body)
var left := panel(body, 268)
left.add_child(label("ИСХОДЯЩИЙ ЗВОНОК", 15, MUTED))
left.add_child(label("Мама", 44))
status_label = label("Нет соединения", 18, GREEN)
left.add_child(status_label)
clock_label = label("", 32, ACCENT)
left.add_child(clock_label)
var waveform := HBoxContainer.new()
waveform.alignment = BoxContainer.ALIGNMENT_CENTER
waveform.custom_minimum_size.y = 52
waveform.add_theme_constant_override("separation", 4)
left.add_child(waveform)
for i in range(25):
var bar := ColorRect.new()
bar.color = GREEN
bar.custom_minimum_size = Vector2(4, 5)
bar.size_flags_vertical = Control.SIZE_SHRINK_CENTER
waveform.add_child(bar)
wave_bars.append(bar)
place_label = label("Квартира · вечер", 18)
left.add_child(place_label)
objects_label = label("", 16, MUTED)
left.add_child(objects_label)
left.add_child(HSeparator.new())
left.add_child(label("ТЫ ПОМНИШЬ", 15, ACCENT))
journal = RichTextLabel.new()
journal.size_flags_vertical = Control.SIZE_EXPAND_FILL
journal.bbcode_enabled = false
journal.add_theme_font_size_override("normal_font_size", 17)
journal.add_theme_color_override("default_color", MUTED)
left.add_child(journal)
left.add_child(label("Вещи остаются у мамы.\nМежду звонками — только память.", 15, MUTED))
var middle := column(body)
middle.size_flags_horizontal = Control.SIZE_EXPAND_FILL
title_label = label("Обычный вечер", 34)
middle.add_child(title_label)
phase_label = label("", 17, MUTED)
middle.add_child(phase_label)
transcript_scroll = ScrollContainer.new()
transcript_scroll.size_flags_vertical = Control.SIZE_EXPAND_FILL
transcript_scroll.horizontal_scroll_mode = ScrollContainer.SCROLL_MODE_DISABLED
middle.add_child(transcript_scroll)
transcript = column(transcript_scroll)
transcript.size_flags_horizontal = Control.SIZE_EXPAND_FILL
last_caption = label("Ты узнаёшь происходящее только по её словам.", 17, MUTED)
middle.add_child(last_caption)
var right := panel(body, 390)
right.add_child(label("СКАЗАТЬ МАМЕ", 15, ACCENT))
task_label = label("Одно действие за раз", 21)
right.add_child(task_label)
busy_bar = ProgressBar.new()
busy_bar.custom_minimum_size.y = 5
busy_bar.show_percentage = false
right.add_child(busy_bar)
cancel_button = button("Перебить и изменить просьбу", "cancel", cancel_task)
right.add_child(cancel_button)
var command_scroll := ScrollContainer.new()
command_scroll.size_flags_vertical = Control.SIZE_EXPAND_FILL
command_scroll.horizontal_scroll_mode = ScrollContainer.SCROLL_MODE_DISABLED
right.add_child(command_scroll)
command_list = column(command_scroll)
command_list.size_flags_horizontal = Control.SIZE_EXPAND_FILL
right.add_child(label("Она слышит твой голос.\nТы не управляешь её руками.", 15, MUTED))
screen_fade = ColorRect.new()
screen_fade.color = Color(0, 0, 0, 0)
screen_fade.mouse_filter = Control.MOUSE_FILTER_IGNORE
screen_fade.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
ui.add_child(screen_fade)
notification_card = PanelContainer.new()
notification_card.set_anchors_and_offsets_preset(Control.PRESET_TOP_RIGHT)
notification_card.offset_left = -500
notification_card.offset_right = -24
notification_card.offset_top = 82
notification_card.add_theme_stylebox_override("panel", style(Color("35434a"), ACCENT, 16))
notification_card.z_index = 100
notification_card.visible = false
ui.add_child(notification_card)
stage = PhoneStage.new()
ui.add_child(stage)
stage.build(self)
refresh()
func clear_children(parent: Node) -> void:
@@ -265,37 +168,46 @@ func clear_children(parent: Node) -> void:
func close_overlay() -> void:
viewing_messages = false
stage.close_inbox()
stage.center_region.modulate.a = 1.0
if is_instance_valid(overlay):
ui.remove_child(overlay)
overlay.get_parent().remove_child(overlay)
overlay.queue_free()
overlay = null
func show_messages() -> void:
var box := modal()
close_overlay()
viewing_messages = true
unread = 0
refresh_inbox_button()
notification_card.visible = false
box.add_child(label(str(story.friend) + " · подруга", 34))
box.add_child(label("Звонок с мамой продолжается. Время идёт." if running else "Сообщения за последний звонок", 18, ACCENT))
var box: VBoxContainer = stage.inbox()
var back := button("‹ " + str(story.friend), "close_messages", func():
close_overlay()
if impacted: show_ending())
back.add_theme_font_size_override("font_size",18)
box.add_child(back)
box.add_child(label("Мама · звонок продолжается" if running else "После звонка",12,ACCENT))
var scroll := ScrollContainer.new()
scroll.custom_minimum_size = Vector2(780, 430)
scroll.custom_minimum_size = Vector2(0,350)
scroll.size_flags_vertical = Control.SIZE_EXPAND_FILL
scroll.horizontal_scroll_mode = ScrollContainer.SCROLL_MODE_DISABLED
box.add_child(scroll)
var messages := column(scroll)
messages.size_flags_horizontal = Control.SIZE_EXPAND_FILL
if notifications.is_empty():
messages.add_child(label("Пока нет новых сообщений.", 22, MUTED))
if notifications.is_empty(): messages.add_child(label("Пока нет сообщений.",15,MUTED))
for entry in notifications:
var card := PanelContainer.new()
card.add_theme_stylebox_override("panel", style(Color("26343c")))
var bubble := style(Color("373041"),Color.TRANSPARENT,13)
bubble.content_margin_left = 10
bubble.content_margin_right = 10
bubble.content_margin_top = 10
bubble.content_margin_bottom = 10
card.add_theme_stylebox_override("panel",bubble)
messages.add_child(card)
var content := column(card)
content.add_child(label("Аня · %02d:%02d" % [int(entry.at) / 60, int(entry.at) % 60], 16, ACCENT))
content.add_child(label(entry.text, 23))
box.add_child(button("Вернуться к маме" if running else "Назад", "close_messages", func():
close_overlay()
if impacted: show_ending()))
content.add_theme_constant_override("separation",6)
content.add_child(label(entry.text,15))
content.add_child(label("%02d:%02d" % [int(entry.at)/60,int(entry.at)%60],11,ACCENT))
scroll_inbox_to_latest.call_deferred(scroll)
func scroll_inbox_to_latest(scroll: ScrollContainer) -> void:
@@ -303,9 +215,6 @@ func scroll_inbox_to_latest(scroll: ScrollContainer) -> void:
if is_instance_valid(scroll):
scroll.scroll_vertical = int(scroll.get_v_scroll_bar().max_value)
func refresh_inbox_button() -> void:
inbox_button.text = "Сообщения" + (" · %d" % unread if unread > 0 else "")
func update_notifications(second: float) -> void:
if not running and not impacted: return
while notification_cursor < story.notifications.size():
@@ -315,7 +224,6 @@ func update_notifications(second: float) -> void:
notification_cursor += 1
unread += 1
notification_sound.play()
refresh_inbox_button()
if viewing_messages:
show_messages()
else:
@@ -326,42 +234,75 @@ func update_notifications(second: float) -> void:
func show_notification(entry: Dictionary, second: float) -> void:
clear_children(notification_card)
var content := column(notification_card)
content.add_theme_constant_override("separation",5)
var heading := HBoxContainer.new()
content.add_child(heading)
var sender := label(str(story.friend) + " · СООБЩЕНИЕ", 16, ACCENT)
var sender := label(str(story.friend) + " · сейчас",13,Color("e7d5ed"))
sender.size_flags_horizontal = Control.SIZE_EXPAND_FILL
heading.add_child(sender)
var dismiss := button("×", "dismiss_push", func(): notification_card.visible = false)
dismiss.autowrap_mode = TextServer.AUTOWRAP_OFF
dismiss.custom_minimum_size = Vector2(52, 36)
dismiss.custom_minimum_size = Vector2(26,26)
dismiss.add_theme_font_size_override("font_size",16)
var empty := StyleBoxEmpty.new()
for state in ["normal","hover","pressed"]: dismiss.add_theme_stylebox_override(state,empty)
heading.add_child(dismiss)
var message := button(entry.text, "open_push", show_messages)
message.custom_minimum_size.y = 76
var message := button(entry.text,"open_push",show_messages)
var message_size := ThemeDB.fallback_font.get_multiline_string_size(entry.text,HORIZONTAL_ALIGNMENT_LEFT,210,15)
message.custom_minimum_size = Vector2(210,maxf(44,message_size.y))
message.alignment = HORIZONTAL_ALIGNMENT_LEFT
message.add_theme_font_size_override("font_size",15)
for state in ["normal","hover","pressed"]: message.add_theme_stylebox_override(state,empty)
content.add_child(message)
content.add_child(label("Открыть переписку · время звонка идёт" if running else "Открыть переписку", 14, MUTED))
notification_card.visible = true
notification_card.size = Vector2(476, 0)
notification_card.size = Vector2(234,0)
notification_card.position.y = 30
var tween := create_tween()
tween.tween_property(notification_card,"position:y",42.0,0.4).set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_OUT)
fit_notification.call_deferred()
toast_until = second + (12.0 if notification_cursor == 5 else 7.0)
func fit_notification() -> void:
notification_card.size = Vector2(476, notification_card.get_combined_minimum_size().y)
await get_tree().process_frame
await get_tree().process_frame
notification_card.size = Vector2(234,notification_card.get_combined_minimum_size().y + 6)
func modal() -> VBoxContainer:
close_overlay()
var shade := PanelContainer.new()
shade.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
shade.add_theme_stylebox_override("panel", style(Color("10171d"), Color.TRANSPARENT, 0))
ui.add_child(shade)
overlay = shade
stage.center_region.modulate.a = 0.0
var holder := Control.new()
holder.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
holder.mouse_filter = Control.MOUSE_FILTER_IGNORE
ui.add_child(holder)
overlay = holder
var region := MarginContainer.new()
region.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
region.offset_left = 348
region.offset_right = -300
region.offset_top = 80
region.offset_bottom = -24
region.mouse_filter = Control.MOUSE_FILTER_IGNORE
holder.add_child(region)
var center := CenterContainer.new()
shade.add_child(center)
center.mouse_filter = Control.MOUSE_FILTER_IGNORE
region.add_child(center)
var shell := PanelContainer.new()
shell.custom_minimum_size.x = 860
shell.add_theme_stylebox_override("panel", style(CARD, Color("35434e"), 22))
shell.custom_minimum_size.x = 690
shell.add_theme_stylebox_override("panel",style(Color("1c1826"),Color("493d57"),24))
center.add_child(shell)
return column(shell)
func show_memory() -> void:
var box := modal()
box.add_child(label("Ты помнишь",30,ACCENT))
box.add_child(label("Вещи остаются у мамы. Между звонками — только память.",17,MUTED))
var text := RichTextLabel.new()
text.custom_minimum_size = Vector2(640,410)
text.add_theme_font_size_override("normal_font_size",20)
text.text = journal.text
box.add_child(text)
box.add_child(button("Вернуться к звонку","close_memory",close_overlay))
func show_menu() -> void:
var box := modal()
box.add_child(label("ДО ОТБОЯ", 17, ACCENT))
@@ -372,10 +313,10 @@ func show_menu() -> void:
box.add_child(label("Звонок продолжается, пока открыто меню.", 18, RED))
box.add_child(button("Вернуться к звонку", "resume", close_overlay))
else:
box.add_child(button("Позвонить маме" if completed == 0 else "Продолжить · звонок %d" % mini(completed + 1, 10), "start", func(): begin_call(mini(completed + 1, 10), false)))
box.add_child(button("Позвонить маме" if completed == 0 else "Продолжить · звонок %d" % mini(completed + 1, 10), "start", func(): dial_call(mini(completed + 1, 10), false)))
box.add_child(button("Проверка сцен · выбрать любой из 10 звонков", "testing", show_test_menu))
box.add_child(button("Звук и титры", "settings", show_settings))
box.add_child(label("0.2.3 · Катя: Jessica · Мама: Carol · ElevenLabs\nПрогресс сохраняется после находок и законченных звонков.", 16, MUTED))
box.add_child(label("0.2.4 · Катя: Jessica · Мама: Carol · ElevenLabs\nПрогресс сохраняется после находок и законченных звонков.", 16, MUTED))
func show_settings() -> void:
var box := modal()
@@ -428,10 +369,33 @@ func show_test_menu() -> void:
knowledge.set_meta("test_knowledge", true)
box.add_child(knowledge)
box.add_child(button("Начать проверку", "test_start", func():
begin_call(choices.selected + 1, true, knowledge.selected)))
dial_call(choices.selected + 1, true, knowledge.selected)))
box.add_child(button("Назад", "back_menu", show_menu))
func dial_call(number: int, testing: bool, knowledge: int = 1, animate_in_qa: bool = false) -> void:
if dialing: return
if qa_mode and not animate_in_qa:
begin_call(number,testing,knowledge)
return
dial_epoch += 1
var epoch := dial_epoch
dialing = true
running = false
impacted = false
close_overlay()
voice.stop()
effect.stop()
siren.stop()
hum.stop()
soundscape.stop()
stage.begin_dial()
await get_tree().create_timer(2.4).timeout
if epoch != dial_epoch: return
begin_call(number,testing,knowledge)
func begin_call(number: int, testing: bool, knowledge: int = 1) -> void:
dial_epoch += 1
dialing = false
# A test never writes the normal profile, including learned facts.
if not qa_mode:
var saved := Profile.read_profile(SAVE_PATH, story.facts, story.endings)
@@ -453,7 +417,6 @@ func begin_call(number: int, testing: bool, knowledge: int = 1) -> void:
notifications.clear()
notification_cursor = 0
unread = 0
refresh_inbox_button()
siren.stop()
soundscape.begin_call()
screen_fade.color.a = 0
@@ -484,12 +447,14 @@ func begin_call(number: int, testing: bool, knowledge: int = 1) -> void:
func _process(_delta: float) -> void:
soundscape.update_mix(_delta, voice_enabled and voice.playing)
stage.update(_delta)
if not running and not impacted: return
var second := maxf(0, (Time.get_ticks_msec() - start_tick) / 1000.0)
if running:
elapsed = second
advance()
update_notifications(second)
if impacted: screen_fade.color.a = lerpf(0.9,0.10,clampf((second-90.0)/1.8,0.0,1.0))
func advance() -> void:
if not running: return
@@ -524,6 +489,7 @@ func advance() -> void:
return
"alarm":
fired.alarm = elapsed
siren.volume_db = -70
siren.play()
system_caption("На мамином конце слышна сирена.")
"power":
@@ -685,7 +651,7 @@ func continue_call(retry: bool = false) -> void:
var remembered := facts.duplicate()
var number := chapter if retry else mini(chapter + 1, 10)
var was_test := test_mode
begin_call(number, was_test)
await dial_call(number, was_test)
if was_test:
facts = remembered
refresh()
@@ -694,7 +660,7 @@ func show_transcript() -> void:
var box := modal()
box.add_child(label("Последний разговор", 32))
var text := RichTextLabel.new()
text.custom_minimum_size = Vector2(780, 470)
text.custom_minimum_size = Vector2(640, 430)
text.add_theme_font_size_override("normal_font_size", 21)
for entry in archive:
text.append_text("%02d:%02d %s\n%s\n\n" % [int(entry.at) / 60, int(entry.at) % 60, entry.speaker, entry.text])
@@ -705,7 +671,7 @@ func refresh() -> void:
if not is_instance_valid(journal): return
var entry: Dictionary = story.chapters[chapter - 1]
title_label.text = entry.title
phase_label.text = ("ПРОВЕРКА · " if test_mode else "") + "Звонок %02d / 10 · %s" % [chapter, entry.note]
phase_label.text = ("ПРОВЕРКА · " if test_mode else "") + "ЗВОНОК %02d / 10" % chapter
journal.text = "Пока только её голос." if facts.is_empty() else ""
for key in story.facts:
if facts.has(key): journal.append_text(str(story.facts[key]) + "\n\n")
@@ -718,25 +684,26 @@ func refresh_commands() -> void:
cancel_button.visible = running and not busy.is_empty()
cancel_button.disabled = not speech_finished()
if not running:
command_list.add_child(label("Линия молчит.", 22, MUTED))
var silence: Label = stage.centered("Линия молчит.",20,MUTED)
silence.custom_minimum_size = Vector2(300,60)
command_list.add_child(silence)
return
if chapter == 1:
command_list.add_child(label("Вы просто разговариваете.", 25))
command_list.add_child(label("Вечер. Знакомый голос. Кажется, на всё ещё есть время.", 20, MUTED))
return
if not busy.is_empty():
command_list.add_child(label("Мама выполняет твою просьбу. Отменить её можно в паузе после реплики.", 22, MUTED))
var note: Label = stage.centered("Вы просто разговариваете.\nКажется, на всё ещё есть время.",19,Color("91839f"))
note.custom_minimum_size = Vector2(400,85)
command_list.add_child(note)
return
if not busy.is_empty(): return
var entry: Dictionary = story.chapters[chapter - 1]
if not done.has("question"):
command_list.add_child(button("«" + str(story.lines[entry.question].text) + "»", "question", func(): choose_action("question")))
command_list.add_child(stage.chip("«"+str(story.lines[entry.question].text)+"»","question",func():choose_action("question")))
var names := {"look":"У входной двери", "keys_search":"Найти ключи", "keys_fast":"Ключи в куртке", "lamp_search":"Проверить фонарь", "lamp_fast":"Повернуть батарейку", "mail_hint":"Вспомнить письмо", "read_mail":"Прочитать почту", "safe":"Сейф · 0417", "front":"На площадку", "stairs":"Проверить лестницу", "side_try":"Боковая дверь", "side_open":"Ручку вверх и ключ", "inner":"Во внутренний коридор", "back":"Вернуться в квартиру", "neighbor":"Постучать соседке", "phone_test":"Проверить связь", "phone_shelf":"Телефон на полку", "speak_here":"Мам, я здесь", "speak_love":"Я люблю тебя"}
for action in story.actions:
if command_allowed(action):
var id: String = action.id
var b := button(str(action.label) + " · ~%d с" % ceili(action_duration(action)), id, func(): choose_action(id))
var caption := str(names.get(id,action.label))
var b: Button = stage.chip(caption,id,func():choose_action(id))
command_list.add_child(b)
if place == "flat" and not items.has("keys"):
command_list.add_child(label("Чтобы открыть входную дверь, мама ищет ключи.", 16, MUTED))
update_choice_state()
func speech_finished() -> bool:
@@ -751,23 +718,25 @@ func update_choice_state() -> void:
cancel_button.disabled = not speech_finished()
func refresh_live() -> void:
clock_label.text = "Разговор" if chapter == 1 else "%02d:%02d" % [mini(int(elapsed), 90) / 60, mini(int(elapsed), 90) % 60]
if running and fired.has("alarm"):
var rise := clampf((elapsed-float(story.timeline.alarm))/6.0,0.0,1.0)
rise = rise*rise*(3.0-2.0*rise)
siren.volume_db = linear_to_db(lerpf(db_to_linear(-70),db_to_linear(-23),rise))
clock_label.text = "" if chapter == 1 else "%02d:%02d" % [mini(int(elapsed), 90) / 60, mini(int(elapsed), 90) % 60]
status_label.text = "Плохая связь" if place == "alcove" and not items.has("connected") else "На линии"
if not running: status_label.text = "Соединение прервано"
if not running: status_label.text = "Соединение прервано" if impacted else "Готова позвонить"
var names := {"flat": "В квартире", "inner": "Внутренний коридор", "landing": "Лестничная площадка", "alcove": "Боковой тамбур"}
place_label.text = names[place] + (" · темно" if fired.has("power") or place in ["landing", "alcove"] else "")
var held: Array[String] = []
for key in items:
held.append({"keys": "ключи", "lamp": "фонарь", "spare": "запасной ключ", "connected": "телефон на полке"}[key])
objects_label.text = "У мамы: " + (", ".join(held) if not held.is_empty() else "телефон")
task_label.text = str(busy.label) if not busy.is_empty() else ("Дождись окончания реплики" if not can_respond() else "Она слушает тебя")
task_label.text = str(busy.label) if not busy.is_empty() else ("Дождись окончания реплики" if not can_respond() else "Что сказать маме?")
if not running: task_label.text = ""
if chapter == 1: task_label.text = ""
update_choice_state()
busy_bar.visible = not busy.is_empty()
if not busy.is_empty(): busy_bar.value = clampf((elapsed - busy_start) / (busy_end - busy_start) * 100, 0, 100)
for i in range(wave_bars.size()):
var bar := wave_bars[i]
bar.custom_minimum_size.y = 5 + (absf(sin(elapsed * 8.0 + i * 1.8)) * 30 if voice.playing else absf(sin(elapsed + i)) * 3)
bar.color = ACCENT if fired.has("hum") else GREEN
func action_button(id: String, node: Node = null) -> Button:
if node == null: node = ui
@@ -792,6 +761,7 @@ func voice_length(id: String) -> float:
func say(id: String) -> void:
var entry: Dictionary = story.lines[id]
heard.append(id)
stage.speaker = entry.speaker
speech_until = elapsed + voice_length(id) + 0.08
update_choice_state()
add_caption(entry.speaker, entry.text)
@@ -799,7 +769,7 @@ func say(id: String) -> void:
if id == "intro_04": soundscape.turn_tv_down()
if id == "intro_06": soundscape.world_cue("footsteps", elapsed + voice_length(id) + 0.1)
if voice_enabled:
voice.bus = "Phone" if entry.speaker == "Мама" else "Master"
voice.bus = "Phone" if entry.speaker == "Мама" else "Dialogue"
voice.stream = voice_stream(id)
if voice.stream != null:
soundscape.dialogue_started(float(voice_levels.get(id, -25.0)) - (3.0 if entry.speaker == "Мама" else 0.0))
@@ -809,15 +779,22 @@ func system_caption(text: String) -> void:
add_caption("", text)
func add_caption(speaker: String, text: String) -> void:
archive.append({"at": elapsed, "speaker": speaker, "text": text})
var card := PanelContainer.new()
card.add_theme_stylebox_override("panel", style(Color("222d36") if speaker == "Мама" else Color("16211f"), Color.TRANSPARENT, 12))
transcript.add_child(card)
var content := column(card)
if not speaker.is_empty(): content.add_child(label(speaker.to_upper() + " · %02d:%02d" % [int(elapsed) / 60, int(elapsed) % 60], 14, ACCENT if speaker == "Мама" else GREEN))
content.add_child(label(text, 21 if not speaker.is_empty() else 16, INK if not speaker.is_empty() else MUTED))
last_caption.text = "Слышен мамин голос" if speaker == "Мама" else ""
# Layout happens after this frame; scroll only once its size has updated.
if caption_tween != null: caption_tween.kill()
archive.append({"at":elapsed,"speaker":speaker,"text":text})
var content := VBoxContainer.new()
content.add_theme_constant_override("separation",9)
content.size_flags_horizontal = Control.SIZE_EXPAND_FILL
transcript.add_child(content)
if not speaker.is_empty():
var color := PhoneStage.PINK if speaker == "Катя" else PhoneStage.VIOLET
content.add_child(stage.centered(speaker.to_upper(),12,color))
content.add_child(stage.centered(text,25 if not speaker.is_empty() else 15,INK if not speaker.is_empty() else MUTED))
# A new line takes focus; the complete conversation stays scrollable above it.
for child in transcript.get_children(): child.modulate.a = 0.48 if child != content else 1.0
content.modulate.a = 0.0
caption_tween = content.create_tween()
caption_tween.tween_property(content,"modulate:a",1.0,0.35)
last_caption.text = ""
call_deferred("scroll_to_latest")
func scroll_to_latest() -> void:
@@ -837,7 +814,15 @@ func make_audio() -> void:
for player in [siren, effect, hum]: player.bus = "SceneAudio"
AudioServer.add_bus()
var bus := AudioServer.bus_count - 1
AudioServer.set_bus_name(bus, "Dialogue")
var spectrum := AudioEffectSpectrumAnalyzer.new()
spectrum.buffer_length = 0.1
AudioServer.add_bus_effect(bus,spectrum)
voice_meter = AudioServer.get_bus_effect_instance(bus,0)
AudioServer.add_bus()
bus = AudioServer.bus_count - 1
AudioServer.set_bus_name(bus, "Phone")
AudioServer.set_bus_send(bus,"Dialogue")
var high := AudioEffectHighPassFilter.new()
high.cutoff_hz = 220
var low := AudioEffectLowPassFilter.new()
@@ -845,10 +830,12 @@ func make_audio() -> void:
AudioServer.add_bus_effect(bus, high)
AudioServer.add_bus_effect(bus, low)
voice.volume_db = -2
siren.stream = load("res://assets/audio/siren.wav")
siren.volume_db = -23
siren.finished.connect(func():
if running and fired.has("alarm"): siren.play())
var alarm := load("res://assets/audio/siren_user.wav") as AudioStreamWAV
alarm = alarm.duplicate()
alarm.loop_mode = AudioStreamWAV.LOOP_FORWARD
alarm.loop_end = int(alarm.get_length()*alarm.mix_rate)
siren.stream = alarm
siren.volume_db = -70
effect.volume_db = -12
hum.stream = load("res://assets/audio/approach.wav")
hum.volume_db = -25
+90 -2
View File
@@ -64,6 +64,8 @@ func render() -> void:
await RenderingServer.frame_post_draw
func capture(name: String) -> void:
if DisplayServer.get_name() != "headless":
await game.get_tree().create_timer(0.42).timeout
await render()
if DisplayServer.get_name() != "headless":
game.get_viewport().get_texture().get_image().save_png(directory().path_join(name + ".png"))
@@ -96,6 +98,7 @@ func realtime_check() -> void:
check(game.action_button("next") != null, "Production ending overlay")
await capture("phone-real-ending")
click("next")
while game.dialing: await game.get_tree().create_timer(0.1).timeout
await game.get_tree().create_timer(5.0).timeout
check(game.chapter == 2 and game.running, "Production redial")
check("greeting" in game.heard and "call_02_k" in game.heard, "Production second opening")
@@ -146,6 +149,21 @@ func run(target: Node) -> void:
click("settings")
await capture("phone-credits")
click("back_menu")
game.dial_call(1,true,0,true)
check(game.dialing and not game.running, "Dial animation precedes the 90-second clock")
check(game.stage.mother_status.text == "Входящий звонок", "Mother sees incoming daughter call")
await game.get_tree().create_timer(0.55).timeout
await capture("phone-dialing")
await game.get_tree().create_timer(1.9 if DisplayServer.get_name() == "headless" else 1.5).timeout
check(game.running and not game.dialing and game.elapsed < 1.0, "Connection starts a fresh full attempt")
check("greeting" in game.heard, "Mother answers after connection")
game.stage.update(1.0)
check(game.stage.purple_level > game.stage.pink_level, "Mother lights the violet background")
await capture("phone-mother-voice")
at(4.0)
game.stage.update(1.0)
check(game.stage.pink_level > game.stage.purple_level, "Katya lights the pink background")
await capture("phone-katya-voice")
start(2)
var blocked: Button = game.action_button("keys_search")
check(blocked != null and blocked.disabled, "Choices visible but disabled during greeting")
@@ -157,6 +175,67 @@ func run(target: Node) -> void:
check(game.action_button("keys_search").disabled, "Still blocked before audio end")
wait_for_speech()
check(not game.action_button("keys_search").disabled, "Choices enabled after complete opening exchange")
await capture("phone-answer-cloud")
for answer in game.command_list.get_children():
if answer is Button: check(not answer.text.ends_with(" с"), "Answer has no duration: " + answer.text)
if DisplayServer.get_name() != "headless":
var tag: Button = game.action_button("keys_search")
# Keep the user's physical cursor from cancelling the timed synthetic hover.
# Click dispatch is still checked through the real viewport just below.
game.command_list.mouse_filter=Control.MOUSE_FILTER_IGNORE
await render()
game.command_list.hovered=null
game.command_list.pointer_inside=false
var previous: Vector2 = tag.position
await game.get_tree().create_timer(0.65).timeout
check(tag.position.distance_to(previous)>0.1, "Answer tags drift gently")
var pointer := InputEventMouseMotion.new()
pointer.position = tag.position+tag.size/2
game.command_list._gui_input(pointer)
await game.get_tree().create_timer(0.45).timeout
check(tag.scale.x>1.08, "Hovered answer grows")
var held: Vector2 = tag.position
await game.get_tree().create_timer(0.25).timeout
check(tag.position.distance_to(held)<0.1, "Hovered answer holds still for clicking")
await capture("phone-answer-hover")
pointer = InputEventMouseMotion.new()
pointer.position = Vector2(-20,-20)
game.command_list._gui_input(pointer)
await game.get_tree().create_timer(0.5).timeout
check(tag.scale.x<1.08, "Answer returns to its depth after hover")
game.command_list.mouse_filter=Control.MOUSE_FILTER_STOP
await render()
var press := InputEventMouseButton.new()
press.button_index=MOUSE_BUTTON_LEFT
press.position=tag.get_global_rect().get_center()
press.pressed=true
game.get_viewport().push_input(press,true)
var release := InputEventMouseButton.new()
release.button_index=MOUSE_BUTTON_LEFT
release.position=press.position
release.pressed=false
game.get_viewport().push_input(release,true)
check(game.busy.get("id","")=="keys_search", "Mouse selects the visible floating answer")
start(2)
wait_for_speech()
await render()
check(game.stage.memory_button.size.x >= 100 and game.stage.menu_button.size.x >= 80, "Header controls stay readable")
if DisplayServer.get_name() != "headless":
var original_size := DisplayServer.window_get_size()
DisplayServer.window_set_size(Vector2i(1366,768))
await capture("phone-wide-layout")
check(game.ui.get_global_rect().encloses(game.stage.mother_phone.get_global_rect()), "Mother phone fits wide viewport")
check(game.ui.get_global_rect().encloses(game.stage.smartphone.get_global_rect()), "Katya phone fits wide viewport")
DisplayServer.window_set_size(original_size)
await render()
var cloud_rect: Rect2 = game.stage.choice_scroll.get_global_rect()
check(cloud_rect.position.y > game.transcript_scroll.get_global_rect().position.y, "Answers below central dialogue")
for child in game.command_list.get_children():
if child is Button:
check(child.get_global_rect().position.x >= cloud_rect.position.x and child.get_global_rect().end.x <= cloud_rect.end.x + 1, "Answer fits cloud width: " + child.text)
click("memory")
check(game.action_button("close_memory") != null, "Notebook opens from call screen")
click("close_memory")
click("keys_search")
check(game.cancel_button.disabled, "Cancellation cannot interrupt the spoken request")
game.cancel_task()
@@ -198,6 +277,11 @@ func run(target: Node) -> void:
check(not game.fired.has("alarm"), "No early siren: " + str(number))
at(24.01)
check(game.fired.get("alarm") == 24.0, "Same siren time: " + str(number))
check(game.siren.playing and game.siren.volume_db < -60, "Siren starts softly: " + str(number))
at(27)
check(game.siren.volume_db > -40 and game.siren.volume_db < -25, "Siren rises gradually: " + str(number))
at(30)
check(absf(game.siren.volume_db+23)<0.1, "Siren reaches quiet background level: " + str(number))
at(44.99)
check(not game.fired.has("power") and "темно" not in game.place_label.text, "Lights stay on until 45: " + str(number))
at(45.01)
@@ -229,7 +313,7 @@ func run(target: Node) -> void:
check(game.heard == ["greeting"], "Identical opening " + str(number))
if number == 1:
check(game.action_button("keys_search") == null, "Prologue has no commands")
check(game.clock_label.text == "Разговор", "Prologue hides time")
check(game.clock_label.text.is_empty(), "Prologue hides time")
for beat in game.story.intro: at(beat.at + 0.01)
check(game.heard.size() == 19 and "power" in game.heard, "Ordinary conversation and blackout acknowledgement")
else:
@@ -370,6 +454,9 @@ func run(target: Node) -> void:
at(17)
check(game.notifications.size() == 1 and game.unread == 1, "First push at 17 seconds")
check(game.notification_card.visible, "Push is visible")
await render()
if DisplayServer.get_name() != "headless":
check(game.stage.smartphone.display.get_global_rect().encloses(game.notification_card.get_global_rect()), "Push stays on Katya's smartphone")
click("dismiss_push")
check(not game.notification_card.visible and game.unread == 1, "Dismiss keeps message unread")
click("keys_search")
@@ -396,7 +483,8 @@ func run(target: Node) -> void:
check(game.notifications.size() == 5 and game.notification_card.visible, "Fifth push over ending screen")
check(game.notifications[4].text == "Кать в твой дом походу попали...", "Exact fifth text")
await capture("phone-after-impact-push")
check(game.notification_card.size.y < 300, "Toast stays compact across all five pushes")
if DisplayServer.get_name() != "headless":
check(game.notification_card.size.y < 300, "Toast stays compact across all five pushes")
click("open_push")
check(game.viewing_messages and game.notifications.size() == 5, "All messages readable after impact")
await capture("phone-inbox")
+268
View File
@@ -0,0 +1,268 @@
extends Control
const Device = preload("res://scripts/phone_device.gd")
const AnswerCloud = preload("res://scripts/phone_answer_cloud.gd")
const PINK := Color("e4a3c0")
const VIOLET := Color("b6a0e6")
var game: Node
var smartphone: Control
var mother_phone: Control
var mother_status: Label
var mother_clock: Label
var call_direction: Label
var memory_button: Button
var menu_button: Button
var message_panel: PanelContainer
var glow: ShaderMaterial
var pink_level := 0.0
var purple_level := 0.0
var voice_energy := 0.0
var speaker := ""
var choice_scroll: ScrollContainer
var center_region: VBoxContainer
func centered(text: String, size: int, color: Color) -> Label:
var node: Label = game.label(text, size, color)
node.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
return node
func screen_text(parent: Control, text: String, y: float, height: float, size: int, color: Color) -> Label:
var node := centered(text, size, color)
node.position = Vector2(8, y)
node.size = Vector2(parent.size.x-16, height)
node.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
node.mouse_filter = Control.MOUSE_FILTER_IGNORE
parent.add_child(node)
return node
func build(target: Node) -> void:
game = target
set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
var background := ColorRect.new()
background.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
background.mouse_filter = Control.MOUSE_FILTER_IGNORE
glow = ShaderMaterial.new()
glow.shader = preload("res://shaders/call_glow.gdshader")
background.material = glow
add_child(background)
var margins := MarginContainer.new()
margins.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
for edge in ["left", "right", "top", "bottom"]: margins.add_theme_constant_override("margin_"+edge,32)
add_child(margins)
var root: VBoxContainer = game.column(margins)
root.add_theme_constant_override("separation",24)
var header := HBoxContainer.new()
header.add_theme_constant_override("separation",12)
root.add_child(header)
var brand: Label = game.label("ДО ОТБОЯ / не клади трубку",18,Color("aaa3b9"))
brand.size_flags_horizontal = Control.SIZE_EXPAND_FILL
header.add_child(brand)
memory_button = game.button("Память", "memory", game.show_memory)
memory_button.custom_minimum_size.x = 140
memory_button.size_flags_vertical = Control.SIZE_SHRINK_CENTER
memory_button.add_theme_font_size_override("font_size",15)
header.add_child(memory_button)
menu_button = game.button("Меню", "menu", game.show_menu)
menu_button.custom_minimum_size.x = 90
menu_button.size_flags_vertical = Control.SIZE_SHRINK_CENTER
menu_button.add_theme_font_size_override("font_size",15)
header.add_child(menu_button)
var body := HBoxContainer.new()
body.add_theme_constant_override("separation",28)
body.size_flags_vertical = Control.SIZE_EXPAND_FILL
root.add_child(body)
var left := Control.new()
left.custom_minimum_size = Vector2(288,636)
left.size_flags_vertical = Control.SIZE_SHRINK_CENTER
body.add_child(left)
smartphone = Device.new()
left.add_child(smartphone)
smartphone.build(true)
smartphone.position = Vector2(7,8)
var screen: Control = smartphone.display
var top := screen_text(screen,"20:43",3,25,11,Color("c8bed1"))
top.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
top.position.x = 18
screen_text(screen,"▮▮▮ ▰",3,25,10,Color("a79bad")).horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
call_direction = screen_text(screen,"МОБИЛЬНЫЙ",87,24,10,Color("908398"))
screen_text(screen,"Мама",224,43,32,Color("f5eaf1"))
game.status_label = screen_text(screen,"Нет соединения",273,27,15,Color("c9a9c2"))
game.clock_label = screen_text(screen,"",303,31,23,Color("ddd3e2"))
var katya_tag := centered("КАТЯ",13,PINK)
katya_tag.position = Vector2(0,591)
katya_tag.size = Vector2(288,24)
left.add_child(katya_tag)
var katya_note := centered("у себя дома",13,Color("706a80"))
katya_note.position = Vector2(0,615)
katya_note.size = Vector2(288,20)
left.add_child(katya_note)
center_region = game.column(body)
center_region.size_flags_horizontal = Control.SIZE_EXPAND_FILL
center_region.add_theme_constant_override("separation",10)
game.phase_label = centered("",11,Color("868096"))
center_region.add_child(game.phase_label)
game.title_label = centered("Обычный вечер",28,Color("eae3f0"))
center_region.add_child(game.title_label)
game.transcript_scroll = ScrollContainer.new()
game.transcript_scroll.size_flags_vertical = Control.SIZE_EXPAND_FILL
game.transcript_scroll.size_flags_stretch_ratio = 1.0
game.transcript_scroll.horizontal_scroll_mode = ScrollContainer.SCROLL_MODE_DISABLED
center_region.add_child(game.transcript_scroll)
game.transcript = game.column(game.transcript_scroll)
game.transcript.size_flags_horizontal = Control.SIZE_EXPAND_FILL
game.transcript.add_theme_constant_override("separation",24)
game.last_caption = centered("",13,Color("8d819d"))
center_region.add_child(game.last_caption)
var space := Control.new()
space.custom_minimum_size.y = 16
center_region.add_child(space)
game.task_label = centered("Одно действие за раз",15,Color("a89bb7"))
center_region.add_child(game.task_label)
game.busy_bar = ProgressBar.new()
game.busy_bar.custom_minimum_size.y = 3
game.busy_bar.show_percentage = false
game.busy_bar.add_theme_stylebox_override("background",game.style(Color("211d2b"),Color.TRANSPARENT,2))
var fill: StyleBoxFlat = game.style(Color("9979b6"),Color.TRANSPARENT,2)
fill.content_margin_top = 0
fill.content_margin_bottom = 0
game.busy_bar.add_theme_stylebox_override("fill",fill)
center_region.add_child(game.busy_bar)
game.cancel_button = chip("Изменить просьбу", "cancel", game.cancel_task)
game.cancel_button.size_flags_horizontal = Control.SIZE_SHRINK_CENTER
center_region.add_child(game.cancel_button)
choice_scroll = ScrollContainer.new()
choice_scroll.custom_minimum_size.y = 300
choice_scroll.size_flags_vertical = Control.SIZE_EXPAND_FILL
choice_scroll.size_flags_stretch_ratio = 1.25
choice_scroll.horizontal_scroll_mode = ScrollContainer.SCROLL_MODE_DISABLED
center_region.add_child(choice_scroll)
game.command_list = AnswerCloud.new()
game.command_list.size_flags_horizontal = Control.SIZE_EXPAND_FILL
game.command_list.size_flags_vertical = Control.SIZE_EXPAND_FILL
choice_scroll.add_child(game.command_list)
var right := Control.new()
right.custom_minimum_size = Vector2(240,636)
right.size_flags_vertical = Control.SIZE_SHRINK_CENTER
body.add_child(right)
mother_phone = Device.new()
right.add_child(mother_phone)
mother_phone.build(false)
mother_phone.position = Vector2(4,63)
var lcd: Control = mother_phone.display
var lcd_ink := Color("354633")
screen_text(lcd,"▮▮▮ ▰",3,20,12,lcd_ink)
screen_text(lcd,"Доченька",37,34,22,lcd_ink)
mother_status = screen_text(lcd,"Нет звонка",79,26,14,lcd_ink)
mother_clock = screen_text(lcd,"",110,25,18,lcd_ink)
var mother_tag := centered("МАМА",13,VIOLET)
mother_tag.position = Vector2(0,539)
mother_tag.size = Vector2(240,24)
right.add_child(mother_tag)
game.place_label = centered("Квартира · вечер",15,Color("9991a6"))
game.place_label.position = Vector2(0,567)
game.place_label.size = Vector2(240,42)
right.add_child(game.place_label)
game.objects_label = centered("",13,Color("777080"))
game.objects_label.position = Vector2(0,612)
game.objects_label.size = Vector2(240,55)
right.add_child(game.objects_label)
# The full notebook remains available without occupying the call screen.
game.journal = RichTextLabel.new()
game.journal.visible = false
add_child(game.journal)
game.screen_fade = ColorRect.new()
game.screen_fade.color = Color(0,0,0,0)
game.screen_fade.mouse_filter = Control.MOUSE_FILTER_IGNORE
game.screen_fade.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
game.ui.add_child(game.screen_fade)
game.notification_card = PanelContainer.new()
game.notification_card.position = Vector2(8,42)
game.notification_card.size = Vector2(234,0)
var notification_style: StyleBoxFlat = game.style(Color("34303f"),Color("60566d"),17)
notification_style.content_margin_left = 12
notification_style.content_margin_right = 12
notification_style.content_margin_top = 9
notification_style.content_margin_bottom = 10
game.notification_card.add_theme_stylebox_override("panel",notification_style)
game.notification_card.z_index = 100
game.notification_card.visible = false
screen.add_child(game.notification_card)
func chip(text: String, id: String, callback: Callable) -> Button:
var node: Button = game.button(text,id,callback)
var width := clampf(ThemeDB.fallback_font.get_string_size(text,HORIZONTAL_ALIGNMENT_LEFT,-1,20).x+36,120,330)
var text_size := ThemeDB.fallback_font.get_multiline_string_size(text,HORIZONTAL_ALIGNMENT_CENTER,width-34,20,-1,TextServer.BREAK_MANDATORY | TextServer.BREAK_WORD_BOUND | TextServer.BREAK_ADAPTIVE)
node.custom_minimum_size = Vector2(width,maxf(44,text_size.y+20))
node.add_theme_font_size_override("font_size",20)
node.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
for state in ["normal","hover","pressed","disabled","focus"]:
var empty := StyleBoxEmpty.new()
empty.content_margin_top = 10
empty.content_margin_bottom = 10
empty.content_margin_left = 17
empty.content_margin_right = 17
node.add_theme_stylebox_override(state,empty)
node.add_theme_color_override("font_color",Color("ddd1e5"))
node.add_theme_color_override("font_hover_color",PINK)
node.add_theme_color_override("font_focus_color",PINK)
node.add_theme_color_override("font_pressed_color",Color("ffe0ed"))
node.add_theme_color_override("font_disabled_color",Color("786b88"))
return node
func close_inbox() -> void:
if is_instance_valid(message_panel):
message_panel.get_parent().remove_child(message_panel)
message_panel.queue_free()
message_panel = null
func inbox() -> VBoxContainer:
close_inbox()
message_panel = PanelContainer.new()
message_panel.position = Vector2(4,35)
message_panel.size = Vector2(242,480)
message_panel.add_theme_stylebox_override("panel",game.style(Color("211c2b"),Color.TRANSPARENT,18))
smartphone.display.add_child(message_panel)
var box: VBoxContainer = game.column(message_panel)
box.add_theme_constant_override("separation",10)
return box
func update(delta: float) -> void:
var speaking: bool = game.voice_enabled and game.voice.playing
var mix := 1.0-exp(-delta/0.8)
pink_level = lerpf(pink_level,1.0 if speaking and speaker=="Катя" else 0.0,mix)
purple_level = lerpf(purple_level,1.0 if speaking and speaker=="Мама" else 0.0,mix)
var magnitude := 0.0
if speaking and game.voice_meter != null:
magnitude = clampf(game.voice_meter.get_magnitude_for_frequency_range(120,3200).length()*14,0.0,1.0)
voice_energy = lerpf(voice_energy,magnitude,1.0-exp(-delta/0.28))
glow.set_shader_parameter("katya",pink_level)
glow.set_shader_parameter("mother",purple_level)
glow.set_shader_parameter("energy",voice_energy)
smartphone.animate(delta,game.dialing)
menu_button.disabled = game.dialing
memory_button.disabled = game.dialing
memory_button.text = "Память" + (" · %d" % game.facts.size() if not game.facts.is_empty() else "")
if game.dialing:
call_direction.text = "ИСХОДЯЩИЙ ВЫЗОВ"
game.status_label.text = "Вызов" + ".".repeat(1 + int(smartphone.pulse*1.5)%3)
game.clock_label.text = ""
mother_status.text = "Входящий звонок"
mother_clock.text = "•••"
else:
call_direction.text = "МОБИЛЬНЫЙ"
mother_status.text = "Разговор" if game.running else ("Вызов завершён" if game.impacted else "Ожидание")
mother_clock.text = game.clock_label.text if game.running else ""
func begin_dial() -> void:
speaker = ""
smartphone.pulse = 0
game.notification_card.visible = false
game.screen_fade.color.a = 0
game.title_label.text = "Мама"
game.phase_label.text = "ИСХОДЯЩИЙ ЗВОНОК"
game.last_caption.text = ""
game.task_label.text = "Соединение…"
game.busy_bar.visible = false
game.cancel_button.visible = false
game.clear_children(game.transcript)
game.clear_children(game.command_list)
update(0.01)