diff --git a/README.md b/README.md
index 903dc1f..e031b6e 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@
玩法:
-1. 支持选关
-2. 支持自定义难度(待更新)
-3. 无限道具(待更新)
+1. 支持选择难度(4 种)
+2. 支持自定义难度
+3. 支持道具
diff --git a/package.json b/package.json
index 094852d..d702980 100644
--- a/package.json
+++ b/package.json
@@ -8,6 +8,7 @@
"preview": "vite preview"
},
"dependencies": {
+ "@ant-design/icons-vue": "^6.1.0",
"ant-design-vue": "^3.2.11",
"lodash": "^4.17.21",
"pinia": "^2.0.19",
diff --git a/src/assets/kunkun.png b/src/assets/kunkun.png
new file mode 100644
index 0000000..a761886
Binary files /dev/null and b/src/assets/kunkun.png differ
diff --git a/src/components/MyAd.vue b/src/components/MyAd.vue
new file mode 100644
index 0000000..6b82a4f
--- /dev/null
+++ b/src/components/MyAd.vue
@@ -0,0 +1,8 @@
+
+
+
+
+
diff --git a/src/core/game.ts b/src/core/game.ts
index c6a4dd8..e3f904c 100644
--- a/src/core/game.ts
+++ b/src/core/game.ts
@@ -6,12 +6,12 @@
import { useGlobalStore } from "./globalStore";
// @ts-ignore
import _ from "lodash";
-import { nextTick, ref } from "vue";
+import { ref } from "vue";
const useGame = () => {
const { gameConfig } = useGlobalStore();
- // 游戏状态:0 - 初始化, 1 - 进行中, 2 - 结束
+ // 游戏状态:0 - 初始化, 1 - 进行中, 2 - 失败结束, 3 - 胜利
const gameStatus = ref(0);
// 各层块
@@ -26,6 +26,12 @@ const useGame = () => {
// 保存所有块(包括随机块)
const blockData: Record = {};
+ // 总块数
+ let totalBlockNum = 0;
+
+ // 已消除块数
+ let clearBlockNum = 0;
+
// 总共划分 24 x 24 的格子,每个块占 3 x 3 的格子,生成的起始 x 和 y 坐标范围均为 0 ~ 21
const boxWidthNum = 24;
const boxHeightNum = 24;
@@ -86,7 +92,7 @@ const useGame = () => {
// 补齐到 blockNumUnit 的倍数
// e.g. minBlockNum = 14, blockNumUnit = 6, 补到 18
- let totalBlockNum = minBlockNum;
+ totalBlockNum = minBlockNum;
if (totalBlockNum % blockNumUnit !== 0) {
totalBlockNum =
(Math.floor(minBlockNum / blockNumUnit) + 1) * blockNumUnit;
@@ -325,6 +331,8 @@ const useGame = () => {
if (map[slotBlock.type] >= gameConfig.composeNum) {
// 块状态改为已消除
slotBlock.status = 2;
+ // 已消除块数 +1
+ clearBlockNum++;
return;
}
newSlotAreaVal[tempSlotNum++] = slotBlock;
@@ -338,6 +346,9 @@ const useGame = () => {
alert("你输了");
}, 2000);
}
+ if (clearBlockNum >= totalBlockNum) {
+ gameStatus.value = 3;
+ }
};
/**
diff --git a/src/pages/GamePage.vue b/src/pages/GamePage.vue
index 25e3adf..f969494 100644
--- a/src/pages/GamePage.vue
+++ b/src/pages/GamePage.vue
@@ -2,6 +2,11 @@
返回
+
+
+
恭喜,你赢啦!🎉
+
+