70 lines
1.2 KiB
GDScript
70 lines
1.2 KiB
GDScript
extends Node2D
|
|
|
|
var channelName = "sirenevibesperspektivnyak"
|
|
var numOfChoices:int = 3
|
|
var isConnected: = false
|
|
var timeToVote = 40
|
|
|
|
|
|
var nick = "justinfan1234567000"
|
|
var client_id = ""
|
|
var oauth = "oauth:"
|
|
|
|
var voted_users = []
|
|
var votes = {1:0, 2:0, 3:0}
|
|
|
|
onready var twicil = get_node("TwiCIL")
|
|
|
|
func _ready():
|
|
OS.set_window_fullscreen(false);
|
|
OS.set_borderless_window(false);
|
|
OS.set_window_size(Vector2(1200, 720));
|
|
$ChoiceNumberBox.value = numOfChoices
|
|
$ChannelNameBox.text = channelName
|
|
|
|
func ConnectToChannel():
|
|
return ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func StartTimer():
|
|
pass
|
|
|
|
func VoteCalc():
|
|
pass
|
|
|
|
func _on_message_recieved(user_name:String, text:String, _emotes)->void :
|
|
print("received text=" + text)
|
|
|
|
|
|
var index = int(text)
|
|
if index == 1 or index == 2 or index == 3:
|
|
votes[index] += 1
|
|
voted_users.push_back(user_name)
|
|
print("votes1=" + str(votes[1]))
|
|
|
|
|
|
|
|
func _on_Exit_pressed():
|
|
get_tree().quit();
|
|
|
|
|
|
func _on_SendNum_pressed():
|
|
$Poll.Init($ChoiceNumberBox.value)
|
|
|
|
|
|
|
|
func _on_Connect_pressed():
|
|
channelName = $ChannelNameBox.text
|
|
ConnectToChannel()
|
|
|
|
|
|
func _on_Button_pressed():
|
|
$Poll._on_message_recieved($nick.text, $text.text);
|
|
|
|
|
|
func _on_SendNum2_pressed():
|
|
$Poll.Disconnect();
|