feat:Snake demo edit
This commit is contained in:
parent
33a671af85
commit
ae5287fd7e
@ -189,6 +189,10 @@ class SnakeView extends ViewHolder<SnakeModel> {
|
||||
textSize: 30,
|
||||
textAlignment: new Gravity().center(),
|
||||
bgColor: Color.parse('#ffff00'),
|
||||
layoutConfig: {
|
||||
widthSpec: LayoutSpec.EXACTLY,
|
||||
heightSpec: LayoutSpec.EXACTLY,
|
||||
},
|
||||
}).also(it => this.up = it)
|
||||
]).also(it => {
|
||||
it.layoutConfig = {
|
||||
@ -204,6 +208,10 @@ class SnakeView extends ViewHolder<SnakeModel> {
|
||||
textSize: 30,
|
||||
textAlignment: new Gravity().center(),
|
||||
bgColor: Color.parse('#ffff00'),
|
||||
layoutConfig: {
|
||||
widthSpec: LayoutSpec.EXACTLY,
|
||||
heightSpec: LayoutSpec.EXACTLY,
|
||||
},
|
||||
}).also(it => this.left = it),
|
||||
text({
|
||||
width: 50,
|
||||
@ -212,6 +220,10 @@ class SnakeView extends ViewHolder<SnakeModel> {
|
||||
textSize: 30,
|
||||
textAlignment: new Gravity().center(),
|
||||
bgColor: Color.parse('#ffff00'),
|
||||
layoutConfig: {
|
||||
widthSpec: LayoutSpec.EXACTLY,
|
||||
heightSpec: LayoutSpec.EXACTLY,
|
||||
},
|
||||
}).also(it => this.down = it),
|
||||
text({
|
||||
width: 50,
|
||||
@ -220,6 +232,10 @@ class SnakeView extends ViewHolder<SnakeModel> {
|
||||
textSize: 30,
|
||||
textAlignment: new Gravity().center(),
|
||||
bgColor: Color.parse('#ffff00'),
|
||||
layoutConfig: {
|
||||
widthSpec: LayoutSpec.EXACTLY,
|
||||
heightSpec: LayoutSpec.EXACTLY,
|
||||
},
|
||||
}).also(it => this.right = it),
|
||||
]).also(it => {
|
||||
it.layoutConfig = {
|
||||
@ -248,16 +264,6 @@ class SnakeView extends ViewHolder<SnakeModel> {
|
||||
}).in(root)
|
||||
}
|
||||
|
||||
buildController(text: string) {
|
||||
const ret = new Text
|
||||
ret.width = ret.height = 50
|
||||
ret.bgColor = Color.parse('#ffff00')
|
||||
ret.text = text
|
||||
ret.textSize = 30
|
||||
ret.textAlignment = new Gravity().center()
|
||||
return ret
|
||||
}
|
||||
|
||||
bind(state: SnakeModel): void {
|
||||
log('build', state)
|
||||
this.panel.width = state.width * 10
|
||||
|
Reference in New Issue
Block a user