> ## 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.

# XGameStreamingUpdateTouchControlsStateOnClient

> XGameStreamingUpdateTouchControlsStateOnClient

# XGameStreamingUpdateTouchControlsStateOnClient

Actualiza el estado en un cliente de streaming especificado que los diseños táctiles pueden usar para modificar su comportamiento. Cualquier cambio visual en el conjunto de controles táctiles que se está mostrando actualmente se realizará después de que se actualicen TODAS las variables.

## Sintaxis

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

### Parámetros

*client*   \_In\_\
Tipo: XGameStreamingClientId

El dispositivo cliente de streaming en el que se actualizará el estado.

*operationCount*   \_In\_\
Tipo: size\_t

Tamaño de la matriz de operaciones que se pasa

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

Matriz de todas las actualizaciones de variables de estado que se solicitan.

### Valor devuelto

Tipo: HRESULT

Devuelve **S\_OK** si se realiza correctamente; de lo contrario, devuelve un código de error.

#### Posibles errores

| Código de error                          | Valor de error | Motivo del error                                                                                                                                                                                                                                    |
| ---------------------------------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| E\_GAMESTREAMING\_NOT\_INITIALIZED       | 0x89245400     | No se ha inicializado el entorno de ejecución de XGameStreaming. Llame a [XGameStreamingInitialize](/reference/system/xgamestreaming/functions/xgamestreaminginitialize) antes de llamar a otras API.                                               |
| E\_GAMESTREAMING\_CLIENT\_NOT\_CONNECTED | 0x89245401     | El cliente especificado no está conectado.                                                                                                                                                                                                          |
| E\_INVALIDARG                            | 0x80070057     | Si una operación especificada no tiene datos que coincidan con el tipo de datos especificado en el [XGameStreamingTouchControlsStateValueKind](/reference/system/xgamestreaming/enums/xgamestreamingtouchcontrolsstatevaluekind) de las operaciones |

## Comentarios

Los diseños táctiles que usan los clientes de streaming pueden depender de un estado, cuyos valores iniciales están incrustados en el paquete de diseños táctiles.  El juego puede actualizar el estado, lo que puede provocar que cambie el diseño que se está mostrando actualmente al jugador.

El juego puede usar [XGameStreamingUpdateTouchControlsState](/reference/system/xgamestreaming/functions/xgamestreamingupdatetouchcontrolsstate) para actualizar el estado de todos los clientes conectados o `XGameStreamingUpdateTouchControlsStateOnClient` para actualizar un cliente conectado específico.

Si el juego quiere actualizar el estado Y realizar un cambio de diseño al mismo tiempo, puede utilizar [XGameStreamingShowTouchControlsWithStateUpdate](/reference/system/xgamestreaming/functions/xgamestreamingshowtouchcontrolswithstateupdate) o [XGameStreamingShowTouchControlsWithStateUpdateOnClient](/reference/system/xgamestreaming/functions/xgamestreamingshowtouchcontrolswithstateupdateonclient).

## Ejemplos

```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 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);
}
```

```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 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());
}

```

## Requisitos

**Encabezado:** XGameStreaming.h

**Biblioteca:** xgameruntime.lib\
**Plataformas compatibles**: Windows, consolas de la familia XBOX One y consolas XBOX Series

## Consulte también

[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)\
[XGameStreamingUpdateTouchControlsState](/reference/system/xgamestreaming/functions/xgamestreamingupdatetouchcontrolsstate)\
[XGameStreamingUpdateTouchControlsStateOnClient](/reference/system/xgamestreaming/functions/xgamestreamingupdatetouchcontrolsstateonclient)


## Related topics

- [XGameStreamingUpdateTouchControlsState](/es/reference/system/xgamestreaming/functions/xgamestreamingupdatetouchcontrolsstate.md)
- [XGameStreamingShowTouchControlsWithStateUpdateOnClient](/es/reference/system/xgamestreaming/functions/xgamestreamingshowtouchcontrolswithstateupdateonclient.md)
- [XGameStreamingShowTouchControlsWithStateUpdate](/es/reference/system/xgamestreaming/functions/xgamestreamingshowtouchcontrolswithstateupdate.md)
- [XGameStreamingTouchControlsStateOperation](/es/reference/system/xgamestreaming/structs/xgamestreamingtouchcontrolsstateoperation.md)
- [XGameStreamingTouchControlsStateValue](/es/reference/system/xgamestreaming/structs/xgamestreamingtouchcontrolsstatevalue.md)
