Compare commits
6 commits
2e2f8b47c0
...
b9e0233f25
| Author | SHA1 | Date | |
|---|---|---|---|
| b9e0233f25 | |||
| 991597ff21 | |||
| 11e4590d8e | |||
| 6a384d3052 | |||
| 58e4207cd5 | |||
| 63eb02eb27 |
7 changed files with 74 additions and 18 deletions
|
|
@ -10,3 +10,7 @@ var chatter: Chatter:
|
||||||
tui.populate_from_chatter(chatter)
|
tui.populate_from_chatter(chatter)
|
||||||
if not up: return
|
if not up: return
|
||||||
up.chatter = value
|
up.chatter = value
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
tui.extra_expanding.connect(func(x): if x: up.visible = false)
|
||||||
|
tui.extra_expanded.connect(func(x): if not x: up.visible = true)
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ const CHEVRONS = [
|
||||||
]
|
]
|
||||||
@export var expanded: bool = false
|
@export var expanded: bool = false
|
||||||
|
|
||||||
|
signal extra_expanding(is_expanding: bool)
|
||||||
signal extra_expanded(is_expanded: bool)
|
signal extra_expanded(is_expanded: bool)
|
||||||
|
|
||||||
var is_extra_panel_expanded: bool
|
var is_extra_panel_expanded: bool
|
||||||
|
|
@ -90,6 +91,7 @@ func toggle_extra_panel(val: bool) -> void:
|
||||||
tw_expand.kill()
|
tw_expand.kill()
|
||||||
%ExtraInfo.show()
|
%ExtraInfo.show()
|
||||||
tw_expand = create_tween()
|
tw_expand = create_tween()
|
||||||
|
tw_expand.tween_callback(extra_expanding.emit.bind(is_extra_panel_expanded))
|
||||||
tw_expand.set_ease(Tween.EASE_OUT)
|
tw_expand.set_ease(Tween.EASE_OUT)
|
||||||
tw_expand.set_trans(Tween.TRANS_CUBIC)
|
tw_expand.set_trans(Tween.TRANS_CUBIC)
|
||||||
tw_expand.tween_property(%ExtraInfo, ^"custom_minimum_size:x", min_size_x, 0.3)
|
tw_expand.tween_property(%ExtraInfo, ^"custom_minimum_size:x", min_size_x, 0.3)
|
||||||
|
|
|
||||||
|
|
@ -5,26 +5,19 @@ var chatter: Chatter
|
||||||
|
|
||||||
var tw_hidden: Tween
|
var tw_hidden: Tween
|
||||||
var is_expanded: bool = false
|
var is_expanded: bool = false
|
||||||
|
|
||||||
var scroll: ScrollContainer
|
|
||||||
var is_visible_in_scroll: bool:
|
|
||||||
get:
|
|
||||||
if not scroll: return false
|
|
||||||
return scroll.get_global_rect().intersects(get_global_rect())
|
|
||||||
var is_profile_picture_loaded: bool = false
|
var is_profile_picture_loaded: bool = false
|
||||||
|
|
||||||
signal user_selected(chatter: Chatter)
|
signal user_selected(chatter: Chatter)
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
scroll = get_parent().get_parent()
|
|
||||||
scroll.get_v_scroll_bar().scrolling.connect(check_update_profile_picture)
|
|
||||||
visibility_changed.connect(check_update_profile_picture)
|
|
||||||
update()
|
update()
|
||||||
toggle_buttons(false)
|
toggle_buttons(false)
|
||||||
Globals.live_streamers_updated.connect(func(): %LiveStatus.visible = chatter.twitch_id in Globals.live_streamers.keys())
|
Globals.live_streamers_updated.connect(func(): %LiveStatus.visible = chatter.twitch_id in Globals.live_streamers.keys())
|
||||||
await get_tree().process_frame
|
await get_tree().process_frame
|
||||||
check_update_profile_picture()
|
check_update_profile_picture()
|
||||||
|
%ScreenNotifer.rect = get_rect()
|
||||||
|
%ScreenNotifer.screen_entered.connect(check_update_profile_picture)
|
||||||
%User.pressed.connect(user_selected.emit.bind(chatter))
|
%User.pressed.connect(user_selected.emit.bind(chatter))
|
||||||
%Shoutout.pressed.connect(func(): Globals.twitcher.shoutout(chatter.user))
|
%Shoutout.pressed.connect(func(): Globals.twitcher.shoutout(chatter.user))
|
||||||
%Promote.pressed.connect(func(): Globals.twitcher.send_message(chatter.promo_msg))
|
%Promote.pressed.connect(func(): Globals.twitcher.send_message(chatter.promo_msg))
|
||||||
|
|
@ -60,7 +53,7 @@ func check_update_profile_picture() -> void:
|
||||||
if is_profile_picture_loaded: return
|
if is_profile_picture_loaded: return
|
||||||
if not chatter: return
|
if not chatter: return
|
||||||
await get_tree().process_frame
|
await get_tree().process_frame
|
||||||
if not is_visible_in_scroll: return
|
if not %ScreenNotifer.is_on_screen(): return
|
||||||
is_profile_picture_loaded = true
|
is_profile_picture_loaded = true
|
||||||
await update_profile_picture()
|
await update_profile_picture()
|
||||||
if not %AvatarImg.texture: is_profile_picture_loaded = false
|
if not %AvatarImg.texture: is_profile_picture_loaded = false
|
||||||
|
|
|
||||||
|
|
@ -134,3 +134,6 @@ theme_override_styles/normal = SubResource("StyleBoxFlat_ddi2y")
|
||||||
icon = ExtResource("7_k1oax")
|
icon = ExtResource("7_k1oax")
|
||||||
icon_alignment = 1
|
icon_alignment = 1
|
||||||
expand_icon = true
|
expand_icon = true
|
||||||
|
|
||||||
|
[node name="ScreenNotifer" type="VisibleOnScreenNotifier2D" parent="." unique_id=1597669003]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
|
|
||||||
|
|
@ -9,14 +9,20 @@ var filtering_live: bool = false:
|
||||||
set(value):
|
set(value):
|
||||||
filtering_live = value
|
filtering_live = value
|
||||||
if value:
|
if value:
|
||||||
filter_live_users()
|
filter_list()
|
||||||
else:
|
else:
|
||||||
reset_filter()
|
reset_filter()
|
||||||
|
|
||||||
|
var _filter_name: String = ""
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
%Filter.text_changed.connect(_update_filter_name)
|
||||||
%FilterLive.pressed.connect(func(): filtering_live = !filtering_live)
|
%FilterLive.pressed.connect(func(): filtering_live = !filtering_live)
|
||||||
|
|
||||||
|
func _update_filter_name(txt: String) -> void:
|
||||||
|
_filter_name = txt.to_lower()
|
||||||
|
filter_list()
|
||||||
|
|
||||||
func clear_list() -> void:
|
func clear_list() -> void:
|
||||||
for node in %UserList.get_children():
|
for node in %UserList.get_children():
|
||||||
|
|
@ -51,7 +57,10 @@ func reset_filter() -> void:
|
||||||
for entry: UserEntry in %UserList.get_children():
|
for entry: UserEntry in %UserList.get_children():
|
||||||
entry.visible = true
|
entry.visible = true
|
||||||
|
|
||||||
func filter_live_users() -> void:
|
func filter_list() -> void:
|
||||||
reset_filter()
|
reset_filter()
|
||||||
for entry: UserEntry in %UserList.get_children():
|
for entry: UserEntry in %UserList.get_children():
|
||||||
entry.visible = entry.chatter.twitch_id in Globals.live_streamers.keys()
|
if filtering_live:
|
||||||
|
entry.visible = entry.chatter.twitch_id in Globals.live_streamers.keys()
|
||||||
|
if _filter_name != "" and entry.visible:
|
||||||
|
entry.visible = entry.chatter.user.display_name.to_lower().contains(_filter_name)
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ func _setup_live_stream_timer() -> void:
|
||||||
_run_live_streamer_update()
|
_run_live_streamer_update()
|
||||||
|
|
||||||
_tmr_live_stream.start()
|
_tmr_live_stream.start()
|
||||||
|
get_indie_game_devs_members()
|
||||||
|
|
||||||
func _run_live_streamer_update() -> void:
|
func _run_live_streamer_update() -> void:
|
||||||
live_streamers_updating.emit()
|
live_streamers_updating.emit()
|
||||||
|
|
@ -141,3 +142,41 @@ func get_exception_points() -> PackedVector2Array:
|
||||||
|
|
||||||
func get_polygon_points() -> PackedVector2Array:
|
func get_polygon_points() -> PackedVector2Array:
|
||||||
return _hull_points
|
return _hull_points
|
||||||
|
|
||||||
|
func get_indie_game_devs_members() -> void:
|
||||||
|
var team = await twitcher.get_team_info("indiegamedevs")
|
||||||
|
var new_users: Array[TwitchUser]
|
||||||
|
if team:
|
||||||
|
var chatters: Array[Chatter] = []
|
||||||
|
chatters.assign(context.chatters.all())
|
||||||
|
var new_members: Array[TwitchTeam.Users] = []
|
||||||
|
print("Got team: ", team.team_name)
|
||||||
|
print("Member Count: ", team.users.size())
|
||||||
|
for team_member: TwitchTeam.Users in team.users:
|
||||||
|
if not chatters.any(func(x: Chatter): return x.twitch_id == team_member.user_id):
|
||||||
|
new_members.append(team_member)
|
||||||
|
|
||||||
|
if new_members.size() > 0:
|
||||||
|
var iter = 0
|
||||||
|
const MAX_ITER = 100
|
||||||
|
while not new_members.is_empty():
|
||||||
|
iter += 1
|
||||||
|
if iter > MAX_ITER:
|
||||||
|
return
|
||||||
|
|
||||||
|
var new_batch: Array[String] = []
|
||||||
|
new_batch.assign(new_members.slice(0,99).map(func(x): return x.user_id))
|
||||||
|
new_members.assign(new_members.slice(99))
|
||||||
|
var res = await twitcher.get_users_by_id(new_batch)
|
||||||
|
new_users.append_array(res)
|
||||||
|
print("Found: %d new members not in database" % new_users.size())
|
||||||
|
for user: TwitchUser in new_users:
|
||||||
|
var chatter = Chatter.new()
|
||||||
|
chatter.twitch_id = user.id
|
||||||
|
chatter.is_streamer = true
|
||||||
|
chatter.is_indie_game_dev = true
|
||||||
|
chatter.user = user
|
||||||
|
chatter.first_added = Time.get_unix_time_from_system()
|
||||||
|
chatter.first_seen = -1
|
||||||
|
chatter.last_seen = -1
|
||||||
|
context.chatters.append(chatter)
|
||||||
|
|
|
||||||
|
|
@ -308,6 +308,8 @@ func reply_message(message: String, msg_id: String, as_streamer: bool = false) -
|
||||||
func get_users_by_id(...user_ids: Array) -> Array[TwitchUser]:
|
func get_users_by_id(...user_ids: Array) -> Array[TwitchUser]:
|
||||||
var tusers: Array[TwitchUser] = []
|
var tusers: Array[TwitchUser] = []
|
||||||
var qusers: Array[String] = []
|
var qusers: Array[String] = []
|
||||||
|
if user_ids[0] is Array:
|
||||||
|
user_ids = user_ids[0]
|
||||||
for user_id in user_ids:
|
for user_id in user_ids:
|
||||||
if _cache_users.has(user_id):
|
if _cache_users.has(user_id):
|
||||||
tusers.append(_cache_users[user_id])
|
tusers.append(_cache_users[user_id])
|
||||||
|
|
@ -521,15 +523,19 @@ func get_live_streamers_data(user_ids: Array = []) -> Dictionary[String, TwitchS
|
||||||
user_ids = user_ids.slice(99)
|
user_ids = user_ids.slice(99)
|
||||||
opt.user_id = new_batch
|
opt.user_id = new_batch
|
||||||
var streams_iterator := await api.get_streams(opt)
|
var streams_iterator := await api.get_streams(opt)
|
||||||
print("Fetching live...")
|
|
||||||
for stream_promise in streams_iterator:
|
for stream_promise in streams_iterator:
|
||||||
var stream_data: TwitchStream = await stream_promise
|
var stream_data: TwitchStream = await stream_promise
|
||||||
if stream_data:
|
if stream_data:
|
||||||
print("%s(%s) is live" % [stream_data.user_name, stream_data.user_id])
|
|
||||||
streams_data[stream_data.user_id] = stream_data
|
streams_data[stream_data.user_id] = stream_data
|
||||||
else:
|
|
||||||
print("WTF!!!! Iter is null?")
|
|
||||||
print("Fetching is done.")
|
|
||||||
_is_processing_streams = false
|
_is_processing_streams = false
|
||||||
return streams_data
|
return streams_data
|
||||||
|
|
||||||
|
func get_team_info(team_name: String) -> TwitchTeam:
|
||||||
|
var opt := TwitchGetTeams.Opt.new()
|
||||||
|
opt.name = team_name
|
||||||
|
var team_resp := await api.get_teams(opt)
|
||||||
|
if team_resp and team_resp.data.size() > 0:
|
||||||
|
return team_resp.data[0]
|
||||||
|
else:
|
||||||
|
return null
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue