Created Shoutout Alert
Created Visual alert for when a shoutout occurs.
This commit is contained in:
parent
3d2514b517
commit
2921de8d81
3 changed files with 183 additions and 0 deletions
40
UI/Shoutouts/shoutout.gd
Normal file
40
UI/Shoutouts/shoutout.gd
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
extends Alert
|
||||
|
||||
var chatter: Chatter
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
var rs := get_tree().root.size
|
||||
position = Vector2(rs.x + 20, ((rs.y / 2.0) - (size.y / 2.0)))
|
||||
|
||||
if chatter == null:
|
||||
return
|
||||
|
||||
var game_id: String = ""
|
||||
|
||||
if chatter.twitch_id in Globals.live_streamers.keys():
|
||||
game_id = Globals.live_streamers[chatter.twitch_id].game_id
|
||||
else:
|
||||
var resp := await Globals.twitcher.get_channel_information(chatter.twitch_id)
|
||||
if resp:
|
||||
var tci: TwitchChannelInformation = resp[chatter.twitch_id]
|
||||
game_id = tci.game_id
|
||||
|
||||
var gresp := await Globals.twitcher.get_games(game_id)
|
||||
var gd: TwitchGame
|
||||
if gresp:
|
||||
gd = gresp[game_id]
|
||||
|
||||
%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")
|
||||
%DisplayName.text = chatter.user.display_name
|
||||
%Message.text = Globals.settings.shoutout_alert_message.format({"target": chatter.user.display_name})
|
||||
%GameBox.texture = await ImageLoader.load_image(gd.box_art_url.format({"width": 600, "height": 800}))
|
||||
%GameName.text = gd.name
|
||||
|
||||
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)
|
||||
1
UI/Shoutouts/shoutout.gd.uid
Normal file
1
UI/Shoutouts/shoutout.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dssttgp6c8im7
|
||||
142
UI/Shoutouts/shoutout.tscn
Normal file
142
UI/Shoutouts/shoutout.tscn
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
[gd_scene format=3 uid="uid://bhu2yvyvynwrp"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bu2juj2beyws7" path="res://assets/twitch_user_profile_pic.png" id="1_r3ok5"]
|
||||
[ext_resource type="Script" uid="uid://dssttgp6c8im7" path="res://UI/Shoutouts/shoutout.gd" id="1_rllid"]
|
||||
[ext_resource type="FontFile" uid="uid://c30qqiv6sqheh" path="res://assets/fonts/rage.woff2" id="2_r3ok5"]
|
||||
[ext_resource type="FontFile" uid="uid://bh2gj03hg6v4r" path="res://assets/neon-wave-theme/polentical_neon/Polentical Neon Regular.ttf" id="3_up83n"]
|
||||
[ext_resource type="FontFile" uid="uid://cx1a4aqqxhsrn" path="res://assets/neon-wave-theme/polentical_neon/Polentical Neon Italic.ttf" id="4_e62tt"]
|
||||
[ext_resource type="Texture2D" uid="uid://cgglsphc6nng8" path="res://assets/sci_and_tech.png" id="4_y3o12"]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_e62tt"]
|
||||
font = ExtResource("2_r3ok5")
|
||||
font_size = 36
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_y3o12"]
|
||||
font = ExtResource("3_up83n")
|
||||
font_size = 22
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_rllid"]
|
||||
font = ExtResource("4_e62tt")
|
||||
font_size = 20
|
||||
font_color = Color(0, 1, 0.99215686, 1)
|
||||
outline_size = 2
|
||||
shadow_size = 4
|
||||
shadow_color = Color(0, 0, 0, 0.9098039)
|
||||
shadow_offset = Vector2(2, 2)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_uldix"]
|
||||
font_size = 42
|
||||
outline_size = 2
|
||||
outline_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Shoutout" type="Control" unique_id=1922745758]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_right = 400.0
|
||||
offset_bottom = 762.0
|
||||
script = ExtResource("1_rllid")
|
||||
|
||||
[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="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_r3ok5")
|
||||
expand_mode = 1
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="DisplayName" 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
|
||||
|
||||
[node name="Spacer2" type="Control" parent="PanelContainer/Content" unique_id=1900817494]
|
||||
custom_minimum_size = Vector2(0, 40)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Message" type="Label" parent="PanelContainer/Content" unique_id=2061407605]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "$target is an amazing streamer. Go give them a follow!"
|
||||
label_settings = SubResource("LabelSettings_y3o12")
|
||||
horizontal_alignment = 1
|
||||
autowrap_mode = 2
|
||||
|
||||
[node name="Spacer3" type="Control" parent="PanelContainer/Content" unique_id=822690056]
|
||||
custom_minimum_size = Vector2(0, 40)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="PanelContainer2" type="PanelContainer" parent="PanelContainer/Content" unique_id=1907563848]
|
||||
clip_children = 2
|
||||
clip_contents = true
|
||||
custom_minimum_size = Vector2(0, 220)
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"ShoutoutBottomPanel"
|
||||
|
||||
[node name="GameBox" type="TextureRect" parent="PanelContainer/Content/PanelContainer2" unique_id=1272416027]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
texture = ExtResource("4_y3o12")
|
||||
expand_mode = 3
|
||||
stretch_mode = 6
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="PanelContainer/Content/PanelContainer2" unique_id=1907105503]
|
||||
layout_mode = 2
|
||||
color = Color(0.08235294, 0.08235294, 0.08235294, 0.627451)
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="PanelContainer/Content/PanelContainer2" unique_id=598512574]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/Content/PanelContainer2/CenterContainer" unique_id=1410695648]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="PanelContainer/Content/PanelContainer2/CenterContainer/VBoxContainer" unique_id=704682239]
|
||||
layout_mode = 2
|
||||
text = "LAST SEEN STREAMING"
|
||||
label_settings = SubResource("LabelSettings_rllid")
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="GameName" type="Label" parent="PanelContainer/Content/PanelContainer2/CenterContainer/VBoxContainer" unique_id=769516218]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
text = "Science & Technology"
|
||||
label_settings = SubResource("LabelSettings_uldix")
|
||||
horizontal_alignment = 1
|
||||
autowrap_mode = 2
|
||||
Loading…
Add table
Add a link
Reference in a new issue