> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XGameStreamingUpdateTouchControlsState

> XGameStreamingUpdateTouchControlsState

# XGameStreamingUpdateTouchControlsState

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

## 구문

```cpp theme={null}
HRESULT XGameStreamingUpdateTouchControlsState(  
         size_t operationCount,  
         const XGameStreamingTouchControlsStateOperation* operations  
)  
```

### 매개 변수

*operationCount*   \_In\_\
형식: size\_t

전달되는 작업 배열의 크기입니다.

*operations*   \_In\_reads\_opt\_(operationCount)\
형식: [XGameStreamingTouchControlsStateOperation\*](/reference/system/xgamestreaming/structs/xgamestreamingtouchcontrolsstateoperation)

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

### 반환 값

형식: HRESULT

성공하면 **S\_OK**를 반환하고, 그렇지 않으면 오류 코드를 반환합니다.

#### 잠재적 오류

| 오류 코드                              | 오류 값       | 오류 원인                                                                                                                                                              |
| ---------------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| E\_GAMESTREAMING\_NOT\_INITIALIZED | 0x89245400 | XGameStreaming 런타임이 초기화되지 않았습니다. 다른 API를 호출하기 전에 [XGameStreamingInitialize](/reference/system/xgamestreaming/functions/xgamestreaminginitialize)를 호출하세요.           |
| E\_INVALIDARG                      | 0x80070057 | 지정한 작업의 데이터가 [XGameStreamingTouchControlsStateValueKind](/reference/system/xgamestreaming/enums/xgamestreamingtouchcontrolsstatevaluekind)에 지정된 데이터 형식과 일치하지 않습니다. |

## 설명

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

게임은 `XGameStreamingUpdateTouchControlsState`를 사용하여 연결된 모든 클라이언트의 상태를 업데이트하거나, [XGameStreamingUpdateTouchControlsStateOnClient](/reference/system/xgamestreaming/functions/xgamestreamingupdatetouchcontrolsstateonclient)를 사용하여 연결된 특정 클라이언트의 상태를 업데이트할 수 있습니다.

게임이 상태를 업데이트하는 동시에 레이아웃도 변경해야 하는 경우 [XGameStreamingShowTouchControlsWithStateUpdate](/reference/system/xgamestreaming/functions/xgamestreamingshowtouchcontrolswithstateupdate) 또는 [XGameStreamingShowTouchControlsWithStateUpdateOnClient](/reference/system/xgamestreaming/functions/xgamestreamingshowtouchcontrolswithstateupdateonclient)를 활용할 수 있습니다.

## 예제

```C++ theme={null}
// 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.  
//
// Assumes a game speciic GetImageName function which returns a constant string for the specified weapoon


void GameStreamingClientManager::UpdateStateAfterWeaponChange(const playerWeapon& playerWeapon)
{
    // 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};
    
    XGameStreamingUpdateTouchControlsState(updateOperations, _countof(updateOperations));
}
```

```c++ theme={null}
// 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


void GameStreamingClientManager::AfterInventoryScreen(const PlayerInventory& playerInventory)
{
    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
    XGameStreamingUpdateTouchControlsState(updateOperations.data(), updateOperations.size());
}

```

## 요구 사항

**헤더:** XGameStreaming.h

**라이브러리:** xgameruntime.lib\
**지원 플랫폼:** Windows, XBOX One 계열 콘솔 및 XBOX Series 콘솔

## 함께 보기

[XGameStreaming](/reference/system/xgamestreaming/xgamestreaming_members#TouchAdaptation)\
[XGameStreamingTouchControlsStateOperationKind](/reference/system/xgamestreaming/enums/xgamestreamingtouchcontrolsstateoperationkind)\
[XGameStreamingTouchControlsStateOperation](/reference/system/xgamestreaming/structs/xgamestreamingtouchcontrolsstateoperation)\
[XGameStreamingTouchControlsStateValue](/reference/system/xgamestreaming/structs/xgamestreamingtouchcontrolsstatevalue)\
[XGameStreamingShowTouchControlsWithStateUpdate](/reference/system/xgamestreaming/functions/xgamestreamingshowtouchcontrolswithstateupdate)\
[XGameStreamingShowTouchControlsWithStateUpdateOnClient](/reference/system/xgamestreaming/functions/xgamestreamingshowtouchcontrolswithstateupdateonclient)\
[XGameStreamingUpdateTouchControlsStateOnClient](/reference/system/xgamestreaming/functions/xgamestreamingupdatetouchcontrolsstateonclient)


## Related topics

- [XGameStreamingUpdateTouchControlsStateOnClient](/ko/reference/system/xgamestreaming/functions/xgamestreamingupdatetouchcontrolsstateonclient.md)
- [XGameStreamingShowTouchControlsWithStateUpdate](/ko/reference/system/xgamestreaming/functions/xgamestreamingshowtouchcontrolswithstateupdate.md)
- [XGameStreamingTouchControlsStateOperation](/ko/reference/system/xgamestreaming/structs/xgamestreamingtouchcontrolsstateoperation.md)
- [XGameStreamingTouchControlsStateValue](/ko/reference/system/xgamestreaming/structs/xgamestreamingtouchcontrolsstatevalue.md)
- [XGameStreamingShowTouchControlsWithStateUpdateOnClient](/ko/reference/system/xgamestreaming/functions/xgamestreamingshowtouchcontrolswithstateupdateonclient.md)
