P24-02: 操作と通知の全受入
This commit is contained in:
@@ -3,6 +3,7 @@ extends Control
|
||||
|
||||
signal facility_selected(instance_id: StringName)
|
||||
signal staff_assignment_dropped(data: Dictionary, facility_id: StringName)
|
||||
signal staff_assignment_clicked(staff_id: StringName, facility_id: StringName)
|
||||
signal construction_selected(job_id: StringName)
|
||||
signal legacy_stair_selected(stair_id: StringName)
|
||||
signal cell_clicked(cell: Vector3i)
|
||||
@@ -15,6 +16,7 @@ enum LayerMode {
|
||||
BACK,
|
||||
}
|
||||
|
||||
const OperationFeedbackScript := preload("res://scripts/ui/operation_feedback.gd")
|
||||
const RoomPresentation := preload("res://scripts/ui/room_presentation.gd")
|
||||
const People := preload("res://scripts/ui/pixel_people.gd")
|
||||
const PixelArt := preload("res://scripts/ui/pixel_tower_art.gd")
|
||||
@@ -57,6 +59,11 @@ var zoom_level := 1.0
|
||||
var pan_offset := Vector2.ZERO
|
||||
var show_grid := false
|
||||
var pan_mode := false
|
||||
var modal_input_blocked := false:
|
||||
set(value):
|
||||
modal_input_blocked = value
|
||||
if modal_input_blocked:
|
||||
_end_pan_drag()
|
||||
var _drawing := false
|
||||
var _draw_cache: Dictionary = {}
|
||||
|
||||
@@ -420,6 +427,9 @@ func facility_at_canvas(canvas_position: Vector2) -> StringName:
|
||||
|
||||
|
||||
func _gui_input(event: InputEvent) -> void:
|
||||
if modal_input_blocked:
|
||||
accept_event()
|
||||
return
|
||||
if event is InputEventMouseButton:
|
||||
if not event.pressed and event.button_index == _drag_button:
|
||||
_end_pan_drag()
|
||||
@@ -1145,6 +1155,10 @@ func _draw_actors() -> void:
|
||||
else:
|
||||
position += _actor_offset(guest.current_cell,counts)
|
||||
_draw_pixel_actor(position,key,false,int(guest.state),receiving,false,_guest_activity(guest))
|
||||
var rel_guest: Variant = _guest_relationship(guest.guest_id)
|
||||
var guest_bubble := OperationFeedbackScript.resolve_guest_bubble(guest, rel_guest)
|
||||
if guest_bubble != OperationFeedbackScript.BUBBLE_NONE:
|
||||
_draw_unit_bubble(position, guest_bubble)
|
||||
var staff_service: Variant = _service(&"staff_service")
|
||||
if staff_service != null and staff_service.has_method(&"get_staff_members"):
|
||||
for staff: Variant in staff_service.call(&"get_staff_members"):
|
||||
@@ -1171,7 +1185,12 @@ func _draw_actors() -> void:
|
||||
position = _rescue_treatment_position(staff.staff_id, position)
|
||||
if position.is_finite(): _draw_pixel_actor(position,key,true,int(staff.state),false,false)
|
||||
continue
|
||||
_draw_pixel_actor(_queue_positions.get(key, _staff_work_position(staff, position+_actor_offset(staff.current_cell,counts))),key,true,int(staff.state),false,not String(staff.carried_inventory_id).is_empty(),_staff_work_animation(staff))
|
||||
var staff_draw_pos: Vector2 = _queue_positions.get(key, _staff_work_position(staff, position+_actor_offset(staff.current_cell,counts)))
|
||||
_draw_pixel_actor(staff_draw_pos,key,true,int(staff.state),false,not String(staff.carried_inventory_id).is_empty(),_staff_work_animation(staff))
|
||||
var rel_staff: Variant = _staff_relationship(staff.staff_id)
|
||||
var staff_bubble := OperationFeedbackScript.resolve_staff_bubble(staff, rel_staff)
|
||||
if staff_bubble != OperationFeedbackScript.BUBBLE_NONE:
|
||||
_draw_unit_bubble(staff_draw_pos, staff_bubble)
|
||||
for key: Variant in _actor_tracks.keys():
|
||||
if not alive.has(key):
|
||||
_actor_tracks.erase(key)
|
||||
@@ -1300,6 +1319,54 @@ func _draw_pixel_actor(center: Vector2, key: String, staff: bool, state: int, re
|
||||
People.draw(self, at, p, mode, frame, variant, staff, float(track.get(&"direction", 1.0)) < 0.0)
|
||||
|
||||
|
||||
func _draw_unit_bubble(actor_center: Vector2, bubble_type: StringName) -> void:
|
||||
var world_pixel := _cell_dimensions().x / 16.0
|
||||
var p := maxf(floorf(world_pixel * 0.75), 1.0) if world_pixel >= 2.0 else world_pixel * 0.75
|
||||
var bubble_pos := actor_center + Vector2(-9 * p, _cell_dimensions().y * 0.5 - 3 * world_pixel - 32 * p)
|
||||
var bubble_size := Vector2(18 * p, 13 * p)
|
||||
var rect := Rect2(bubble_pos.round(), bubble_size.round())
|
||||
draw_rect(rect, Color("ffffff", 0.94))
|
||||
draw_rect(rect, Color("303c40", 0.85), false, 1.0)
|
||||
var tri_p1 := Vector2(rect.get_center().x - 2.5 * p, rect.end.y)
|
||||
var tri_p2 := Vector2(rect.get_center().x + 2.5 * p, rect.end.y)
|
||||
var tri_p3 := Vector2(rect.get_center().x, rect.end.y + 3.5 * p)
|
||||
draw_colored_polygon(PackedVector2Array([tri_p1, tri_p2, tri_p3]), Color("ffffff", 0.94))
|
||||
draw_line(tri_p1, tri_p3, Color("303c40", 0.85), 1.0)
|
||||
draw_line(tri_p2, tri_p3, Color("303c40", 0.85), 1.0)
|
||||
|
||||
var font := ThemeDB.fallback_font
|
||||
var font_size := clampi(int(9 * p), 9, 14)
|
||||
match bubble_type:
|
||||
OperationFeedbackScript.BUBBLE_ZZZ:
|
||||
draw_string(font, rect.position + Vector2(2 * p, rect.size.y - 3 * p), "Zzz", HORIZONTAL_ALIGNMENT_CENTER, rect.size.x - 4 * p, font_size, Color("2d68c4"))
|
||||
OperationFeedbackScript.BUBBLE_ANGER:
|
||||
draw_string(font, rect.position + Vector2(2 * p, rect.size.y - 3 * p), "💢", HORIZONTAL_ALIGNMENT_CENTER, rect.size.x - 4 * p, font_size, Color("d63031"))
|
||||
OperationFeedbackScript.BUBBLE_HEART:
|
||||
draw_string(font, rect.position + Vector2(2 * p, rect.size.y - 3 * p), "♥", HORIZONTAL_ALIGNMENT_CENTER, rect.size.x - 4 * p, font_size, Color("e84393"))
|
||||
|
||||
|
||||
func _staff_relationship(staff_id: StringName) -> Variant:
|
||||
var service: Variant = _service(&"relationship_service")
|
||||
if service == null or not service.has_method(&"get_relationships"):
|
||||
return null
|
||||
for rel_val: Variant in service.call(&"get_relationships"):
|
||||
if rel_val is RelationshipState:
|
||||
if rel_val.actor_a_id == staff_id or rel_val.actor_b_id == staff_id:
|
||||
return rel_val
|
||||
return null
|
||||
|
||||
|
||||
func _guest_relationship(guest_id: StringName) -> Variant:
|
||||
var service: Variant = _service(&"relationship_service")
|
||||
if service == null or not service.has_method(&"get_relationships"):
|
||||
return null
|
||||
for rel_val: Variant in service.call(&"get_relationships"):
|
||||
if rel_val is RelationshipState:
|
||||
if rel_val.actor_a_id == guest_id or rel_val.actor_b_id == guest_id:
|
||||
return rel_val
|
||||
return null
|
||||
|
||||
|
||||
func _draw_excavation_jobs() -> void:
|
||||
var excavation: Variant = _service(&"excavation_service")
|
||||
if excavation == null or not excavation.has_method(&"get_jobs"):
|
||||
@@ -1594,6 +1661,8 @@ func _resting_staff_position(staff_id: StringName, fallback: Vector2) -> Vector2
|
||||
|
||||
|
||||
func _can_drop_data(_position: Vector2, data: Variant) -> bool:
|
||||
if modal_input_blocked:
|
||||
return false
|
||||
return data is Dictionary and data.get(&"kind", &"") == &"staff_assignment" and data.get(&"staff_id", &"") is StringName
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user