|
@@ -12,9 +12,9 @@ class Login extends PIXI.Container{
|
|
super();
|
|
super();
|
|
let {GameLayer, Gui} = props;
|
|
let {GameLayer, Gui} = props;
|
|
|
|
|
|
- let email = new TextInput({GameLayer, width: 200});
|
|
|
|
|
|
+ let email = new TextInput({GameLayer, width: 250});
|
|
this.addChild(email);
|
|
this.addChild(email);
|
|
- let password = new TextInput({GameLayer, width: 200});
|
|
|
|
|
|
+ let password = new TextInput({GameLayer, width: 250});
|
|
this.addChild(password);
|
|
this.addChild(password);
|
|
|
|
|
|
let emailText = new Text({GameLayer, width: 200});
|
|
let emailText = new Text({GameLayer, width: 200});
|
|
@@ -38,10 +38,13 @@ class Login extends PIXI.Container{
|
|
password.position.set (0,0);
|
|
password.position.set (0,0);
|
|
loginBtn.position.set (0, 100);
|
|
loginBtn.position.set (0, 100);
|
|
|
|
|
|
|
|
+ email.setText(UserService.username || '');
|
|
|
|
+
|
|
// Events
|
|
// Events
|
|
this.email = email;
|
|
this.email = email;
|
|
this.password = password;
|
|
this.password = password;
|
|
loginBtn.onClick((e) => this.login(e));
|
|
loginBtn.onClick((e) => this.login(e));
|
|
|
|
+ this.onLogin(() => alert("Logged in succesfully ! ! !"));
|
|
}
|
|
}
|
|
|
|
|
|
login() {
|
|
login() {
|
|
@@ -51,7 +54,8 @@ class Login extends PIXI.Container{
|
|
// UserService Singleton to be called
|
|
// UserService Singleton to be called
|
|
UserService.login(e,p)
|
|
UserService.login(e,p)
|
|
.then((data) => {
|
|
.then((data) => {
|
|
- console.log(data.body());
|
|
|
|
|
|
+ console.log(data);
|
|
|
|
+ this._onLogin();
|
|
return true;
|
|
return true;
|
|
})
|
|
})
|
|
.catch((err) => {
|
|
.catch((err) => {
|
|
@@ -59,6 +63,14 @@ class Login extends PIXI.Container{
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ _onLogin() {
|
|
|
|
+ this._onLoginFn();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ onLogin(fn) {
|
|
|
|
+ this._onLoginFn = fn;
|
|
|
|
+ }
|
|
|
|
+
|
|
_kill = () => {
|
|
_kill = () => {
|
|
|
|
|
|
}
|
|
}
|