Acessando as APIs do Microsoft Game Development Kit (GDK)
Depois de importar o pacote de API do Microsoft GDK do Unity, a funcionalidade dele fica disponível no namespace XGamingRuntime. Todas as APIs do Gaming Runtime estão disponíveis por meio de métodos estáticos na classe SDK. Todas as APIs dos XBOX services estão disponíveis por meio de métodos estáticos na classe SDK.XBL. O exemplo a seguir mostra essa disponibilidade.Cobertura de API e convenções
Nem todas as APIs estão disponíveis por meio do pacote. Para obter uma lista completa dessas APIs, consulte as listas de APIs do Microsoft Game Development Kit (GDK) e dos XBOX services mais adiante neste tópico.
- Os nomes das APIs correspondem aos equivalentes do GDK sempre que possível.
- Sem exceções. Os erros são comunicados por meio de HRESULTs.
- Superfície de API plana, sem encapsulamento orientado a objetos.
- Parâmetros out são usados em APIs que definem parâmetros.
- Métodos assíncronos usam callbacks. Para obter detalhes, consulte a seção a seguir.
Modelo de programação assíncrona
A maioria das APIs assíncronas recebe um callback como último parâmetro. Um exemplo é mostrado a seguir.- Os métodos assíncronos são executados imediatamente, e o trabalho é realizado em uma thread disponível no pool de threads.
- O pool de threads é inicializado internamente depois que uma chamada é feita para SDK.XGameRuntimeInitialize().
- Nenhuma opção de configuração do pool de threads é exposta.
- O callback de resultado é invocado depois que o dispatch é chamado (ou seja, SDK.XTaskQueueDispatch()). Por isso, é importante que o dispatch seja chamado com frequência, de preferência durante o loop de atualização do seu jogo.
- O callback de resultado é executado na thread que invocou o dispatch.
Exemplos de diferenças entre APIs nativas e wrappers gerenciados
As APIs nativas e os wrappers gerenciados têm diferenças mínimas. Para referência, os dois exemplos a seguir mostram a assinatura e as funções de chamada de XUserAddAsync e XblAchievementsUpdateAchievementAsync em código gerenciado e nativo.Exemplo de XUserAddAsync
A assinatura nativa de XUserAddAsync é a seguinte.Exemplo de XblAchievementsUpdateAchievementAsync
A assinatura nativa de XblAchievementsUpdateAchievementAsync é a seguinte.Inicializando a XBOX Services API (XSAPI) em código gerenciado
Para referência, veja a seguir uma inicialização da XSAPI em código gerenciado. Esta é a assinatura da XSAPI em código gerenciado.Lista de APIs do Microsoft Game Development Kit (GDK) em wrappers gerenciados
As seguintes APIs do Microsoft Game Development Kit (GDK) estão incluídas em wrappers gerenciados no pacote GDK para Unity. Para obter mais informações sobre as APIs do Microsoft Game Development Kit (GDK), consulte Referência de API do 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 APIs dos XBOX services em wrappers gerenciados
As seguintes APIs dos XBOX services estão incluídas em wrappers gerenciados no pacote GDK para Unity. Para obter mais informações sobre as APIs dos XBOX services, consulte Referência de API do XBOX Live.- XblContext
- XblAchievements
- XblEvents
- XblLeaderboard
- XblPresence
- XblPrivacy
- XblSocialManager
- XblUserStatistics
- XblHttpCall
- XblGetErrorCondition
- XblMultiplayer
- XblMultiplayerManager
- XblMultiplayerActivity
- XblMatchmaking
- XblProfile
- XblRealTimeActivity
- XblTitleManagedStats
- XblSocial
- XblTitleStorage
- XblUserStatics
