Acceso a las API de Microsoft Game Development Kit (GDK)
Después de importar el paquete de API de Microsoft GDK desde Unity, su funcionalidad está disponible en el espacio de nombres XGamingRuntime. Todas las API de Gaming Runtime están disponibles mediante métodos estáticos en la clase SDK. Todas las API de los servicios de XBOX están disponibles mediante métodos estáticos en la clase SDK.XBL. En el ejemplo siguiente se muestra esta disponibilidad.Cobertura y convenciones de las API
No todas las API están disponibles a través del paquete. Para obtener una lista completa de estas API, consulte las listas de API de Microsoft Game Development Kit (GDK) y de los servicios de XBOX más adelante en este tema.
- Los nombres de las API coinciden con sus equivalentes del GDK siempre que es posible.
- Sin excepciones. Los errores se comunican mediante HRESULT.
- Superficie de API plana sin encapsulación orientada a objetos.
- Se usan parámetros out en las API que establecen parámetros.
- Los métodos asincrónicos usan devoluciones de llamada. Para obtener más información, consulte la sección siguiente.
Modelo de programación asincrónica
La mayoría de las API asincrónicas aceptan una devolución de llamada como último parámetro. A continuación se muestra un ejemplo.- Los métodos asincrónicos se ejecutan inmediatamente y el trabajo se realiza en un subproceso disponible del grupo de subprocesos.
- El grupo de subprocesos se inicializa internamente después de realizar una llamada a SDK.XGameRuntimeInitialize().
- No se exponen opciones de configuración del grupo de subprocesos.
- La devolución de llamada de resultado se invoca después de que se llame a dispatch (es decir, SDK.XTaskQueueDispatch()). Como consecuencia, es importante que dispatch se llame con frecuencia, idealmente durante el bucle de actualización del juego.
- La devolución de llamada de resultado se ejecuta en el subproceso que invocó dispatch.
Ejemplos de diferencias entre las API nativas y los contenedores administrados
Las API nativas y los contenedores administrados tienen diferencias mínimas. Como referencia, los dos ejemplos siguientes muestran las funciones de firma y llamada de XUserAddAsync y XblAchievementsUpdateAchievementAsync en código administrado y nativo.Ejemplo de XUserAddAsync
La firma nativa de XUserAddAsync es la siguiente.Ejemplo de XblAchievementsUpdateAchievementAsync
La firma nativa de XblAchievementsUpdateAchievementAsync es la siguiente.Inicialización de XBOX Services API (XSAPI) en código administrado
Como referencia, la siguiente es una inicialización de XSAPI en código administrado. Esta es la firma de XSAPI en código administrado.Lista de API de Microsoft Game Development Kit (GDK) en contenedores administrados
Las siguientes API de Microsoft Game Development Kit (GDK) se incluyen en contenedores administrados dentro del paquete del GDK para Unity. Para obtener más información sobre las API de Microsoft Game Development Kit (GDK), consulte Referencia de API del sistema.- XAccessibility
- XClosedCaptionGetProperties
- XClosedCaptionSetEnabled
- XHighContrastGetMode
- XSpeechToTextSendString
- XSpeechToTextSetPositionHint
- XSpeechToTextBeginHypothesisString
- XSpeechToTextUpdateHypothesisString
- XSpeechToTextFinalizeHypothesisString
- XSpeechToTextCancelHypothesisString
- XAppCapture
- XAppBroadcastGetStatus
- XAppBroadcastIsAppBroadcasting
- XAppBroadcastShowUI
- XAppBroadcastRegisterIsAppBroadcastingChanged
- XAppCaptureCloseLocalStream
- XAppCaptureCloseScreenshotStream
- XAppCaptureEnableRecord
- XAppCaptureDisableRecord
- XAppBroadcastUnregisterIsAppBroadcastingChanged
- XAppCaptureMetadataAddStringEvent
- XAppCaptureMetadataAddInt32Event
- XAppCaptureMetadataAddDoubleEvent
- XAppCaptureMetadataStartStringState
- XAppCaptureMetadataStartInt32State
- XAppCaptureMetadataStartDoubleState
- XAppCaptureMetadataStopState
- XAppCaptureMetadataStopAllStates
- XAppCaptureMetadataRemainingStorageBytesAvailable
- XAppCaptureOpenScreenshotStream
- XAppCaptureReadScreenshotStream
- XAppCaptureRecordDiagnosticClip
- XAppCaptureTakeDiagnosticScreenshot
- XAppCaptureTakeScreenshot
- XAppCaptureRegisterMetadataPurged
- XAppCaptureUnRegisterMetadataPurged
- XAppCaptureReadLocalStream
- XAppCaptureRecordTimespan
- XAppCaptureGetVideoCaptureSettings
- XAsync
- XAsyncGetStatus
- XAsyncGetResultSize
- XAsyncCancel
- XAsyncRun
- XDisplay
- XDisplayTryEnableHdrMode
- XDisplayAcquireTimeoutDeferral
- XDisplayCloseTimeoutDeferralHandle
- XError
- XErrorSetCallback
- XErrorSetOptions
- XGameEvent
- XGameEventWrite
- XGame
- XGameGetXboxTitleId
- XLaunchNewGame
- XLaunchRestartOnCrash
- XGameInvite
- XGameInviteRegisterForEvent
- XGameInviteUnregisterForEvent
- XGameProtocol
- XGameProtocolRegisterForActivation
- XGameProtocolUnregisterForActivation
- XGameRuntimeFeature
- XGameRuntimeIsFeatureAvailable
- XGameRuntimeInit
- XGameRuntimeInitialize
- XGameRuntimeUninitialize
- XGameSave
- XGameSaveInitializeProvider
- XGameSaveInitializeProviderAsync
- XGameSaveInitializeProviderResult
- XGameSaveCloseProvider
- XGameSaveGetRemainingQuota
- XGameSaveGetRemainingQuotaAsync
- XGameSaveGetRemainingQuotaResult
- XGameSaveDeleteContainer
- XGameSaveDeleteContainerAsync
- XGameSaveDeleteContainerResult
- XGameSaveCreateContainer
- XGameSaveCloseContainer
- XGameSaveGetContainerInfo
- XGameSaveEnumerateContainerInfo
- XGameSaveEnumerateContainerInfoByName
- XGameSaveEnumerateBlobInfo
- XGameSaveEnumerateBlobInfoByName
- XGameSaveReadBlobData
- XGameSaveReadBlobDataAsync
- XGameSaveReadBlobDataResult
- XGameSaveCreateUpdate
- XGameSaveCloseUpdateHandle
- XGameSaveSubmitBlobWrite
- XGameSaveSubmitBlobDelete
- XGameSaveSubmitUpdate
- XGameSaveSubmitUpdateAsync
- XGameSaveSubmitUpdateResult
- XGameSaveFiles
- XGameSaveFilesGetFolderWithUiAsync
- XGameSaveFilesGetFolderWithUiResult
- XGameSaveFilesGetRemainingQuota
- XGameStreaming
- XGameStreamingInitialize
- XGameStreamingUninitialize
- XGameStreamingIsStreaming
- XGameStreamingGetClientCount
- XGameStreamingGetClients
- XGameStreamingGetConnectionState
- XGameStreamingRegisterConnectionStateChanged
- XGameStreamingUnregisterConnectionStateChanged
- XGameStreamingHideTouchControls
- XGameStreamingHideTouchControlsOnClient
- XGameStreamingShowTouchControlLayout
- XGameStreamingShowTouchControlLayoutOnClient
- XGameStreamingRegisterClientPropertiesChanged
- XGameStreamingUnregisterClientPropertiesChanged
- XGameStreamingGetStreamPhysicalDimensions
- XGameStreamingGetStreamAddedLatency
- XGameStreamingGetServerLocationNameSize
- XGameStreamingGetServerLocationName
- XGameStreamingIsTouchInputEnabled
- XGameStreamingGetLastFrameDisplayed
- XGameStreamingUpdateTouchControlsState
- XGameStreamingUpdateTouchControlsStateOnClient
- XGameStreamingShowTouchControlsWithStateUpdate
- XGameStreamingShowTouchControlsWithStateUpdateOnClient
- XGameStreamingGetTouchBundleVersionNameSize
- XGameStreamingGetTouchBundleVersion
- XGameStreamingGetClientIPAddress
- XGameStreamingGetSessionId
- XGameStreamingGetDisplayDetails
- XGameStreamingSetResolution
- XGameUI
- XGameUIShowAchievementsAsync
- XGameUIShowAchievementsResult
- XGameUIShowMessageDialogAsync
- XGameUIShowMessageDialogResult
- XGameUIShowErrorDialogAsync
- XGameUIShowErrorDialogResult
- XGameUIShowTextEntryAsync
- XGameUIShowTextEntryResultSize
- XGameUIShowTextEntryResult
- XGameUITextEntryClose
- XGameUITextEntryGetExtents
- XGameUITextEntryOpen
- XGameUITextEntryGetState
- XGameUITextEntryUpdatePositionHint
- XGameUITextEntryUpdateVisibility
- XGameUISetNotificationPositionHint
- XGameUIShowSendGameInviteAsync
- XGameUIShowSendGameInviteResult
- XGameUIShowMultiplayerActivityGameInviteAsync
- XGameUIShowMultiplayerActivityGameInviteResult
- XGameUIShowWebAuthenticationAsync
- XGameUIShowWebAuthenticationResult
- XGameUIShowWebAuthenticationWithOptionsAsync
- XGameUIShowWebAuthenticationResultSize
- XGameUIShowPlayerProfileCardAsync
- XGameUIShowPlayerProfileCardResult
- XGameUIShowPlayerPickerAsync
- XGameUIShowPlayerPickerResultCount
- XGameUIShowPlayerPickerResult
- XLauncher
- XLaunchUri
- XNetworking
- XNetworkingGetConnectivityHint
- XNetworkingQueryConfigurationSetting
- XNetworkingQueryPreferredLocalUdpMultiplayerPort
- XNetworkingQueryPreferredLocalUdpMultiplayerPortAsync
- XNetworkingQueryPreferredLocalUdpMultiplayerPortAsyncResult
- XNetworkingQuerySecurityInformationForUrlAsync
- XNetworkingQuerySecurityInformationForUrlAsyncResultSize
- XNetworkingQuerySecurityInformationForUrlAsyncResult
- XNetworkingQuerySecurityInformationForUrlUtf16Async
- XNetworkingQuerySecurityInformationForUrlUtf16AsyncResultSize
- XNetworkingQuerySecurityInformationForUrlUtf16AsyncResult
- XNetworkingQueryStatistics
- XNetworkingRegisterConnectivityHintChanged
- XNetworkingUnregisterConnectivityHintChanged
- XNetworkingRegisterPreferredLocalUdpMultiplayerPortChanged
- XNetworkingUnregisterPreferredLocalUdpMultiplayerPortChanged
- XNetworkingVerifyServerCertificate
- XPackage
- XPackageGetCurrentProcessPackageIdentifier
- XPackageIsPackagedProcess
- XPackageGetUserLocale
- XPackageEnumeratePackages
- XPackageFindChunkAvailability
- XPackageChangeChunkInstallOrder
- XPackageInstallChunks
- XPackageUninstallChunks
- XPackageInstallChunksAsync
- XPackageInstallChunksResult
- XPackageRegisterPackageInstalled
- XPackageUnregisterPackageInstalled
- XPackageEnumerateFeatures
- XPackageEnumerateChunkAvailability
- XPackageMount
- XPackageMountWithUiAsync
- XPackageMountWithUiResult
- XPackageGetMountPath
- XPackageGetMountPathSize
- XPackageCloseMountHandle
- XPackageCreateInstallationMonitor
- XPackageCloseInstallationMonitorHandle
- XPackageGetInstallationProgress
- XPackageUpdateInstallationMonitor
- XPackageRegisterInstallationProgressChanged
- XPackageUnregisterInstallationProgressChanged
- XPackageEstimateDownloadSize
- XPackageGetWriteStats
- XPackageUninstallUWPInstance
- XPackageUninstallPackage
- XPersistentLocalStorage
- XPersistentLocalStorageGetPathSize
- XPersistentLocalStorageGetPath
- XPersistentLocalStorageGetSpaceInfo
- XPersistentLocalStoragePromptUserForSpaceAsync
- XPersistentLocalStoragePromptUserForSpaceResult
- XSpeechSynthesizer
- XSpeechSynthesizerEnumerateInstalledVoices
- XSpeechSynthesizerCreate
- XSpeechSynthesizerCloseHandle
- XSpeechSynthesizerSetDefaultVoice
- XSpeechSynthesizerSetCustomVoice
- XSpeechSynthesizerCreateStreamFromText
- XSpeechSynthesizerCreateStreamFromSsml
- XSpeechSynthesizerCloseStreamHandle
- XSpeechSynthesizerGetStreamDataSize
- XSpeechSynthesizerGetStreamData
- XStore
- XStoreCreateContext
- XStoreCloseContextHandle
- XStoreIsAvailabilityPurchasable
- XStoreAcquireLicenseForPackageAsync
- XStoreAcquireLicenseForPackageResult
- XStoreCanAcquireLicenseForPackageAsync
- XStoreCanAcquireLicenseForPackageResult
- XStoreCanAcquireLicenseForStoreIdAsync
- XStoreCanAcquireLicenseForStoreIdResult
- XStoreCloseLicenseHandle
- XStoreIsLicenseValid
- XStoreQueryAddOnLicensesAsync
- XStoreQueryAddOnLicensesResultCount
- XStoreQueryAddOnLicensesResult
- XStoreQueryGameLicenseAsync
- XStoreQueryGameLicenseResult
- XStoreQueryLicenseTokenAsync
- XStoreQueryLicenseTokenResultSize
- XStoreQueryLicenseTokenResult
- XStoreRegisterGameLicenseChanged
- XStoreUnregisterGameLicenseChanged
- XStoreRegisterPackageLicenseLost
- XStoreUnregisterGameLicenseChanged
- XStoreUnregisterPackageLicenseLost
- XStoreAcquireLicenseForDurablesAsync
- XStoreQueryGameAndDlcPackageUpdatesAsync
- XStoreQueryGameAndDlcPackageUpdatesResultCount
- XStoreQueryGameAndDlcPackageUpdatesResult
- XStoreDownloadAndInstallPackagesAsync
- XStoreDownloadAndInstallPackagesResultCount
- XStoreDownloadAndInstallPackagesResult
- XStoreDownloadAndInstallPackageUpdatesAsync
- XStoreDownloadAndInstallPackageUpdatesResult
- XStoreDownloadPackageUpdatesAsync
- XStoreDownloadPackageUpdatesResult
- XStoreQueryPackageIdentifier
- XStoreShowRedeemTokenUIAsync
- XStoreShowRedeemTokenUIResult
- XStoreShowRateAndReviewUIAsync
- XStoreShowRateAndReviewUIResult
- XStoreShowPurchaseUIAsync
- XStoreShowPurchaseUIResult
- XStoreQueryConsumableBalanceRemainingAsync
- XStoreQueryConsumableBalanceRemainingResult
- XStoreReportConsumableFulfillmentAsync
- XStoreReportConsumableFulfillmentResult
- XStoreGetUserCollectionsIdAsync
- XStoreGetUserCollectionsIdResultSize
- XStoreGetUserCollectionsIdResult
- XStoreGetUserPurchaseIdAsync
- XStoreGetUserPurchaseIdResultSize
- XStoreGetUserPurchaseIdResult
- XStoreQueryAssociatedProductsAsync
- XStoreQueryAssociatedProductsResult
- XStoreQueryEntitledProductsAsync
- XStoreQueryEntitledProductsResult
- XStoreQueryProductForCurrentGameAsync
- XStoreQueryProductForCurrentGameResult
- XStoreQueryProductForPackageAsync
- XStoreQueryProductForPackageResult
- XStoreQueryProductsAsync
- XStoreQueryProductsResult
- XStoreProductsQueryNextPageAsync
- XStoreCloseProductsQueryHandle
- XStoreAcquireLicenseForDurablesResult
- XStoreEnumerateProductsQuery
- XStoreProductsQueryHasMorePages
- XStoreProductsQueryNextPageResult
- XStoreShowAssociatedProductsUIAsync
- XStoreShowAssociatedProductsUIResult
- XStoreShowProductPageUIAsync
- XStoreShowProductPageUIResult
- XSystem
- XSystemGetAnalyticsInfo
- XSystemGetAppSpecificDeviceId
- XSystemGetConsoleId
- XSystemGetDeviceType
- XSystemGetXboxLiveSandboxId
- XSystemGetRuntimeInfo
- XSystemIsHandleValid
- XSystemHandleTrack
- XTaskQueue
- XTaskQueueCloseHandle
- XTaskQueueCreate
- XTaskQueueCreateComposite
- XTaskQueueDispatch
- XTaskQueueDuplicateHandle
- XTaskQueueGetCurrentProcessTaskQueue
- XTaskQueueGetPort
- XTaskQueueRegisterMonitor
- XTaskQueueRegisterWaiter
- XTaskQueueSetCurrentProcessTaskQueue
- XTaskQueueSubmitCallback
- XTaskQueueSubmitDelayedCallback
- XTaskQueueTerminate
- XTaskQueueUnregisterMonitor
- XTaskQueueUnregisterWaiter
- XThread
- XThreadIsTimeSensitive
- XThreadSetTimeSensitive
- XThreadAssertNotTimeSensitive
- XUser
- XUserDuplicateHandle
- XUserCloseHandle
- XUserCompare
- XUserGetMaxUsers
- XUserAddAsync
- XUserAddResult
- XUserAddByIdWithUiAsync
- XUserAddByIdWithUiResult
- XUserGetId
- XUserFindUserById
- XUserGetLocalId
- XUserFindUserByLocalId
- XUserGetIsGuest
- XUserGetState
- XUserGetGamertag
- XUserGetGamerPictureAsync
- XUserGetAgeGroup
- XUserCheckPrivilege
- XUserResolvePrivilegeWithUiAsync
- XUserResolvePrivilegeWithUiResult
- XUserGetTokenAndSignatureUtf16Async
- XUserResolveIssueWithUiUtf16Async
- XUserResolveIssueWithUiUtf16Result
- XUserRegisterForChangeEvent
- XUserUnregisterForChangeEvent
- XUserCloseSignOutDeferralHandle
- XUserFindControllerForUserWithUiAsync
- XUserFindControllerForUserWithUiResult
- XUserFindForDevice
- XUserGetDefaultAudioEndpointUtf16
- XUserGetGamerPictureResultSize
- XUserGetGamerPictureResult
- XUserGetSignOutDeferral
- XUserGetTokenAndSignatureAsync
- XUserGetTokenAndSignatureResultSize
- XUserGetTokenAndSignatureResult
- XUserGetTokenAndSignatureUtf16ResultSize
- XUserGetTokenAndSignatureUtf16Result
- XUserIsStoreUser
- XUserRegisterForDefaultAudioEndpointUtf16Changed
- XUserRegisterForDeviceAssociationChanged
- XUserResolveIssueWithUiAsync
- XUserResolveIssueWithUiResult
- XUserUnregisterForDefaultAudioEndpointUtf16Changed
- XUserUnregisterForDeviceAssociationChanged
Lista de API de los servicios de XBOX en contenedores administrados
Las siguientes API de los servicios de XBOX se incluyen en contenedores administrados dentro del paquete del GDK para Unity. Para obtener más información sobre las API de los servicios de XBOX, consulte Referencia de API de XBOX Live.- XblContext
- XblAchievements
- XblEvents
- XblLeaderboard
- XblPresence
- XblPrivacy
- XblSocialManager
- XblUserStatistics
- XblHttpCall
- XblGetErrorCondition
- XblMultiplayer
- XblMultiplayerManager
- XblMultiplayerActivity
- XblMatchmaking
- XblProfile
- XblRealTimeActivity
- XblTitleManagedStats
- XblSocial
- XblTitleStorage
- XblUserStatics
