Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

9.4 KB
Raw Blame
{
  "version": "2",
  "name": "VirtualButton",
  "rootEntityId": "0",
  "entities": [
    {
      "prefabEntityId": "0",
      "name": "VirtualButton",
      "parent": null,
      "children": [
        "1"
      ],
      "components": [
        {
          "type": "Transform",
          "data": {
            "position": {
              "x": 0,
              "y": 0,
              "z": 0
            },
            "rotation": {
              "w": 1,
              "x": 0,
              "y": 0,
              "z": 0
            },
            "scale": {
              "x": 1,
              "y": 1,
              "z": 1
            },
            "worldPosition": {
              "x": 0,
              "y": 0,
              "z": 0
            },
            "worldRotation": {
              "w": 1,
              "x": 0,
              "y": 0,
              "z": 0
            },
            "worldScale": {
              "x": 1,
              "y": 1,
              "z": 1
            }
          }
        },
        {
          "type": "UINode",
          "data": {
            "position": 1,
            "display": 0,
            "opacity": 1,
            "pointerEvents": 0,
            "width": {
              "value": 0,
              "unit": 2
            },
            "height": {
              "value": 0,
              "unit": 2
            },
            "minWidth": {
              "value": 0,
              "unit": 2
            },
            "minHeight": {
              "value": 0,
              "unit": 2
            },
            "maxWidth": {
              "value": 0,
              "unit": 2
            },
            "maxHeight": {
              "value": 0,
              "unit": 2
            },
            "flexGrow": 0,
            "flexShrink": 1,
            "flexBasis": {
              "value": 0,
              "unit": 2
            },
            "alignSelf": 0,
            "marginLeft": {
              "value": 0,
              "unit": 0
            },
            "marginTop": {
              "value": 0,
              "unit": 0
            },
            "marginRight": {
              "value": 0,
              "unit": 0
            },
            "marginBottom": {
              "value": 0,
              "unit": 0
            },
            "insetLeft": {
              "value": 0,
              "unit": 0
            },
            "insetTop": {
              "value": 0,
              "unit": 0
            },
            "insetRight": {
              "value": 0,
              "unit": 0
            },
            "insetBottom": {
              "value": 0,
              "unit": 0
            }
          }
        },
        {
          "type": "UIVisual",
          "data": {
            "visualType": 1,
            "texture": 0,
            "color": {
              "r": 1,
              "g": 1,
              "b": 1,
              "a": 1
            },
            "fit": 0,
            "uvOffset": {
              "x": 0,
              "y": 0
            },
            "uvScale": {
              "x": 1,
              "y": 1
            },
            "sliceBorder": {
              "x": 0,
              "y": 0,
              "z": 0,
              "w": 0
            },
            "tileSize": {
              "x": 32,
              "y": 32
            },
            "fillMethod": 0,
            "fillOrigin": 0,
            "fillAmount": 1,
            "material": 0,
            "enabled": true
          }
        },
        {
          "type": "Interactable",
          "data": {
            "enabled": true,
            "blockRaycast": true,
            "raycastTarget": true
          }
        },
        {
          "type": "UIController",
          "data": {
            "controllers": [
              {
                "name": "$interaction",
                "pages": [
                  "normal",
                  "hover",
                  "pressed",
                  "disabled",
                  "focused"
                ],
                "current": "normal"
              }
            ]
          }
        },
        {
          "type": "UIGear",
          "data": {
            "bindings": [
              {
                "controller": "$interaction",
                "component": "UIVisual",
                "property": "color",
                "pages": {
                  "normal": {
                    "r": 0.22,
                    "g": 0.22,
                    "b": 0.26,
                    "a": 1
                  },
                  "hover": {
                    "r": 0.28,
                    "g": 0.28,
                    "b": 0.32,
                    "a": 1
                  },
                  "pressed": {
                    "r": 0.18,
                    "g": 0.18,
                    "b": 0.22,
                    "a": 1
                  },
                  "disabled": {
                    "r": 0.22,
                    "g": 0.22,
                    "b": 0.26,
                    "a": 0.5
                  },
                  "focused": {
                    "r": 0.3,
                    "g": 0.34,
                    "b": 0.44,
                    "a": 1
                  }
                }
              }
            ]
          }
        },
        {
          "type": "ThemeStyle",
          "data": {
            "states": {
              "normal": "control",
              "hover": "controlHover",
              "pressed": "controlActive",
              "disabled": "control",
              "focused": "controlFocus"
            }
          }
        },
        {
          "type": "VirtualButton",
          "data": {
            "inputId": "fire",
            "value": 1
          }
        }
      ],
      "visible": true
    },
    {
      "prefabEntityId": "1",
      "name": "Label",
      "parent": "0",
      "children": [],
      "components": [
        {
          "type": "Transform",
          "data": {
            "position": {
              "x": 0,
              "y": 0,
              "z": 0
            },
            "rotation": {
              "w": 1,
              "x": 0,
              "y": 0,
              "z": 0
            },
            "scale": {
              "x": 1,
              "y": 1,
              "z": 1
            },
            "worldPosition": {
              "x": 0,
              "y": 0,
              "z": 0
            },
            "worldRotation": {
              "w": 1,
              "x": 0,
              "y": 0,
              "z": 0
            },
            "worldScale": {
              "x": 1,
              "y": 1,
              "z": 1
            }
          }
        },
        {
          "type": "UINode",
          "data": {
            "position": 1,
            "display": 0,
            "opacity": 1,
            "pointerEvents": 0,
            "width": {
              "value": 0,
              "unit": 2
            },
            "height": {
              "value": 0,
              "unit": 2
            },
            "minWidth": {
              "value": 0,
              "unit": 2
            },
            "minHeight": {
              "value": 0,
              "unit": 2
            },
            "maxWidth": {
              "value": 0,
              "unit": 2
            },
            "maxHeight": {
              "value": 0,
              "unit": 2
            },
            "flexGrow": 0,
            "flexShrink": 1,
            "flexBasis": {
              "value": 0,
              "unit": 2
            },
            "alignSelf": 0,
            "marginLeft": {
              "value": 0,
              "unit": 0
            },
            "marginTop": {
              "value": 0,
              "unit": 0
            },
            "marginRight": {
              "value": 0,
              "unit": 0
            },
            "marginBottom": {
              "value": 0,
              "unit": 0
            },
            "insetLeft": {
              "value": 0,
              "unit": 0
            },
            "insetTop": {
              "value": 0,
              "unit": 0
            },
            "insetRight": {
              "value": 0,
              "unit": 0
            },
            "insetBottom": {
              "value": 0,
              "unit": 0
            }
          }
        },
        {
          "type": "Text",
          "data": {
            "content": "Fire",
            "i18nKey": "",
            "font": 0,
            "fontFamily": "",
            "fontSize": 14,
            "color": {
              "r": 0.92,
              "g": 0.92,
              "b": 0.94,
              "a": 1
            },
            "align": 1,
            "verticalAlign": 1,
            "wordWrap": false,
            "overflow": 0,
            "lineHeight": 1.2,
            "bold": false,
            "italic": false,
            "strokeColor": {
              "r": 0,
              "g": 0,
              "b": 0,
              "a": 1
            },
            "strokeWidth": 0,
            "shadowColor": {
              "r": 0,
              "g": 0,
              "b": 0,
              "a": 1
            },
            "shadowBlur": 0,
            "shadowOffsetX": 0,
            "shadowOffsetY": 0,
            "richText": false,
            "renderMode": 0,
            "layer": 0,
            "boxWidth": 0,
            "boxHeight": 0,
            "boxPivot": {
              "x": 0.5,
              "y": 0.5
            },
            "enabled": true
          }
        },
        {
          "type": "ThemeStyle",
          "data": {
            "text": "text"
          }
        }
      ],
      "visible": true
    }
  ]
}