Add session mail and player gifts
This commit is contained in:
parent
5dda74c9e4
commit
e53ad1ac38
19 changed files with 1929 additions and 22 deletions
|
|
@ -72,7 +72,7 @@ const DESKTOP_REFERENCE_SIZE := Vector2(1280.0, 720.0)
|
|||
const COMPACT_REFERENCE_SIZE := Vector2(640.0, 480.0)
|
||||
const COMPACT_HEIGHT_THRESHOLD: float = 560.0
|
||||
const NAVIGATION_PRESENTATION_SCALE: float = 0.60
|
||||
const NAVIGATION_CANONICAL_POSITION := Vector2(463.0, 44.0)
|
||||
const NAVIGATION_CANONICAL_POSITION := Vector2(424.0, 44.0)
|
||||
const NAVIGATION_SELECTED_SCALE: float = 1.02
|
||||
const COOLER_RARITY_COMMON := Color("e8eef0")
|
||||
const COOLER_RARITY_UNCOMMON := Color("64c87c")
|
||||
|
|
@ -86,6 +86,7 @@ enum Section {
|
|||
COOLER,
|
||||
BAG,
|
||||
LOGBOOK,
|
||||
MAIL,
|
||||
}
|
||||
|
||||
enum SortMode {
|
||||
|
|
@ -154,6 +155,7 @@ enum CloseReason {
|
|||
@onready var _bag_sprite_detail_name: Label = %BagSpriteDetailName
|
||||
@onready var _bag_sprite_detail_data: Label = %BagSpriteDetailData
|
||||
@onready var _logbook_page: Control = %LogbookPage
|
||||
@onready var _mail_page: MailPage = %MailPage
|
||||
@onready var _book_backing: PanelContainer = %BookBacking
|
||||
@onready var _book_spread: BoxContainer = %BookSpread
|
||||
@onready var _left_page: PanelContainer = %LeftPage
|
||||
|
|
@ -170,6 +172,8 @@ enum CloseReason {
|
|||
@onready var _inventory_tab: BubbleButtonType = %InventoryTab
|
||||
@onready var _bag_tab: BubbleButtonType = %BagTab
|
||||
@onready var _logbook_tab: BubbleButtonType = %LogbookTab
|
||||
@onready var _mail_tab: BubbleButtonType = %MailTab
|
||||
@onready var _mail_unread_badge: Label = %MailUnreadBadge
|
||||
@onready var _close_button: BubbleButtonType = %CloseButton
|
||||
@onready var _content_shell: BubbleContentShellType = %MenuPanel
|
||||
@onready var _content_stage: Control = %Content
|
||||
|
|
@ -228,6 +232,7 @@ var _wallet: PlayerWalletType
|
|||
var _sale_service: FishSaleServiceType
|
||||
var _network_session: NetworkSessionType
|
||||
var _network_sale_service: NetworkSaleService
|
||||
var _network_mail_service: NetworkMailService
|
||||
var _default_buyer: FishBuyerProfileType
|
||||
var _catalog: FishPoolType
|
||||
var _fishing_spot: FishingSpotType
|
||||
|
|
@ -262,6 +267,7 @@ var _content_rest_position: Vector2 = Vector2.ZERO
|
|||
var _cooler_rest_position: Vector2 = Vector2.ZERO
|
||||
var _bag_rest_position: Vector2 = Vector2.ZERO
|
||||
var _logbook_rest_position: Vector2 = Vector2.ZERO
|
||||
var _mail_rest_position: Vector2 = Vector2.ZERO
|
||||
var _page_outgoing_root: Control
|
||||
var _page_incoming_root: Control
|
||||
var _page_hosts_shared: bool = false
|
||||
|
|
@ -287,6 +293,7 @@ func _ready() -> void:
|
|||
_logbook_tab.pressed.connect(
|
||||
_show_section.bind(Section.LOGBOOK)
|
||||
)
|
||||
_mail_tab.pressed.connect(_show_section.bind(Section.MAIL))
|
||||
_close_button.pressed.connect(close_menu)
|
||||
_sort_option.item_selected.connect(_on_sort_selected.bind(_sort_option))
|
||||
_sort_direction.pressed.connect(_on_sort_direction_pressed)
|
||||
|
|
@ -312,6 +319,7 @@ func _ready() -> void:
|
|||
_inventory_tab,
|
||||
_bag_tab,
|
||||
_logbook_tab,
|
||||
_mail_tab,
|
||||
_close_button,
|
||||
])
|
||||
_configure_navigation_focus()
|
||||
|
|
@ -358,6 +366,8 @@ func setup(
|
|||
cooler_capacity: PlayerCoolerCapacityType,
|
||||
network_session: NetworkSessionType,
|
||||
network_sale_service: NetworkSaleService,
|
||||
network_mail_service: NetworkMailService,
|
||||
reservations: PlayerAssetReservationService,
|
||||
) -> void:
|
||||
_player = player
|
||||
_inventory = inventory
|
||||
|
|
@ -373,6 +383,14 @@ func setup(
|
|||
_cooler_capacity = cooler_capacity
|
||||
_network_session = network_session
|
||||
_network_sale_service = network_sale_service
|
||||
_network_mail_service = network_mail_service
|
||||
_mail_page.setup(
|
||||
network_mail_service, reservations, inventory, wallet, bag, item_catalog
|
||||
)
|
||||
_network_mail_service.unread_count_changed.connect(
|
||||
_on_mail_unread_count_changed
|
||||
)
|
||||
_on_mail_unread_count_changed(_network_mail_service.get_unread_count())
|
||||
if (
|
||||
_network_sale_service != null
|
||||
and not _network_sale_service.local_sale_pending.is_connected(
|
||||
|
|
@ -428,6 +446,8 @@ func consume_escape() -> bool:
|
|||
return true
|
||||
if _sale_confirmation.visible:
|
||||
_close_sale_confirmation()
|
||||
elif _current_section == Section.MAIL and _mail_page.consume_escape():
|
||||
pass
|
||||
else:
|
||||
close_menu()
|
||||
return true
|
||||
|
|
@ -563,6 +583,7 @@ func _show_section_immediate(section: Section) -> void:
|
|||
_cooler_page.visible = section == Section.COOLER
|
||||
_bag_page.visible = section == Section.BAG
|
||||
_logbook_page.visible = section == Section.LOGBOOK
|
||||
_mail_page.visible = section == Section.MAIL
|
||||
_content_shell.visible = false
|
||||
_inventory_section.visible = false
|
||||
_bag_section.visible = false
|
||||
|
|
@ -581,9 +602,14 @@ func _show_section_immediate(section: Section) -> void:
|
|||
_update_bag_detail()
|
||||
if section != Section.LOGBOOK:
|
||||
_cancel_logbook_page_transition(true)
|
||||
if section == Section.MAIL:
|
||||
_mail_page.activate()
|
||||
else:
|
||||
_mail_page.deactivate()
|
||||
_inventory_tab.button_pressed = section == Section.COOLER
|
||||
_bag_tab.button_pressed = section == Section.BAG
|
||||
_logbook_tab.button_pressed = section == Section.LOGBOOK
|
||||
_mail_tab.button_pressed = section == Section.MAIL
|
||||
_update_navigation_selection()
|
||||
_configure_active_page_focus()
|
||||
|
||||
|
|
@ -593,8 +619,10 @@ func _focus_current_section() -> void:
|
|||
_inventory_tab.grab_focus()
|
||||
elif _current_section == Section.BAG:
|
||||
_bag_tab.grab_focus()
|
||||
else:
|
||||
elif _current_section == Section.LOGBOOK:
|
||||
_logbook_tab.grab_focus()
|
||||
else:
|
||||
_mail_tab.grab_focus()
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
|
|
@ -621,6 +649,7 @@ func _configure_navigation_focus() -> void:
|
|||
_inventory_tab,
|
||||
_bag_tab,
|
||||
_logbook_tab,
|
||||
_mail_tab,
|
||||
_close_button,
|
||||
]
|
||||
for index: int in navigation.size():
|
||||
|
|
@ -676,6 +705,8 @@ func _configure_active_page_focus() -> void:
|
|||
_configure_bag_item_focus()
|
||||
Section.LOGBOOK:
|
||||
_configure_logbook_focus()
|
||||
Section.MAIL:
|
||||
_mail_page.activate()
|
||||
|
||||
|
||||
func _apply_cooler_control_styles() -> void:
|
||||
|
|
@ -768,6 +799,7 @@ func _apply_navigation_styles() -> void:
|
|||
_inventory_tab,
|
||||
_bag_tab,
|
||||
_logbook_tab,
|
||||
_mail_tab,
|
||||
_close_button,
|
||||
]:
|
||||
bubble.add_theme_stylebox_override("normal", normal)
|
||||
|
|
@ -797,6 +829,7 @@ func _apply_navigation_selection_presentation() -> void:
|
|||
_inventory_tab,
|
||||
_bag_tab,
|
||||
_logbook_tab,
|
||||
_mail_tab,
|
||||
]:
|
||||
if not bubble.button_pressed:
|
||||
continue
|
||||
|
|
@ -895,10 +928,16 @@ func _update_navigation_selection() -> void:
|
|||
_set_navigation_target(_current_section)
|
||||
|
||||
|
||||
func _on_mail_unread_count_changed(count: int) -> void:
|
||||
_mail_unread_badge.visible = count > 0
|
||||
_mail_unread_badge.text = "99+" if count > 99 else str(count)
|
||||
|
||||
|
||||
func _set_navigation_target(section: Section) -> void:
|
||||
_inventory_tab.button_pressed = section == Section.COOLER
|
||||
_bag_tab.button_pressed = section == Section.BAG
|
||||
_logbook_tab.button_pressed = section == Section.LOGBOOK
|
||||
_mail_tab.button_pressed = section == Section.MAIL
|
||||
|
||||
|
||||
func _update_shell_layout() -> void:
|
||||
|
|
@ -915,7 +954,7 @@ func _update_shell_layout() -> void:
|
|||
_content_shell.size = Vector2(612.0, 286.0) if compact else Vector2(1196.0, 478.0)
|
||||
_presentation_rest_position = _content_shell.position
|
||||
var navigation_size := (
|
||||
Vector2(620.0, 75.0) if compact else Vector2(620.0, 100.0)
|
||||
Vector2(720.0, 75.0) if compact else Vector2(720.0, 100.0)
|
||||
)
|
||||
_navigation_cluster.position = NAVIGATION_CANONICAL_POSITION
|
||||
_navigation_cluster.size = navigation_size
|
||||
|
|
@ -1084,6 +1123,9 @@ func _update_shell_layout() -> void:
|
|||
_logbook_page.size = reference_size
|
||||
_logbook_page.position = Vector2.ZERO
|
||||
_logbook_rest_position = Vector2.ZERO
|
||||
_mail_page.size = reference_size
|
||||
_mail_page.position = Vector2.ZERO
|
||||
_mail_rest_position = Vector2.ZERO
|
||||
_book_backing.position = (
|
||||
Vector2(14.0, 164.0) if compact else Vector2(58.0, 128.0)
|
||||
)
|
||||
|
|
@ -1144,9 +1186,11 @@ func _update_shell_layout() -> void:
|
|||
_cooler_page.position = _cooler_rest_position
|
||||
_bag_page.position = _bag_rest_position
|
||||
_logbook_page.position = _logbook_rest_position
|
||||
_mail_page.position = _mail_rest_position
|
||||
_cooler_page.modulate.a = 1.0
|
||||
_bag_page.modulate.a = 1.0
|
||||
_logbook_page.modulate.a = 1.0
|
||||
_mail_page.modulate.a = 1.0
|
||||
if not _page_transitioning:
|
||||
_content_stage.position = _content_rest_position
|
||||
_layout_cooler_fish(false)
|
||||
|
|
@ -1229,6 +1273,7 @@ func _begin_menu_entry() -> void:
|
|||
_cooler_page.position = _cooler_rest_position + Vector2.DOWN * start_offset
|
||||
_bag_page.position = _bag_rest_position + Vector2.DOWN * start_offset
|
||||
_logbook_page.position = _logbook_rest_position + Vector2.DOWN * start_offset
|
||||
_mail_page.position = _mail_rest_position + Vector2.DOWN * start_offset
|
||||
var navigation_rest: Vector2 = _navigation_cluster.position
|
||||
_navigation_cluster.position = navigation_rest + Vector2.DOWN * start_offset
|
||||
_presentation_tween = create_tween().set_parallel(true)
|
||||
|
|
@ -1256,6 +1301,12 @@ func _begin_menu_entry() -> void:
|
|||
_logbook_rest_position,
|
||||
MENU_ENTER_DURATION
|
||||
).set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_IN_OUT)
|
||||
_presentation_tween.tween_property(
|
||||
_mail_page,
|
||||
"position",
|
||||
_mail_rest_position,
|
||||
MENU_ENTER_DURATION
|
||||
).set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_IN_OUT)
|
||||
_presentation_tween.tween_property(
|
||||
_navigation_cluster,
|
||||
"position",
|
||||
|
|
@ -1316,6 +1367,12 @@ func _begin_menu_exit(reason: CloseReason, restore_controls: bool) -> void:
|
|||
-_logbook_page.size.y - TRANSITION_SAFE_MARGIN,
|
||||
MENU_EXIT_DURATION
|
||||
).set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_IN_OUT)
|
||||
_presentation_tween.tween_property(
|
||||
_mail_page,
|
||||
"position:y",
|
||||
-_mail_page.size.y - TRANSITION_SAFE_MARGIN,
|
||||
MENU_EXIT_DURATION
|
||||
).set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_IN_OUT)
|
||||
_presentation_tween.tween_property(
|
||||
_navigation_cluster,
|
||||
"position:y",
|
||||
|
|
@ -1377,8 +1434,10 @@ func _get_section_root(section: Section) -> Control:
|
|||
return _cooler_page
|
||||
Section.BAG:
|
||||
return _bag_page
|
||||
_:
|
||||
Section.LOGBOOK:
|
||||
return _logbook_page
|
||||
_:
|
||||
return _mail_page
|
||||
|
||||
|
||||
func _get_section_rest_position(section: Section) -> Vector2:
|
||||
|
|
@ -1387,8 +1446,10 @@ func _get_section_rest_position(section: Section) -> Vector2:
|
|||
return _cooler_rest_position
|
||||
Section.BAG:
|
||||
return _bag_rest_position
|
||||
_:
|
||||
Section.LOGBOOK:
|
||||
return _logbook_rest_position
|
||||
_:
|
||||
return _mail_rest_position
|
||||
|
||||
|
||||
func _begin_page_transition(section: Section) -> void:
|
||||
|
|
@ -1468,6 +1529,7 @@ func _set_shell_interactive(interactive: bool) -> void:
|
|||
_inventory_tab,
|
||||
_bag_tab,
|
||||
_logbook_tab,
|
||||
_mail_tab,
|
||||
_close_button,
|
||||
]:
|
||||
bubble.focus_mode = Control.FOCUS_ALL if interactive else Control.FOCUS_NONE
|
||||
|
|
@ -1499,6 +1561,9 @@ func _set_content_interactive(interactive: bool) -> void:
|
|||
if interactive and _current_section == Section.LOGBOOK
|
||||
else Control.MOUSE_FILTER_IGNORE
|
||||
)
|
||||
_mail_page.set_interactive(
|
||||
interactive and _current_section == Section.MAIL
|
||||
)
|
||||
var cooler_interactive: bool = (
|
||||
interactive and _current_section == Section.COOLER
|
||||
)
|
||||
|
|
@ -1569,7 +1634,9 @@ func _cancel_page_tween() -> void:
|
|||
|
||||
|
||||
func _reset_page_transition_visuals() -> void:
|
||||
for section: Section in [Section.COOLER, Section.BAG, Section.LOGBOOK]:
|
||||
for section: Section in [
|
||||
Section.COOLER, Section.BAG, Section.LOGBOOK, Section.MAIL,
|
||||
]:
|
||||
var page: Control = _get_section_root(section)
|
||||
page.position = _get_section_rest_position(section)
|
||||
page.modulate.a = 1.0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue