예제 #1
0
        internal static void OnCreateDeviceId(IntPtr address)
        {
            OnCreateDeviceIdCallback   callback     = null;
            CreateDeviceIdCallbackInfo callbackInfo = null;

            if (Helper.TryGetAndRemoveCallback <OnCreateDeviceIdCallback, CreateDeviceIdCallbackInfoInternal, CreateDeviceIdCallbackInfo>(address, out callback, out callbackInfo))
            {
                callback(callbackInfo);
            }
        }
예제 #2
0
        /// <summary>
        /// Create a new unique pseudo-account that can be used to identify the current user profile on the local device.
        ///
        /// This function is intended to be used by mobile games and PC games that wish to allow
        /// a new user to start playing without requiring to login to the game using any user identity.
        /// In addition to this, the Device ID feature is used to automatically login the local user
        /// also when they have linked at least one external user account(s) with the local Device ID.
        ///
        /// It is possible to link many devices with the same user's account keyring using the Device ID feature.
        ///
        /// Linking a device later or immediately with a real user account will ensure that the player
        /// will not lose their progress if they switch devices or lose the device at some point,
        /// as they will be always able to login with one of their linked real accounts and also link
        /// another new device with the user account associations keychain. Otherwise, without having
        /// at least one permanent user account linked to the Device ID, the player would lose all of their
        /// game data and progression permanently should something happen to their device or the local
        /// user profile on the device.
        ///
        /// After a successful one-time CreateDeviceId operation, the game can login the local user
        /// automatically on subsequent game starts with <see cref="Login" /> using the <see cref="ExternalCredentialType.DeviceidAccessToken" />
        /// credentials type. If a Device ID already exists for the local user on the device then <see cref="Result.DuplicateNotAllowed" />
        /// error result is returned and the caller should proceed to calling <see cref="Login" /> directly.
        /// </summary>
        /// <param name="options">structure containing operation input parameters</param>
        /// <param name="clientData">arbitrary data that is passed back to you in the CompletionDelegate</param>
        /// <param name="completionDelegate">a callback that is fired when the create operation completes, either successfully or in error</param>
        public void CreateDeviceId(CreateDeviceIdOptions options, object clientData, OnCreateDeviceIdCallback completionDelegate)
        {
            var optionsInternal = Helper.CopyProperties <CreateDeviceIdOptionsInternal>(options);

            var completionDelegateInternal = new OnCreateDeviceIdCallbackInternal(OnCreateDeviceId);
            var clientDataAddress          = IntPtr.Zero;

            Helper.AddCallback(ref clientDataAddress, clientData, completionDelegate, completionDelegateInternal);

            EOS_Connect_CreateDeviceId(InnerHandle, ref optionsInternal, clientDataAddress, completionDelegateInternal);
            Helper.TryMarshalDispose(ref optionsInternal);
        }