Created UserPromo control
This control handles local settings for user, such as marking a user as a streamer, etc etc.
This commit is contained in:
parent
a138ef7a0b
commit
d1f7bccd15
3 changed files with 221 additions and 0 deletions
65
UI/Controls/user_promo.gd
Normal file
65
UI/Controls/user_promo.gd
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
extends PanelContainer
|
||||
|
||||
var chatter: Chatter:
|
||||
set(value):
|
||||
chatter = value
|
||||
if not chatter:
|
||||
_clear_promos()
|
||||
return
|
||||
_populate_promos()
|
||||
|
||||
func _ready() -> void:
|
||||
for btn in [%Streamer, %Shoutout, %Promote]:
|
||||
btn.pressed.connect(_update_promos)
|
||||
for le in [%YouTubeHandle, %BlueSkyHandle, %WebSite, %ShoutoutMessage, %PromotionMessage]:
|
||||
le.text_changed.connect(_update_promos)
|
||||
if not chatter: return
|
||||
_populate_promos()
|
||||
|
||||
func _clear_promos() -> void:
|
||||
%Streamer.button_pressed = false
|
||||
%Shoutout.button_pressed = false
|
||||
%Promote.button_pressed = false
|
||||
%YouTubeHandle.text = ""
|
||||
%BlueSkyHandle.text = ""
|
||||
%WebSite.text = ""
|
||||
%ShoutoutMessage.text = ""
|
||||
%PromotionMessage.text = ""
|
||||
|
||||
func _populate_promos() -> void:
|
||||
%Streamer.button_pressed = chatter.is_streamer
|
||||
%Shoutout.button_pressed = chatter.auto_shoutout
|
||||
%Promote.button_pressed = chatter.extra_data.has("auto-promo")
|
||||
%YouTubeHandle.text = chatter.urls.youtube if chatter.urls.has("youtube") else ""
|
||||
%BlueSkyHandle.text = chatter.urls.bluesky if chatter.urls.has("bluesky") else ""
|
||||
%WebSite.text = chatter.urls.website if chatter.urls.has("website") else ""
|
||||
%ShoutoutMessage.text = chatter.extra_data.shoutout_message if chatter.extra_data.has("shoutout_message") else ""
|
||||
%PromotionMessage.text = chatter.extra_data.promotion_message if chatter.extra_data.has("promotion_message") else ""
|
||||
|
||||
func _update_promos() -> void:
|
||||
if not chatter: return
|
||||
chatter.is_streamer = %Streamer.button_pressed
|
||||
chatter.auto_shoutout = %Shoutout.button_pressed
|
||||
chatter.extra_data["auto_promo"] = %Promote.button_pressed
|
||||
if %YouTubeHandle.text != "":
|
||||
chatter.urls["youtube"] = %YouTubeHandle.text
|
||||
else:
|
||||
chatter.urls.erase("youtube")
|
||||
if %BlueSkyHandle.text != "":
|
||||
chatter.urls["bluesky"] = %BlueSkyHandle.text
|
||||
else:
|
||||
chatter.urls.erase("bluesky")
|
||||
if %WebSite.text != "":
|
||||
chatter.urls["website"] = %WebSite.text
|
||||
else:
|
||||
chatter.urls.erase("website")
|
||||
if %ShoutoutMessage.text != "":
|
||||
chatter.extra_data.shoutout_message = %ShoutoutMessage.text
|
||||
else:
|
||||
chatter.extra_data.erase("shoutout_message")
|
||||
if %PromotionMessage.text != "":
|
||||
chatter.extra_data.promotion_message = %PromotionMessage.text
|
||||
else:
|
||||
chatter.extra_data.erase("promotion_message")
|
||||
|
||||
chatter.save()
|
||||
1
UI/Controls/user_promo.gd.uid
Normal file
1
UI/Controls/user_promo.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://8frnm7cda0ht
|
||||
155
UI/Controls/user_promo.tscn
Normal file
155
UI/Controls/user_promo.tscn
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
[gd_scene format=3 uid="uid://cadil3rnqh61e"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://8frnm7cda0ht" path="res://UI/Controls/user_promo.gd" id="1_jcejw"]
|
||||
[ext_resource type="Texture2D" uid="uid://cup1m40podywb" path="res://UI/assets/bootstrap/megaphone-fill.svg" id="1_nwev1"]
|
||||
[ext_resource type="Texture2D" uid="uid://dp06rjedx170o" path="res://UI/assets/bootstrap/globe2.svg" id="2_jcejw"]
|
||||
|
||||
[node name="UserPromo" type="PanelContainer" unique_id=1364169576]
|
||||
offset_right = 406.0
|
||||
offset_bottom = 136.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource("1_jcejw")
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="." unique_id=1229873159]
|
||||
layout_mode = 2
|
||||
horizontal_scroll_mode = 0
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="ScrollContainer" unique_id=120163548]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="ScrollContainer/VBoxContainer" unique_id=98113976]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Streamer" type="CheckButton" parent="ScrollContainer/VBoxContainer/HBoxContainer" unique_id=737955603]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Streamer"
|
||||
|
||||
[node name="Shoutout" type="CheckButton" parent="ScrollContainer/VBoxContainer/HBoxContainer" unique_id=378103028]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Shoutout"
|
||||
|
||||
[node name="Promote" type="CheckButton" parent="ScrollContainer/VBoxContainer/HBoxContainer" unique_id=929607483]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Auto-Promote"
|
||||
|
||||
[node name="WorksWith" type="HBoxContainer" parent="ScrollContainer/VBoxContainer" unique_id=1239050314]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label" type="Label" parent="ScrollContainer/VBoxContainer/WorksWith" unique_id=400379538]
|
||||
custom_minimum_size = Vector2(100, 0)
|
||||
layout_mode = 2
|
||||
text = "Works with"
|
||||
|
||||
[node name="OptionButton" type="OptionButton" parent="ScrollContainer/VBoxContainer/WorksWith" unique_id=1872170308]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="YouTube" type="HBoxContainer" parent="ScrollContainer/VBoxContainer" unique_id=1207903264]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label" type="Label" parent="ScrollContainer/VBoxContainer/YouTube" unique_id=1593070954]
|
||||
custom_minimum_size = Vector2(100, 0)
|
||||
layout_mode = 2
|
||||
text = "YouTube"
|
||||
|
||||
[node name="YtPromo" type="Button" parent="ScrollContainer/VBoxContainer/YouTube" unique_id=1096467567]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(24, 24)
|
||||
layout_mode = 2
|
||||
icon = ExtResource("1_nwev1")
|
||||
icon_alignment = 1
|
||||
expand_icon = true
|
||||
|
||||
[node name="YtLink" type="Button" parent="ScrollContainer/VBoxContainer/YouTube" unique_id=50317293]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(24, 24)
|
||||
layout_mode = 2
|
||||
icon = ExtResource("2_jcejw")
|
||||
icon_alignment = 1
|
||||
expand_icon = true
|
||||
|
||||
[node name="YouTubeHandle" type="LineEdit" parent="ScrollContainer/VBoxContainer/YouTube" unique_id=603065520]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
placeholder_text = "YouTube @handle"
|
||||
|
||||
[node name="BlueSky" type="HBoxContainer" parent="ScrollContainer/VBoxContainer" unique_id=1489223257]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label" type="Label" parent="ScrollContainer/VBoxContainer/BlueSky" unique_id=381069814]
|
||||
custom_minimum_size = Vector2(100, 0)
|
||||
layout_mode = 2
|
||||
text = "Bluesky"
|
||||
|
||||
[node name="BsPromo" type="Button" parent="ScrollContainer/VBoxContainer/BlueSky" unique_id=658543783]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(24, 24)
|
||||
layout_mode = 2
|
||||
icon = ExtResource("1_nwev1")
|
||||
icon_alignment = 1
|
||||
expand_icon = true
|
||||
|
||||
[node name="BsLink" type="Button" parent="ScrollContainer/VBoxContainer/BlueSky" unique_id=1961953027]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(24, 24)
|
||||
layout_mode = 2
|
||||
icon = ExtResource("2_jcejw")
|
||||
icon_alignment = 1
|
||||
expand_icon = true
|
||||
|
||||
[node name="BlueSkyHandle" type="LineEdit" parent="ScrollContainer/VBoxContainer/BlueSky" unique_id=360439078]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
placeholder_text = "b.sky @handle"
|
||||
|
||||
[node name="WebSite" type="HBoxContainer" parent="ScrollContainer/VBoxContainer" unique_id=573488452]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label" type="Label" parent="ScrollContainer/VBoxContainer/WebSite" unique_id=1373223946]
|
||||
custom_minimum_size = Vector2(100, 0)
|
||||
layout_mode = 2
|
||||
text = "Website"
|
||||
|
||||
[node name="WsPromo" type="Button" parent="ScrollContainer/VBoxContainer/WebSite" unique_id=973904899]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(24, 24)
|
||||
layout_mode = 2
|
||||
icon = ExtResource("1_nwev1")
|
||||
icon_alignment = 1
|
||||
expand_icon = true
|
||||
|
||||
[node name="WsLink" type="Button" parent="ScrollContainer/VBoxContainer/WebSite" unique_id=666822841]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(24, 24)
|
||||
layout_mode = 2
|
||||
icon = ExtResource("2_jcejw")
|
||||
icon_alignment = 1
|
||||
expand_icon = true
|
||||
|
||||
[node name="WebSite" type="LineEdit" parent="ScrollContainer/VBoxContainer/WebSite" unique_id=1937578185]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
placeholder_text = "https://"
|
||||
|
||||
[node name="ShoutoutMessage" type="LineEdit" parent="ScrollContainer/VBoxContainer" unique_id=1766315801]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
placeholder_text = "shoutout message"
|
||||
|
||||
[node name="PromotionMessage" type="LineEdit" parent="ScrollContainer/VBoxContainer" unique_id=1002295180]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
placeholder_text = "promotion message"
|
||||
Loading…
Add table
Add a link
Reference in a new issue