create 命令用來建立觸控調整組合的來源內容 (簡稱未封裝的組合),或將新配置新增至現有的未封裝組合。
這是開始為遊戲新增觸控調整功能的快速入口。
下表顯示可搭配 create 命令使用的各種子命令。請注意,create 命令無法單獨使用,必須提供子命令。
Create Bundle
create bundle 子命令可快速建立新觸控調整組合所需的所有來源內容。如果遊戲尚無現有的未封裝組合,這就是開始使用觸控調整的起點。
它會建立開始使用新組合所需的所有目錄和檔案。這包括根 layouts 目錄 (包含不同語言的 JSON 配置檔案)、根 assets 目錄 (包含每種語言各種 DPI 的資產)、描述組合的根組合設定檔案 (takxconfig.json),以及用於動態配置狀態和可重複使用配置定義的空白內容 (context) 檔案。
選項
使用下表中的選項來設定未封裝觸控調整組合的建立方式。| 選項 | 描述 |
|---|---|
--destination--name | 必要。放置未封裝組合的目的地路徑。這可以是簡單名稱或完整路徑。 [!NOTE] 如果目的地中已有任何檔案或目錄,必須使用 --overwrite-destination 選項先將其刪除。[!NOTE] 如果使用簡單名稱而非路徑,建立的組合會放在目前的工作目錄中。 |
--layouts-directory-name--layouts-dir--layouts | 用來儲存觸控控制配置的子目錄名稱。這是根 layouts 目錄。 預設值: layouts。 |
--assets-directory-name--assets-dir--assets | 用來儲存觸控控制資產的子目錄名稱。這是根 assets 目錄。 預設值: assets。 |
--layout-languages | IETF 語言標記清單,用於在根 layouts 目錄下建立語言目錄。一律會建立 neutral。預設值:空白清單。 |
--asset-languages | IETF 語言標記清單,用於在根 assets 目錄下建立語言目錄。一律會建立 neutral。預設值:空白清單。 |
--version | 組合的內容版本。 預設值: 1.0.0.0。 |
--version-name | 組合內容版本的名稱。 預設值:空字串。 |
--context-file-name--context-file--context | 組合的內容檔案名稱。 預設值: context.json。 |
--templates | 建立時要新增至組合的一或多個範本配置清單。範本一律會新增至 neutral 配置語言目錄,以及與 --layout-languages 中所指定語言對應的任何語言目錄。檢視可用範本清單。 預設值: Blank。 |
--no-templates | 不要將任何範本新增至組合。如果已指定 --templates,則無法使用。預設值: false。 |
--overwrite-destination--overwrite | 刪除目的地中任何先前的內容。如果目的地不是空的,則此選項為必要。 預設值: false。 |
範例
下列範例示範如何建立新的未封裝觸控調整組合。使用預設的空白範本建立簡單的新未封裝組合
D:\CreateBundleExamples> tak create bundle --name SampleBundle
Creating loose touch adaptation bundle 'SampleBundle'.
Creating bundle config file.
Creating layouts and assets directories.
Creating language directories.
Creating context file.
Added 1 templates to bundle.
Created loose touch adaptation bundle at 'D:\CreateBundleExamples\SampleBundle'.
D:.
└───CreateBundleExamples
└───SampleBundle
│ context.json
│ takxconfig.json
│
├───assets
│ └───neutral
│ ├───@1.0x
│ ├───@1.5x
│ ├───@2.0x
│ ├───@3.0x
│ └───@4.0x
└───layouts
└───neutral
blank.json
在不同的磁碟機中建立新組合,並使用一些配置語言、範本和自訂目錄名稱
C:\> tak create bundle --destination D:\CreateBundleExamples\SomeFolder\AnotherFolder\SampleBundle --layout-languages fr fr-FR en-US --templates Menu Cinematic RacingBasic RacingAdvanced --layouts-dir touch-control-layouts --assets-dir touch-control-assets --context-file touch-control-context
Creating loose touch adaptation bundle 'SampleBundle'.
Creating bundle config file.
Creating layouts and assets directories.
Creating language directories.
Creating context file.
Added 4 templates to bundle.
Created loose touch adaptation bundle at 'D:\CreateBundleExamples\SomeFolder\AnotherFolder\SampleBundle'.
D:.
└───CreateBundleExamples
└───SomeFolder
└───AnotherFolder
└───SampleBundle
│ takxconfig.json
│ touch-control-context.json
│
├───touch-control-assets
│ └───neutral
│ ├───@1.0x
│ ├───@1.5x
│ ├───@2.0x
│ ├───@3.0x
│ └───@4.0x
└───touch-control-layouts
├───en
│ └───en-US
│ cinematic.json
│ menu.json
│ racing-advanced.json
│ racing-basic.json
│
├───fr
│ │ cinematic.json
│ │ menu.json
│ │ racing-advanced.json
│ │ racing-basic.json
│ │
│ └───fr-FR
│ cinematic.json
│ menu.json
│ racing-advanced.json
│ racing-basic.json
│
└───neutral
cinematic.json
menu.json
racing-advanced.json
racing-basic.json
在此命令中,透過 —layout-languages 選項同時指定 ‘fr’ 和 ‘fr-FR’,會使範本新增至各個對應的目錄。不過,由於只指定了 ‘en-US’,範本只會新增至 ‘en-US’ 目錄,而不會新增至上層的 ‘en’ 目錄。無論如何指定,範本一律會新增至 neutral 目錄。
takxconfig.json) 會反映傳遞給 create bundle 命令的參數所代表的設定。
{
"$schema": "https://raw.githubusercontent.com/microsoft/xbox-game-streaming-tools/main/touch-adaptation-kit/schemas/takxconfig/v1/takxconfig.json",
"layouts": {
"path": "touch-control-layouts"
},
"assets": {
"path": "touch-control-assets"
},
"context": {
"path": "touch-control-context.json"
},
"version": "1.0.0.0",
"versionName": "Initial"
}
Create Layout
create layout 子命令可將新配置新增至現有的未封裝組合。create bundle 產生的輸出可做為 create layout 的輸入,方法是將在未封裝組合根目錄建立的 takxconfig.json 檔案提供為 --takx-config-file 選項的值。
與 create bundle 類似,此命令可使用範本來建立配置,或預設為 Blank。也支援將配置新增至多個配置語言目錄,而且關於檔案不得已存在或必須使用 --overwrite 的相同規則也同樣適用。
選項
使用下表中的選項來設定在未封裝觸控調整組合中建立配置的方式。| 選項 | 描述 |
|---|---|
--takx-config-file--takxconfig | 必要。組合設定檔案的路徑。必須命名為 takxconfig.json。 |
--name | 配置的名稱。這也會是其檔案名稱。 建議依照最符合遊戲的方式為配置命名。 預設值:所使用範本的名稱 (例如 shooter-basic.json)。 |
--languages | 要新增配置的 IETF 語言標記清單。無論此處傳遞的值為何,配置一律會新增至 neutral 配置語言目錄。如果此處指定的語言標記在根 layouts 目錄下找不到相符的目錄,系統將會建立該目錄。預設值:空白清單。 |
--all-languages--all | 在組合設定檔案 (takxconfig.json) 中所指定根 layouts 目錄下找到的所有語言子目錄中建立配置。指定 --languages 時無法設定為 true。預設值: false |
--template | 配置要使用的範本。 檢視可用範本清單。 預設值: Blank |
--overwrite | 覆寫任何名稱相同的現有配置檔案。 如果根 layouts 目錄下的任何語言子目錄包含名稱相同的 JSON 檔案,則此選項為必要。例如,如果 --name 為 test、--languages 設定為 en-US,而 en-US 目錄不包含名為 test.json 的檔案但 neutral 包含,則未指定 --overwrite 時命令將不會執行。預設值: false |
--set-default--default | 在組合設定檔案 (takxconfig.json) 中,將建立的配置設定為預設配置。預設值: false |
範例
下列範例示範如何在現有的未封裝觸控調整組合中建立新配置。使用預設的
Blank 範本建立簡單的新配置。
D:\CreateLayoutExamples\SampleBundle> tak create layout --name sample-layout --takxconfig .\takxconfig.json
Verifying bundle configuration file (takxconfig.json).
Verification complete. 0 error(s), 0 warning(s) and 0 note(s) found.
Created layout 'sample-layout' using template 'Blank' in 1 directories.
D:.
└───CreateLayoutExample
└───SampleBundle
│ context.json
│ takxconfig.json
│
└───layouts
└───neutral
sample-layout.json
使用特定範本,為組合中的數種語言建立新配置。
D:\CreateLayoutExamples> tak create layout --takxconfig .\SampleBundle\takxconfig.json --template ShooterBasic --languages ja-JP en en-US
Verifying bundle configuration file (takxconfig.json).
Verification complete. 0 error(s), 0 warning(s) and 0 note(s) found.
WARNING: A language directory for 'ja-JP' does not exist under the root layouts directory. It will be created, as well as any relevant parenting directories if applicable to the language.
WARNING: A language directory for 'en' does not exist under the root layouts directory. It will be created, as well as any relevant parenting directories if applicable to the language.
WARNING: A language directory for 'en-US' does not exist under the root layouts directory. It will be created, as well as any relevant parenting directories if applicable to the language.
Created layout 'shooter-basic' using template 'ShooterBasic' in 4 directories.
D:.
└───CreateLayoutExample
└───SampleBundle
│ context.json
│ takxconfig.json
│
└───layouts
├───en
│ │ shooter-basic.json
│ │
│ └───en-US
│ shooter-basic.json
│
├───ja
│ └───ja-JP
│ shooter-basic.json
│
└───neutral
shooter-basic.json
配置建立在 ‘en’ 目錄中,但未建立在 ‘ja’ 目錄中,因為只有前者是為 ‘—languages’ 參數所指定的。
為所有語言建立新配置
D:\CreateLayoutExamples> tak create layout --takxconfig .\SampleBundle\takxconfig.json --all-languages
Verifying bundle configuration file (takxconfig.json).
Verification complete. 0 error(s), 0 warning(s) and 0 note(s) found.
Created layout 'blank' using template 'Blank' in 5 directories.
D:.
└───SampleBundle
│ context.json
│ takxconfig.json
│
└───layouts
├───en
│ │ blank.json
│ │ shooter-basic.json
│ │
│ └───en-US
│ blank.json
│ shooter-basic.json
│
├───ja
│ │ blank.json
│ │
│ └───ja-JP
│ blank.json
│ shooter-basic.json
│
└───neutral
blank.json
shooter-basic.json
