Canvas
节点下新建Sprite (单色)
并重命名为btnRestart
,Position
设置为280
和402
,Size
设置为150x60
,Color
设置为#A69A91
,挂载Button
组件并设置Transation
属性为Scale
、Zoom Scale
属性为1.1
。
btnRestart
节点下新建Label (文字)
,String
输入重新开始
,Font Size
和Line Height
都设置为30
。
编辑scripts/Game.ts
,修改init
方法,添加点击重新开始
按钮的逻辑。
this.showScore()
const btnRestart = this.node.getChildByName('btnRestart')
btnRestart.on('click', () => cc.game.restart())
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。