Exemple #1
0
 public void LoadFriends()
 {
     GamedoniaUsers.GetMe(delegate(bool success, GDUserProfile data){
         if (success)
         {
             Debug.Log("I am here now");
             friends = (Dictionary <string, object>)data.profile["friends"];
             foreach (KeyValuePair <string, object> friend in friends)
             {
                 string friendKey = friend.Key;
                 GamedoniaUsers.GetUser(friendKey, delegate(bool succesFriends, GDUserProfile friendProfile) {
                     if (succesFriends)
                     {
                         Dictionary <string, object> oppProfile = new Dictionary <string, object>();
                         oppProfile = friendProfile.profile;
                         friendProfiles.Add(friendKey, oppProfile);
                     }
                     else
                     {
                         friends.Remove(friendKey);
                     }
                 });
             }
             startUpDone = true;
         }
     });
 }
Exemple #2
0
 void ProcessLogin(bool success)
 {
     if (success)
     {
         if (GamedoniaUsers.me == null)
         {
             GamedoniaUsers.GetMe(HandleGetMe);
         }
         else
         {
             if (this.callback != null)
             {
                 callback(success);
             }
         }
     }
     else
     {
         Debug.LogError("Gamedonia session couldn't be started!");
         if (this.callback != null)
         {
             callback(false);
         }
     }
 }
Exemple #3
0
 void OnFacebookLogin(bool success)
 {
     if (success)
     {
         Debug.Log("searching or user");
         GamedoniaUsers.GetMe(delegate(bool profilesuccess, GDUserProfile userProfile){
             if (profilesuccess)
             {
                 Debug.Log(userProfile);
                 if (userProfile.profile.Count != 0)
                 {
                     if ((bool)userProfile.profile ["created_profile"])
                     {
                         Debug.Log("exists continue to profile");
                         OnLogin(true);
                     }
                     else
                     {
                         addEmptyProfile();
                     }
                 }
                 else
                 {
                     addEmptyProfile();
                 }
             }
             else
             {
                 //TODO Your fail processing
             }
         });
     }
     else
     {
         errorMsg = GamedoniaBackend.getLastError().ToString();
         Debug.Log(errorMsg);
     }
 }
Exemple #4
0
    private static void RegisterDeviceAfterLogin(Action <bool> callback)
    {
        if (Gamedonia.INSTANCE.IsDeviceRegisterNeeded())
        {
            GamedoniaDevices.GetProfile(
                delegate(bool successDevProfile, GDDeviceProfile device) {
                if (successDevProfile)
                {
                    switch (device.deviceType)
                    {
                    case "ios":
                    case "android":
                        if (GamedoniaUsers.me == null)
                        {
                            GamedoniaUsers.GetMe(
                                delegate(bool success, GDUserProfile profile) {
                                if (success)
                                {
                                    GamedoniaDevices.device.uid = GamedoniaUsers.me._id;
                                    GamedoniaDevices.Register(device,
                                                              delegate(bool successRegister) {
                                        if (callback != null)
                                        {
                                            callback(successRegister);
                                        }
                                    }
                                                              );
                                }
                                else
                                {
                                    if (callback != null)
                                    {
                                        callback(success);
                                    }
                                }
                            }
                                );
                        }
                        else
                        {
                            GamedoniaDevices.device.uid = GamedoniaUsers.me._id;
                            GamedoniaDevices.Register(device,
                                                      delegate(bool successRegister) {
                                if (callback != null)
                                {
                                    callback(successRegister);
                                }
                            }
                                                      );
                        }
                        break;

                    default:
                        if (callback != null)
                        {
                            callback(successDevProfile);
                        }
                        break;
                    }
                }
                else
                {
                    Debug.LogWarning("The device has not been registered due to an error");
                    if (callback != null)
                    {
                        callback(successDevProfile);
                    }
                }
            }
                );
        }
        else
        {
            if (callback != null)
            {
                callback(true);
            }
        }
    }
Exemple #5
0
 void Start()
 {
     GamedoniaUsers.GetMe(OnGetMe);
 }