diff --git a/UI/Shoutouts/promote.gd b/UI/Shoutouts/promote.gd new file mode 100644 index 00000000..4db2f3f2 --- /dev/null +++ b/UI/Shoutouts/promote.gd @@ -0,0 +1,51 @@ +extends Alert + +var chatter: Chatter +var itch: ItchIOAppData +var steam: SteamAppData + +var _updating_size: bool = false + +func _ready() -> void: + get_child(0).item_rect_changed.connect(func(): + if _updating_size: + return + _updating_size = true + size = get_child(0).size + get_child(0).position = Vector2.ZERO + _updating_size = false + ) + var rs := get_tree().root.size + position = Vector2(rs.x + 1000, ((rs.y / 2.0) - (size.y / 2.0))) + if not ((chatter and itch) or (chatter and steam)): + push_error("No chatter or game data set!") + await get_tree().create_timer(1.0).timeout + queue_free() + return + + %AvatarImg.texture = await ImageLoader.load_image(chatter.user.profile_image_url) + if %AvatarImg.texture == null: + %AvatarImg.texture = preload("res://assets/twitch_user_profile_pic.png") + + if itch: + _populate_itch() + else: + _populate_steam() + + await get_tree().process_frame + position = Vector2(rs.x + 20, ((rs.y / 2.0) - (size.y / 2.0))) + var tw := create_tween() + tw.tween_property(self, ^"position:x", rs.x - size.x - 20, 0.6) + tw.tween_interval(8) + tw.tween_property(self, ^"position:x", rs.x + 20, 0.6) + tw.tween_callback(self.queue_free) + +func _populate_itch() -> void: + %GameName.text = itch.title + %Description.text = itch.description + %GameBox.texture = await ImageLoader.load_image(itch.screenshots_thumbnails[0]) + +func _populate_steam() -> void: + %GameName.text = steam.name + %Description.text = steam.short_description + %GameBox.texture = await ImageLoader.load_image(steam.screenshots_thumbs[0]) \ No newline at end of file diff --git a/UI/Shoutouts/promote.gd.uid b/UI/Shoutouts/promote.gd.uid new file mode 100644 index 00000000..06ac8d38 --- /dev/null +++ b/UI/Shoutouts/promote.gd.uid @@ -0,0 +1 @@ +uid://dtgr8wqyjgegk diff --git a/UI/Shoutouts/promote.tscn b/UI/Shoutouts/promote.tscn new file mode 100644 index 00000000..786386ba --- /dev/null +++ b/UI/Shoutouts/promote.tscn @@ -0,0 +1,105 @@ +[gd_scene format=3 uid="uid://ce6yiwucniipu"] + +[ext_resource type="Texture2D" uid="uid://bu2juj2beyws7" path="res://assets/twitch_user_profile_pic.png" id="1_euwl6"] +[ext_resource type="Script" uid="uid://dtgr8wqyjgegk" path="res://UI/Shoutouts/promote.gd" id="1_m1b6q"] +[ext_resource type="FontFile" uid="uid://bh2gj03hg6v4r" path="res://assets/neon-wave-theme/polentical_neon/Polentical Neon Regular.ttf" id="3_4ipsx"] +[ext_resource type="Texture2D" uid="uid://cgglsphc6nng8" path="res://assets/sci_and_tech.png" id="4_pf7na"] + +[sub_resource type="LabelSettings" id="LabelSettings_e62tt"] +font_size = 36 + +[sub_resource type="LabelSettings" id="LabelSettings_y3o12"] +font = ExtResource("3_4ipsx") +font_size = 22 + +[node name="Promote" type="Control" unique_id=1922745758] +layout_mode = 3 +anchors_preset = 0 +offset_right = 400.0 +offset_bottom = 762.0 +script = ExtResource("1_m1b6q") + +[node name="PanelContainer" type="PanelContainer" parent="." unique_id=960598152] +clip_contents = true +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_type_variation = &"ShoutoutPanel" + +[node name="BG" type="VBoxContainer" parent="PanelContainer" unique_id=782434052] +layout_mode = 2 + +[node name="PanelContainer" type="PanelContainer" parent="PanelContainer/BG" unique_id=1179407509] +clip_contents = true +custom_minimum_size = Vector2(0, 220) +layout_mode = 2 +theme_type_variation = &"ShoutoutInnerPanel" + +[node name="PanelContainer2" type="PanelContainer" parent="PanelContainer/BG" unique_id=1907563848] +clip_children = 2 +clip_contents = true +custom_minimum_size = Vector2(0, 220) +layout_mode = 2 +size_flags_vertical = 3 +theme_type_variation = &"ShoutoutBottomPanel" + +[node name="GameBox" type="TextureRect" parent="PanelContainer/BG/PanelContainer2" unique_id=1272416027] +unique_name_in_owner = true +layout_mode = 2 +texture = ExtResource("4_pf7na") +expand_mode = 5 +stretch_mode = 6 + +[node name="ColorRect" type="ColorRect" parent="PanelContainer/BG/PanelContainer2" unique_id=1907105503] +layout_mode = 2 +color = Color(0.08235294, 0.08235294, 0.08235294, 0.627451) + +[node name="Content" type="VBoxContainer" parent="PanelContainer" unique_id=1609672363] +layout_mode = 2 + +[node name="Spacer" type="Control" parent="PanelContainer/Content" unique_id=1977205347] +custom_minimum_size = Vector2(0, 40) +layout_mode = 2 + +[node name="CenterContainer" type="CenterContainer" parent="PanelContainer/Content" unique_id=984731185] +layout_mode = 2 + +[node name="Portrait" type="PanelContainer" parent="PanelContainer/Content/CenterContainer" unique_id=927266204] +clip_children = 2 +clip_contents = true +layout_mode = 2 +theme_type_variation = &"PortraitBorder" + +[node name="AvatarImg" type="TextureRect" parent="PanelContainer/Content/CenterContainer/Portrait" unique_id=111606262] +unique_name_in_owner = true +custom_minimum_size = Vector2(250, 250) +layout_mode = 2 +texture = ExtResource("1_euwl6") +expand_mode = 1 +stretch_mode = 5 + +[node name="GameName" type="Label" parent="PanelContainer/Content" unique_id=1516712667] +unique_name_in_owner = true +layout_mode = 2 +text = "jevinscherriesgamedev" +label_settings = SubResource("LabelSettings_e62tt") +horizontal_alignment = 1 +autowrap_mode = 2 + +[node name="Spacer2" type="Control" parent="PanelContainer/Content" unique_id=1900817494] +custom_minimum_size = Vector2(0, 40) +layout_mode = 2 + +[node name="Description" type="Label" parent="PanelContainer/Content" unique_id=2061407605] +unique_name_in_owner = true +layout_mode = 2 +size_flags_vertical = 3 +text = "$target is an amazing streamer. Go give them a follow!" +label_settings = SubResource("LabelSettings_y3o12") +horizontal_alignment = 1 +autowrap_mode = 2 +clip_text = true +text_overrun_behavior = 2