|
|
@@ -168,6 +168,7 @@ const CONFIG = {
|
|
|
//提示语
|
|
|
TIPS: {
|
|
|
NO_ENTRY: '当前位置无通路,无法移动',
|
|
|
+ UNFINISHED: '任务未完成!',
|
|
|
FINISH: '恭喜你到达终点!',
|
|
|
}
|
|
|
};
|
|
|
@@ -806,7 +807,7 @@ window.pickupItem = async function() {
|
|
|
let tileMap = walkablePointsMap.get(`${x},${y}`);
|
|
|
|
|
|
// 判断是否是要拾取的方块类型
|
|
|
- if (tileMap && tileMap.type === BLOCKLY_MAP_TYPE_DICT.YC) {
|
|
|
+ if (tileMap && tileMap.type) {
|
|
|
showGameMessage(tileMap.tip || '成功拾取物品!', 'warning')
|
|
|
|
|
|
// 处理携带物品逻辑
|
|
|
@@ -872,7 +873,8 @@ window.useItem = async function() {
|
|
|
if (pointIndex !== -1) {
|
|
|
// 保留点但移除img属性
|
|
|
const updatedPoint = { ...gameState.mapData.walkablePoints[pointIndex] };
|
|
|
- updatedPoint.img = updatedPoint.deenImg;
|
|
|
+ updatedPoint.img = updatedPoint.needImg;
|
|
|
+ updatedPoint.status = true;
|
|
|
gameState.mapData.walkablePoints.splice(pointIndex, 1, updatedPoint);
|
|
|
|
|
|
// 更新映射
|
|
|
@@ -1086,6 +1088,16 @@ window.isFinish = async function() {
|
|
|
}
|
|
|
|
|
|
if (gameState.player.position.x === endPoint.value.x && gameState.player.position.y === endPoint.value.y) {
|
|
|
+
|
|
|
+ //检查是否有未完成的任务点
|
|
|
+ const pointIndex = gameState.mapData.walkablePoints.findIndex(
|
|
|
+ p => p.need !== undefined && p.need !== null && p.need !== "" && p.status !== true
|
|
|
+ );
|
|
|
+ if (pointIndex !== -1) {
|
|
|
+ showGameMessage(CONFIG.TIPS.UNFINISHED, 'error');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
gameState.player.hasReachedEnd = true;
|
|
|
showGameMessage(CONFIG.TIPS.FINISH, 'success' );
|
|
|
}
|