Skip to content

Commit

Permalink
Add v4.0 and localized schema contents (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
bbowman authored Mar 4, 2023
1 parent ec4b92a commit 2f8d6a1
Show file tree
Hide file tree
Showing 12 changed files with 23,261 additions and 132 deletions.
163 changes: 163 additions & 0 deletions touch-adaptation-kit/schemas/context/v4.0/context.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
{
"$schema": "https://json-schema.org/draft/2019-09/schema",
"properties": {
"allowedStateValues": {
"$ref": "#/$defs/AllowedStateValues"
},
"state": {
"$ref": "#/$defs/State"
},
"$schema": {
"type": "string"
},
"definitions": {
"$ref": "#/$defs/Definitions"
},
"styles": {
"$ref": "#/$defs/ContextStyles"
}
},
"title": "Touch Adaptation Bundle Context Schema",
"description": "A touch adaptation bundle context is the file that contains global, reusable state and definitions which can be referenced by other layouts. This allows for common schema snippets to be reused and for the touch controls to respond dynamically to game state. For the latest information on the changes between versions, see https://github.com/microsoft/xbox-game-streaming-tools/releases.",
"markdownDescription": "A touch adaptation bundle context is the file that contains global, reusable state and definitions which can be referenced by other layouts. This allows for common schema snippets to be reused and for the touch controls to respond dynamically to game state. For the latest information on the changes between versions, see https://github.com/microsoft/xbox-game-streaming-tools/releases.",
"additionalProperties": false,
"$id": "https://raw.githubusercontent.com/microsoft/xbox-game-streaming-tools/main/touch-adaptation-kit/schemas/context/v4.0/context.json",
"$defs": {
"State": {
"markdownDescription": "This property is used to contain all of the dynamic state of the touch bundle by specifying custom named properties with primitive values. The `XGameStreamingUpdateTouchControlsState` API can be used to update the values in the section at runtime. This can be useful to match the exact state of the player's game to the controls being displayed, for instance when a player acquires new skills or customizes their control preferences. Most places in the touch layout that use a primitive string, number, or boolean type allow for dynamic replacement by defining the value as a `$ref` back to this state block.",
"additionalProperties": false,
"description": "This property is used to contain all of the dynamic state of the touch bundle by specifying custom named properties with primitive values. The `XGameStreamingUpdateTouchControlsState` API can be used to update the values in the section at runtime. This can be useful to match the exact state of the player's game to the controls being displayed, for instance when a player acquires new skills or customizes their control preferences. Most places in the touch layout that use a primitive string, number, or boolean type allow for dynamic replacement by defining the value as a `$ref` back to this state block.",
"title": "Touch Bundle State",
"examples": [
{},
{
"inventorySlotEnabled": true,
"inventorySlotForegroundImage": "InventoryForeground",
"inventorySlotBackgroundImage": "InventoryBackground"
}
],
"patternProperties": {
"^(?!__proto__)[a-zA-Z0-9\\.\\-_]+$": {
"$ref": "#/$defs/StateType"
}
},
"type": "object"
},
"StateType": {
"description": "This property is an individual item that appears in the `state` configuration. Its value must be a primitive string, number, or boolean. Use the name of the item and a value of matching type when calling `XGameStreamingUpdateTouchControlsState` to update the state dynamically.",
"anyOf": [
{
"type": "string"
},
{
"type": "boolean"
},
{
"type": "integer"
},
{
"type": "number"
}
],
"title": "Touch Bundle State Item",
"examples": [
"customAssetName",
false,
true,
1,
0
],
"markdownDescription": "This property is an individual item that appears in the `state` configuration. Its value must be a primitive string, number, or boolean. Use the name of the item and a value of matching type when calling `XGameStreamingUpdateTouchControlsState` to update the state dynamically."
},
"ContextStyles": {
"description": "This property defines reusable styles which can be referenced within the layouts in this touch adaption bundle for styling purposes. If an equivalent `styles` property is defined in a given layout file, the contents of each will be merged. If a duplicate definition is found, the definition in the layout is preferred, overwriting the definition in the context file.",
"title": "Styles",
"$ref": "../../layout/v4.0/layout.json#/$defs/_LayoutStyles",
"markdownDescription": "This property defines reusable styles which can be referenced within the layouts in this touch adaption bundle for styling purposes. If an equivalent `styles` property is defined in a given layout file, the contents of each will be merged. If a duplicate definition is found, the definition in the layout is preferred, overwriting the definition in the context file."
},
"ContextDefinableType": {
"description": "Union type that includes all types which can be used in the `definitions` section of this file. See the `definitions` section for more information",
"anyOf": [
{
"$ref": "../../layout/v4.0/layout.json#/$defs/LayoutDefinableType"
},
{
"$ref": "#/$defs/StateType"
},
{
"type": "array",
"items": {
"$ref": "#/$defs/StateType"
}
}
],
"title": "Definable Types",
"markdownDescription": "Union type that includes all types which can be used in the `definitions` section of this file. See the `definitions` section for more information"
},
"AllowedStateValues": {
"markdownDescription": "This property is used to provide additional metadata on the set of possible values, like different asset file names, when using dynamic state. This is used for validation purposes to help ensure that all values will result in a valid touch layout and that no additional bundle files, like assets, are missing or unused. Note that this property is not used at runtime and any state change operations that result in an invalid layout will be ignored. It is therefore critical to test with a wide range of values to ensure proper operation in all cases.",
"additionalProperties": false,
"description": "This property is used to provide additional metadata on the set of possible values, like different asset file names, when using dynamic state. This is used for validation purposes to help ensure that all values will result in a valid touch layout and that no additional bundle files, like assets, are missing or unused. Note that this property is not used at runtime and any state change operations that result in an invalid layout will be ignored. It is therefore critical to test with a wide range of values to ensure proper operation in all cases.",
"title": "Touch Bundle Allowed State Values",
"examples": [
{},
{
"inventorySlotBackgroundImage": {
"$ref": "#/definitions/AllowedBackgroundImages"
},
"inventorySlotForegroundImage": [
"InventoryForegroundFireballSpell",
"InventoryForegroundLightningBoltSpell"
]
}
],
"patternProperties": {
"^(?!__proto__)[a-zA-Z0-9\\.\\-_]+$": {
"anyOf": [
{
"type": "array",
"items": {
"$ref": "#/$defs/StateType"
}
},
{
"$ref": "../../layout/v4.0/layout.json#/$defs/Reference"
}
]
}
},
"type": "object"
},
"Definitions": {
"markdownDescription": "A section that can be used to contain reusable components and values for touch layouts. These definitions can be later referenced with a JSON reference like `{ \"$ref\": \"#/definitions/joystickKnobStyle\" }`. JSON references are supported for nearly every part of the layout schema enabling common elements, like a common button background used across several controls, to be factored out and reused. Note that the context file also supports the `definitions` property, as well as `state`, to reuse components across layouts.",
"additionalProperties": false,
"description": "A section that can be used to contain reusable components and values for touch layouts. These definitions can be later referenced with a JSON reference like `{ \"$ref\": \"#/definitions/joystickKnobStyle\" }`. JSON references are supported for nearly every part of the layout schema enabling common elements, like a common button background used across several controls, to be factored out and reused. Note that the context file also supports the `definitions` property, as well as `state`, to reuse components across layouts.",
"title": "Definitions",
"examples": [
{},
{
"joystickKnob": {
"default": {
"knob": {
"faceImage": {
"type": "asset",
"value": {
"$ref": "#/$defs/joystickAssetName"
}
}
}
}
},
"joystickAssetName": "exampleAssetName"
}
],
"patternProperties": {
"^(?!__proto__)[a-zA-Z0-9\\.\\-_]+$": {
"$ref": "#/$defs/ContextDefinableType"
}
},
"type": "object"
}
},
"type": "object"
}
Loading

0 comments on commit 2f8d6a1

Please sign in to comment.