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