Notifications
Clear all

2 users at a time.

13 Posts
2 Users
0 Reactions
1,086 Views
(@megaman)
Posts: 34
Trusted Member
Topic starter
 

This is Konst from Unity forum, i am again with same question.

What i would like is accomplish is to make user1 auto logout and back to login scene if a new user2 logged with same name and password. After i successfully logged i am moving from Scene1 to Scene2.

CombuManager modifyed like so - void AutoPing: 

  1. void AutoPing ()
  2. {
  3.     Ping(true, (bool success) => {
  4.         if (!success && localUser.authenticated)
  5.         {
  6.            _platform.SetLocalUser(new User());
  7.             // Notify the user that the account has been logged in from another location
  8.            Application.LoadLevel(Scene1);
  9.         }
  10.     });
  11. }

so in  Scene2 got soft-logout on first AutoPing tick right after scene loaded. But i would like to make it possible only (if) user2 is logged after user1.

I am a noob, please excuse me with such simple questions.  Thank you.

 
Posted : 16/06/2015 3:33 pm
(@skaredcreations)
Posts: 806
Prominent Member Admin
 

I don't understand what means "if user2 is logged after user1", theoretically your code is already doing what you're saying.

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 16/06/2015 3:37 pm
(@megaman)
Posts: 34
Trusted Member
Topic starter
 

well i am the user1 is loging... on success load Scene2. Then on first tick of void AutoPing () next code is executed:

  1. _platform.SetLocalUser(new User());
  2.  Application.LoadLevel(Scene1);

so user1 going to soft-logout and load back to scene1. But i dont want it in this case because there is no user2 logged yet. I want it only when user2 is logged.

 
Posted : 16/06/2015 4:20 pm
(@skaredcreations)
Posts: 806
Prominent Member Admin
 

Are you talking about logging 2 users on the same machine (it's not possible currently)? Else I really cannot understand what's your issue (or you're confusing the code), the code in that callback is already being execute when the ping fails and it should definitely fail if the same account has logged in from another PC later (re-read my code, it's executed only when the ping returns FALSE as "success" parameter and if you're currently authenticated, that is exactly the case you keep saying).

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 16/06/2015 5:02 pm
(@megaman)
Posts: 34
Trusted Member
Topic starter
 

First of all i am trying to do this on same machine, maybe this is why a have problem.

anyways my apologies for not clear explanations. lets forget about user2 for a moment...

user1 start: scene1 -> login -> success -> scene2 -> void AutoPing() -> execute next code: Ping(true, (bool success) => {
                if (!success && localUser.authenticated)
                {
                    _platform.SetLocalUser(new User());
                    Application.LoadLevel(scene1);
                }
            });

-> user1 at scene1.

 

so right after login success  i got soft-logout and load scene1.

there is no user2 involved yet at all. 

 
Posted : 16/06/2015 5:28 pm
(@skaredcreations)
Posts: 806
Prominent Member Admin
 

Did you try? If yes then it means you're having issues with "ping" web service because usually it should return TRUE as "success", so enable the flag Debug Log on CombuManager inspector and check what it returns when the ping webservice is called.

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 16/06/2015 6:35 pm
(@megaman)
Posts: 34
Trusted Member
Topic starter
 

yep, ti did tried.

if not authenticated...

Sending: http://xxx/server.php?action=ping&sig_time=635700484096883350&sig_crc=0e2c82e67c956bc894ce85a9408802da1b3205c1

every ping

 

on login success it logs once

{"success":true,"message":"{"Id":"3","Username":"ww","GUID":"558036d64bd268.47581676","LastLoginDate":"2015-06-16 14:46:14","LastLoginIp":"67.84.79.89","Email":"","ActivationCode":"","GameCenterId":"","FacebookId":"","ChangePwdCode":"","CustomData":{"Coins":"100","Rank":"1"}}","errors":[]}

then after soft-logout as if not authenticated...

 

Sending: http://xxx/server.php?action=ping&sig_time=635700484096883350&sig_crc=0e2c82e67c956bc894ce85a9408802da1b3205c1

every ping

 
Posted : 16/06/2015 6:52 pm
(@skaredcreations)
Posts: 806
Prominent Member Admin
 

I tried your code and it worked perfectly as intended: logged in from an instance, then launched a second instance of the app and logged in with the same account, and in the first instance I was correctly logged out. Isn't it what you was expecting?

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 16/06/2015 7:05 pm
(@megaman)
Posts: 34
Trusted Member
Topic starter
 

yes this is exactly what i want, but as i told before my first instance(user1) is going to logout right after succeed on login. I am not even try run second instance(user2) to login with in same account because of it. It drives me crazy, must be something i messed up. just cant figure it out.

 
Posted : 16/06/2015 7:45 pm
(@skaredcreations)
Posts: 806
Prominent Member Admin
 

You shouldn't have calls to ping if you're not authenticated, I don't know what's happening and what is your code so if possible send me the settings to connect to your server by PM so I can make a test myself.

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 16/06/2015 8:53 pm
(@megaman)
Posts: 34
Trusted Member
Topic starter
 

YYESSSS!!!! everything working cool now!!! yohhoo! thank you! I appreciate your service very much. just updated my web files with 2.0.2 version files!!!

 
Posted : 16/06/2015 9:56 pm
(@megaman)
Posts: 34
Trusted Member
Topic starter
 

Have a great Day!

 
Posted : 16/06/2015 10:05 pm
(@skaredcreations)
Posts: 806
Prominent Member Admin
 

Cool, have fun! 🙂

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 16/06/2015 11:27 pm
Share: