Register CB Handler...
 
Notifications
Clear all

Register CB Handlers in Javascript

3 Posts
2 Users
0 Reactions
840 Views
(@maroku)
Posts: 7
Active Member
Topic starter
 

Using combu with Javascript works fine at the moment but i have a little problem now.
I am not able to register CB handlers with Javascript because i dont know how to.

i would like if i use (CBManager.instance.Login) that this calls the function OnUserLogin after succesfull login.

Is it even possible in Javascript?
if yes, how i would do it?

PS: I use Unity

 
Posted : 07/05/2013 5:09 pm
(@skaredcreations)
Posts: 805
Prominent Member Admin
 

Here is an example of delegates usage in UnityScript:

#pragma strict

function Start () {
	var cbManager : CBManager = FindObjectOfType(CBManager);
	cbManager.OnLogin = OnUserLogin;
	cbManager.Login("my_username", "my_password");
}

function OnUserLogin (user : CBUser, error : String) {
	if (user)
		print("User logged in: " + user.username);
	else
		print("Login failed");
}

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 07/05/2013 6:30 pm
(@maroku)
Posts: 7
Active Member
Topic starter
 

Thank you it works!

PS: sorry for the e-mail with the same question. i will use the forum if i have any questions for now.

 
Posted : 07/05/2013 6:48 pm
Share: