void ProcessCreateUser(bool success)
 {
     if (Social.localUser.authenticated)
     {
         //Login with gamecenter id
         GamedoniaUsers.LoginUserWithGameCenterId(Social.localUser.id, ProcessLogin);
     }
     else
     {
         //Login with open_udid
         GamedoniaUsers.LoginUserWithOpenUDID(OpenUDIDPlugin.GetOpenUDID(), null);
     }
 }
        void ProcessAuthentication(bool success)
        {
            GDUser      user        = new GDUser();
            Credentials credentials = new Credentials();

            credentials.open_udid = OpenUDIDPlugin.GetOpenUDID();
            user.credentials      = credentials;

            if (success)
            {
                credentials.gamecenter_id = Social.localUser.id;
            }

            GamedoniaUsers.CreateUser(user, ProcessCreateUser);
        }
Esempio n. 3
0
        public static void GetProfile(Action <bool, GDDeviceProfile> callback)
        {
            bool result = true;

            device.deviceId          = OpenUDIDPlugin.GetOpenUDID();
            device.deviceType        = platforms.ContainsKey(Application.platform.ToString()) ? platforms[Application.platform.ToString()] : "";
            device.timeZoneGMTOffset = GamedoniaDeviceInfo.GetTimeZoneGMTOffset();
            device.language          = GamedoniaDeviceInfo.GetLanguageCode();
            device.country           = GamedoniaDeviceInfo.GetCountryCode();

            registeredServices = 0;

            if (services.Count == 0)
            {
                callback(true, device);
            }
            else
            {
                foreach (GDService service in services)
                {
                    service.GetProfile(device,
                                       delegate(bool success) {
                        if (!success)
                        {
                            result = false;
                        }

                        registeredServices++;
                        if (registeredServices == services.Count)
                        {
                            if (callback != null)
                            {
                                callback(result, device);
                            }
                        }
                    }
                                       );
                }
            }
        }