void Start()
{
connect = GetComponent<Button>();
connect.onClick.AddListener(() =>
{
string IP = GameObject.FindGameObjectWithTag("ConnectToIP").GetComponent<Text>().text;
string name = GameObject.FindGameObjectWithTag("ConnectToName").GetComponent<Text>().text;
if (IP != "" && name != "") {
UDPSend2 script = GameObject.FindObjectOfType(typeof(UDPSend2)) as UDPSend2;
script.init(IP, name);
}
else
{
print(IP);
print(name);
GameObject.FindGameObjectWithTag("ButtonText").GetComponent<Text>().text = "Please fill both fields";
}
}
);
}
/// <summary> /// permet de se connecter a Deezer, retourne true si la connection reussi et /// false sinon /// </summary> /// <returns></returns> public override bool Connect() { var connectConfig = new ConnectConfig() { ccAppId = "180202", product_id = "DeezerWrapper", product_build_id = "00001", ccUserProfilePath = GetDeezerTempFolder(), ccConnectEventCb = OnConnect }; var connect = new Connect(connectConfig); connect.Start(); connect.SetAccessToken("fr49mph7tV4KY3ukISkFHQysRpdCEbzb958dB320pM15OpFsQs"); connect.ConnectOfflineMode(); m_player = new Player(connect, null); m_player.SongChanged += Player_SongChanged; m_player.Start(OnPlayerEvent); return(true); }