XGameStreamingUpdateTouchControlsStateOnClient

레이아웃을 터치하는 특정된 스트리밍 클라이언트의 상태를 업데이트하여 동작을 변경할 수 있습니다. 현재 표시된 터치 컨트롤 세트에 대한 시각적 변경은 모든 변수가 업데이트된 후에 수행됩니다.

구문

HRESULT XGameStreamingUpdateTouchControlsStateOnClient(  
         XGameStreamingClientId client,  
         size_t operationCount,  
         const XGameStreamingTouchControlsStateOperation* operations  
)  

매개 변수

client _In_
형식: XGameStreamingClientId

상태를 업데이트할 스트리밍 클라이언트 장치

operationCount _In_
형식: size_t

전달되는 작업 배열의 크기

operations _In_reads_opt_(operationCount)
형식: XGameStreamingTouchControlsStateOperation*

요청 중인 모든 상태 변수 업데이트의 배열입니다.

반환 값

형식: HRESULT

성공한 경우 S_OK를 반환하고, 그렇지 않으면 오류 코드를 반환합니다.

잠재적인 오류

오류 코드 오류 값 오류 발생 원인
E_GAMESTREAMING_NOT_INITIALIZED 0x89245400 XGameStreaming 런타임이 아직 초기화되지 않았습니다. 다른 API를 호출하기 전에 XGameStreamingInitialize를 호출합니다.
E_GAMESTREAMING_CLIENT_NOT_CONNECTED 0x89245401 지정된 클라이언트가 연결되어 있지 않습니다.
E_INVALIDARG 0x80070057 지정된 작업에 작업 XGameStreamingTouchControlsStateValueKind에 지정된 데이터 유형과 일치하는 데이터가 없는 경우

비고

스트리밍 클라이언트가 사용하는 터치 레이아웃은 초기 값이 터치 레이아웃 번들에 포함된 상태에 따라 달라질 수 있습니다. 게임은 상태를 업데이트할 수 있으며, 이로 인해 현재 플레이어에 표시되는 레이아웃이 변경될 수 있습니다.

게임은 XGameStreamingUpdateTouchControlsState을(를) 사용하여 연결된 모든 클라이언트의 상태를 업데이트하거나 XGameStreamingUpdateTouchControlsStateOnClient을(를) 사용하여 특정 연결된 클라이언트를 업데이트할 수 있습니다.

게임에서 상태를 업데이트하고 동시에 레이아웃을 변경하려는 경우 XGameStreamingShowTouchControlsWithStateUpdate 또는 XGameStreamingShowTouchControlsWithStateUpdateOnClient를 활용할 수 있습니다.

// In this example, after the player has switched their active weapon - update the image of the fire
// button to match the current weapon and set the enabled state of reload based on whether the player has
// extra magazines.  
// 
// Assumes passing in game structure that includes the active weapon with appropriate state and 
// a clientId for the client to update  
//
// Assumes a game speciic GetImageName function which returns a constant string for the specified weapoon


void GameStreamingClientManager::UpdateStateAfterWeaponChange(const playerWeapon& playerWeapon, XGameStreamingClientId clientId)
{
    // create an update for the active weapon's image
    XGameStreamingTouchControlsStateOperation weaponImage;
    weaponImage.operationKind = XGameStreamingTouchControlsStateOperationKind::Replace;
    weaponImage.path = "/ActiveWeaponImage";
    weaponImage.value.valueKind = XGameStreamingTouchControlsStateValueKind::String;
    weaponImage.value.stringValue = GetImageName(playerWeapon.activeWeapon.id);

    // create an update for whether the reload button should be enabled
    XGameStreamingTouchControlsStateOperation reloadEnabled;
    reloadEnabled.operationKind = XGameStreamingTouchControlsStateOperationKind::Replace;
    reloadEnabled.path = "/ReloadEnabled";
    reloadEnabled.valueKind = XGameStreamingTouchControlsStateValueKind::Bool;
    reloadEnabled.booleanValue = playerWeapon.activeWeapon.reloadClips > 0;

    // combine all the updates into the update state call and make the call
    XGameStreamingTouchControlsStateOperation[2] updateOperations = {weaponImage, reloadEnabled};
    
    XGameStreamingUpdateTouchControlsStateOnClient(clientId, _countof(updateOperations), updateOperations);
}
// In this example, after the player has gone to their inventory screen and had the ability to apply items
// to two active slots. Update the state for layouts to have layouts match the player's current
// loaded items from inventory (may or may not be the current layout being displayed).
//
// Assumes passing in game structure that includes the player's active inventory as well as the clientId to update


void GameStreamingClientManager::AfterInventoryScreen(const PlayerInventory& playerInventory, XGameStreamingClientId clientId)
{
    std::vector<XGameStreamingTouchControlsStateOperation> updateOperations;
    
    // check the first inventory slots, if empty hide that button from the layout
    // if item is placed in that slot, update the image to match the inventory items
    
    XGameStreamingTouchControlsStateOperation slot1Visible;
    slot1Visible.operationKind = XGameStreamingTouchControlsStateOperationKind::Replace;
    slot1Visible.path = "/Slot1IsVisible";
    slot1Visible.valueKind = XGameStreamingTouchControlsStateValueKind::Boolean;
    slot1Visible.boolValue =  playerInventory.slot1 != nullptr;
    
    updateOperations.push_back(slot1Visible);

    if (playerInventory.slot1 != nullptr) 
    {
        // create an update for the active weapon's image
        XGameStreamingTouchControlsStateOperation slot1Image;
        slot1Image.operationKind = XGameStreamingTouchControlsStateOperationKind::Replace;
        slot1Image.path = "/Slot1Image";
        slot1Image.value.valueKind = XGameStreamingTouchControlsStateValueKind::String;
        slot1Image.value.stringValue = GetImageName(playerInventory.slot1.id);        
        updateOperations.pushBack(slot1Image);
    }
    

    // ... 
    // do the same for the second inventory spot
    // ...

    // Update the state so that layouts will be updated correctly
    XGameStreamingUpdateTouchControlsStateOnClient(clientId, updateOperations.size(), updateOperations.data());
}

요건

헤더: XGameStreaming.h

라이브러리: xgameruntime.lib
지원되는 플랫폼: Windows, Xbox One 패밀리 콘솔 및 Xbox Series 콘솔

참고 항목

XGameStreaming
XGameStreamingTouchControlsStateOperationKind
XGameStreamingTouchControlsStateOperation
XGameStreamingTouchControlsStateValue
XGameStreamingShowTouchControlsWithStateUpdate
XGameStreamingUpdateTouchControlsState
XGameStreamingUpdateTouchControlsStateOnClient