如何使用不带包的耐用品

耐用品可以通过下载或不下载数据包到客户端进行配置。 无数据包的耐用品更容易配置和使用。 这些类型的耐用品通常用于对已成为基础游戏一部分的内容的访问进行把关。 许多游戏选择将加载项的内容包含在基本游戏包中,因为即使在未获得授权的情况下也会将其资产用于多人游戏或预览目的。

注意

光盘上不支持没有包装的耐用品。

即使没有可下载的程序包,这些产品类型仍会根据游戏的产品共享模型提供许可证。

仅使用 XStoreQueryEntitledProductsAsync 查看所有权是不够的,因为这将导致仅向购买者授予访问权限。 转而请使用 XStoreAcquireLicenseForDurablesAsync 适当监查对耐用品的访问权限:

void Sample::AcquireLicenseForDurable(const char* storeId)
{
    auto async = new XAsyncBlock{};
    async->context = this;
    async->queue = m_asyncQueue;
    async->callback = [](XAsyncBlock* async)
    {
        XStoreLicenseHandle result = {};

        HRESULT hr = XStoreAcquireLicenseForDurablesResult(
            async,
            &result);

        if (SUCCEEDED(hr))
        {
            bool isValid = XStoreIsLicenseValid(result);
            printf("Is valid license: %s\n", isValid? "yes" : "no");
        }
        else
        {
            printf("Error calling XStoreAcquireLicenseForDurablesResult: 0x%x\n", hr);
        }

        delete async;
    };

    HRESULT hr = XStoreAcquireLicenseForDurablesAsync(
        m_xStoreContext,
        storeId,
        async);

    if (FAILED(hr))
    {
        delete async;
        return;
    }
}

另请参阅

商业概述

管理和许可可下载内容 (DLC)

XStore API 参考