|
@@ -257,7 +257,7 @@ class TestView extends SCanvasView {
|
|
}
|
|
}
|
|
// 更新视图
|
|
// 更新视图
|
|
this.update();
|
|
this.update();
|
|
- } // Function onKeyDown()
|
|
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* Item 绘制操作
|
|
* Item 绘制操作
|
|
@@ -316,7 +316,7 @@ class TestView extends SCanvasView {
|
|
}
|
|
}
|
|
this.map.push(m1);
|
|
this.map.push(m1);
|
|
}
|
|
}
|
|
- } // Function initMap()
|
|
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 初始化方块形状
|
|
* 初始化方块形状
|
|
@@ -329,7 +329,7 @@ class TestView extends SCanvasView {
|
|
this.boxType = Number(Math.floor(Math.random() * 7));
|
|
this.boxType = Number(Math.floor(Math.random() * 7));
|
|
this.dir = Number(Math.floor(Math.random() * 4));
|
|
this.dir = Number(Math.floor(Math.random() * 4));
|
|
this.initColor();
|
|
this.initColor();
|
|
- } // Function initBox()
|
|
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 初始化方块颜色
|
|
* 初始化方块颜色
|
|
@@ -339,7 +339,7 @@ class TestView extends SCanvasView {
|
|
const b = Number(Math.floor(Math.random() * 128));
|
|
const b = Number(Math.floor(Math.random() * 128));
|
|
const c = Number(Math.floor(Math.random() * 128));
|
|
const c = Number(Math.floor(Math.random() * 128));
|
|
this.boxColor = new SColor(a, b, c);
|
|
this.boxColor = new SColor(a, b, c);
|
|
- } // Function initColor()
|
|
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 绘制背景
|
|
* 绘制背景
|
|
@@ -354,7 +354,7 @@ class TestView extends SCanvasView {
|
|
this.drawShape(painter, row, col, this.map[row][col]);
|
|
this.drawShape(painter, row, col, this.map[row][col]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- } // Function drawMap()
|
|
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 绘制实体图形
|
|
* 绘制实体图形
|
|
@@ -380,7 +380,7 @@ class TestView extends SCanvasView {
|
|
painter.drawRoundRect(x, y, 28, 28, 6);
|
|
painter.drawRoundRect(x, y, 28, 28, 6);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
- } // Function drawShape()
|
|
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 绘制方块
|
|
* 绘制方块
|
|
@@ -393,7 +393,7 @@ class TestView extends SCanvasView {
|
|
this.drawShape(painter, row + this.y, col + this.x, this.box[this.boxType * 4 + this.dir][row][col]);
|
|
this.drawShape(painter, row + this.y, col + this.x, this.box[this.boxType * 4 + this.dir][row][col]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- } // Function drawBox()
|
|
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 是否碰撞
|
|
* 是否碰撞
|
|
@@ -414,7 +414,7 @@ class TestView extends SCanvasView {
|
|
}
|
|
}
|
|
// 返回不发生碰撞
|
|
// 返回不发生碰撞
|
|
return false;
|
|
return false;
|
|
- } // Function checkKnocked()
|
|
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 将方块合到背景中
|
|
* 将方块合到背景中
|
|
@@ -436,7 +436,7 @@ class TestView extends SCanvasView {
|
|
}
|
|
}
|
|
|
|
|
|
this.remove();
|
|
this.remove();
|
|
- } // Function fillMap()
|
|
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 消除满行
|
|
* 消除满行
|
|
@@ -472,7 +472,7 @@ class TestView extends SCanvasView {
|
|
// 底部随机产生一行
|
|
// 底部随机产生一行
|
|
this.map.splice(19, 0, this.randomRow());
|
|
this.map.splice(19, 0, this.randomRow());
|
|
}
|
|
}
|
|
- } // Function remove()
|
|
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 随机数组生成
|
|
* 随机数组生成
|
|
@@ -487,7 +487,7 @@ class TestView extends SCanvasView {
|
|
}
|
|
}
|
|
|
|
|
|
return array;
|
|
return array;
|
|
- } // Function randomRow()
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
@Component
|
|
@Component
|