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

# XGameStreamingShowTouchControlLayout

> XGameStreamingShowTouchControlLayout

# XGameStreamingShowTouchControlLayout

要求所有已連線的串流用戶端裝置顯示指定的觸控配置。

## 語法

```cpp theme={null}
void XGameStreamingShowTouchControlLayout(
         const char* layout  
)  
```

## 參數

*layout*   \_In\_opt\_z\_\
類型：char\*

要顯示的觸控控制項配置名稱，或使用 `nullptr` 以顯示標準 XBOX 控制器配置。

應在串流用戶端裝置上顯示的觸控控制項配置識別碼。配置識別碼為遊戲專屬，並對應至作為 [Touch Adaptation Kit](/zh-TW/build/core-features/common/game-streaming/game-streaming-touch-touch-adaptation-kit-overview) 的一部分提供給 XBOX Game Streaming 服務的配置識別碼。此字串應以 UTF-8 編碼。

如果提供 `nullptr`，將會顯示預設的觸控控制項組合。

任何不對應至該遊戲觸控控制項配置識別碼的字串，都不會變更用戶端裝置上觸控控制項的狀態。在這些情況下，Content Test Application 可能會提供診斷資訊。

## 傳回值

類型：void

## 備註

此 API 會要求所有目前的遊戲串流用戶端在玩家的用戶端裝置上顯示特定的觸控控制項配置。如果玩家未串流遊戲，或是串流到未啟用觸控的裝置，此函式不會執行任何動作。

如果玩家使用實體控制器而非觸控控制項，此函式不會強制在其裝置上顯示觸控控制項。相反地，用戶端會在玩家下次開始使用觸控控制項時，使用最後要求的配置。

您可以將此函式視為給用戶端裝置的提示，告知其在玩家使用觸控控制項時，哪一個觸控控制項配置最適合目前的遊戲狀態。接著，用戶端裝置會自行管理何時最適合將這些控制項放到玩家的螢幕上。

每次呼叫 `XGameStreamingShowTouchControlLayout` 都會透過網路傳送一則訊息，因此不應在每個畫面都呼叫它。相反地，只在遊戲需要在不同的觸控控制項配置之間轉換時才呼叫此 API。

如果呼叫 `XGameStreamingShowTouchControlLayout` 時沒有任何用戶端裝置連線，則當用戶端連線時，它會收到最近一次要求的觸控控制項配置。

如果您的遊戲想要在**特定**已連線的串流用戶端裝置上顯示觸控控制項配置，請考慮改用 [XGameStreamingShowTouchControlLayoutOnClient](/zh-TW/reference/system/xgamestreaming/functions/xgamestreamingshowtouchcontrollayoutonclient)。

## 範例

```C++ theme={null}
void OnGameStateChanged(GameState newState)
{
    // Toggle to the set of touch overlay controls which best match the new state of the game
    switch (newState)
    {
    case GameState::FirstPersonAction:
        XGameStreamingShowTouchControlLayout("FirstPersonAction");
        break;
    case GameState::Driving:
        XGameStreamingShowTouchControlLayout("Driving");
        break;
    case GameState::CutScene:
        // Don't show any touch overlay controls while the cut scene is rendering
        XGameStreamingHideTouchControls();
        break;
    }
}
```

## 需求

**標頭：** xgamestreaming.h

**程式庫：** xgameruntime.lib

**支援的平台：** Windows、XBOX One 系列主機和 XBOX Series 主機

## 另請參閱

[XGameStreamingHideTouchControls](/zh-TW/reference/system/xgamestreaming/functions/xgamestreaminghidetouchcontrols)\
[XGameStreamingShowTouchControlLayoutOnClient](/zh-TW/reference/system/xgamestreaming/functions/xgamestreamingshowtouchcontrollayoutonclient)\
[XGameStreaming](/zh-TW/reference/system/xgamestreaming/xgamestreaming_members#TouchAdaptation)


## Related topics

- [XGameStreamingShowTouchControlLayout](/reference/system/xgamestreaming/functions/xgamestreamingshowtouchcontrollayout.md)
- [XGameStreamingShowTouchControlLayoutOnClient](/reference/system/xgamestreaming/functions/xgamestreamingshowtouchcontrollayoutonclient.md)
