Updated Globals
Added signals for when we are updating live streamers, and when they have been updated. Added setter for twitcher, adding a streamer_token_validated signal connect to handle setting up live streamers fetch.
This commit is contained in:
parent
c0f0e2f513
commit
55faa9e6d3
1 changed files with 36 additions and 1 deletions
|
|
@ -1,14 +1,30 @@
|
||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
var twitcher: TwitcherExtended
|
#region Signals
|
||||||
|
signal live_streamers_updating
|
||||||
|
signal live_streamers_updated
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Public Variables
|
||||||
|
var twitcher: TwitcherExtended:
|
||||||
|
set(val):
|
||||||
|
twitcher = val
|
||||||
|
twitcher.streamer_token_validated.connect(_setup_live_stream_timer)
|
||||||
|
|
||||||
var context: OverlayContext
|
var context: OverlayContext
|
||||||
var settings: OverlaySettings
|
var settings: OverlaySettings
|
||||||
var main_win: OverlayWindow
|
var main_win: OverlayWindow
|
||||||
|
var live_streamers: Dictionary[String, TwitchStream] = {}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Private Variables
|
||||||
var _pt_except: Array[Control] = []
|
var _pt_except: Array[Control] = []
|
||||||
var _pt_mouse: bool = false
|
var _pt_mouse: bool = false
|
||||||
var _current_pt_mask: PackedVector2Array = []
|
var _current_pt_mask: PackedVector2Array = []
|
||||||
var _hull_points: PackedVector2Array = []
|
var _hull_points: PackedVector2Array = []
|
||||||
var _debug_draw: DebugDraw
|
var _debug_draw: DebugDraw
|
||||||
|
var _tmr_live_stream: Timer
|
||||||
|
#endregion
|
||||||
|
|
||||||
# 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:
|
||||||
|
|
@ -38,6 +54,25 @@ func _input(_event: InputEvent) -> void:
|
||||||
_debug_draw = DebugDraw.new()
|
_debug_draw = DebugDraw.new()
|
||||||
add_child(_debug_draw)
|
add_child(_debug_draw)
|
||||||
|
|
||||||
|
func _setup_live_stream_timer() -> void:
|
||||||
|
if _tmr_live_stream:
|
||||||
|
return
|
||||||
|
_tmr_live_stream = Timer.new()
|
||||||
|
_tmr_live_stream.name = "TimerLiveStreamCheck"
|
||||||
|
_tmr_live_stream.wait_time = 240
|
||||||
|
_tmr_live_stream.one_shot = false
|
||||||
|
_tmr_live_stream.timeout.connect(_run_live_streamer_update)
|
||||||
|
add_child(_tmr_live_stream)
|
||||||
|
|
||||||
|
_run_live_streamer_update()
|
||||||
|
|
||||||
|
_tmr_live_stream.start()
|
||||||
|
|
||||||
|
func _run_live_streamer_update() -> void:
|
||||||
|
live_streamers_updating.emit()
|
||||||
|
live_streamers = await twitcher.get_live_streamers_data()
|
||||||
|
live_streamers_updated.emit()
|
||||||
|
|
||||||
func save_settings() -> void:
|
func save_settings() -> void:
|
||||||
ResourceSaver.save(settings, "user://settings.tres")
|
ResourceSaver.save(settings, "user://settings.tres")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue