|
@@ -60,6 +60,11 @@
|
|
|
</image>
|
|
|
</view>
|
|
|
|
|
|
+ <!-- 引导箭头 -->
|
|
|
+ <view class="guide-arrow" v-if="showGuideArrow" :style="{ left: guideArrowPosition.x + 'rpx', bottom: guideArrowPosition.y + 'rpx', transform: `rotate(${guideArrowPosition.r}deg)` }">
|
|
|
+ <image src="/static/island/arrow.png" mode="aspectFit"></image>
|
|
|
+ </view>
|
|
|
+
|
|
|
<!-- 回家箭头 -->
|
|
|
<view class="home-arrow" @click="goHome" :animation="homeArrowAnimation"
|
|
|
:style="{ opacity: homeArrowVisible ? 1 : 0 }">
|
|
@@ -101,6 +106,15 @@
|
|
|
<hua-tian :visible.sync="huaTianVisible" @close="onHuaTianClose" ref="huaTian"></hua-tian>
|
|
|
<task-dialog :visible.sync="taskDialogVisible" @close="onTaskDialogClose" type="huatian"></task-dialog>
|
|
|
|
|
|
+ <!-- 引导对话组件 -->
|
|
|
+ <talk-guide
|
|
|
+ v-if="showTalkGuide"
|
|
|
+ :guide-data="currentTalkData"
|
|
|
+ :player-name="playerName"
|
|
|
+ :visible="showTalkGuide"
|
|
|
+ @talk-complete="onTalkComplete"
|
|
|
+ ></talk-guide>
|
|
|
+
|
|
|
<!-- 引导管理器 -->
|
|
|
<guide-manager ref="guideManager"></guide-manager>
|
|
|
</view>
|
|
@@ -114,6 +128,7 @@ import CharacterDialog from '@/components/dialogs/CharacterDialog.vue'
|
|
|
import ShopDialog from '@/components/dialogs/ShopDialog.vue'
|
|
|
import HuaTian from './HuaTian.vue'
|
|
|
import TaskDialog from './TaskDialog.vue'
|
|
|
+import TalkGuide from './talkGuide.vue'
|
|
|
import GuideManager from '@/components/guide/GuideManager.vue'
|
|
|
|
|
|
export default {
|
|
@@ -123,6 +138,7 @@ export default {
|
|
|
ShopDialog,
|
|
|
HuaTian,
|
|
|
TaskDialog,
|
|
|
+ TalkGuide,
|
|
|
GuideManager
|
|
|
},
|
|
|
data() {
|
|
@@ -162,6 +178,13 @@ export default {
|
|
|
homeArrowAnimating: false,
|
|
|
homeArrowVisible: false,
|
|
|
currentShopName: '商店',
|
|
|
+ // 引导相关数据
|
|
|
+ showTalkGuide: false,
|
|
|
+ currentTalkData: [],
|
|
|
+ playerName: '梦幻',
|
|
|
+ // 引导箭头相关
|
|
|
+ showGuideArrow: false,
|
|
|
+ guideArrowPosition: { x: 0, y: 0, r: 0 }
|
|
|
}
|
|
|
},
|
|
|
onLoad() {
|
|
@@ -181,7 +204,8 @@ export default {
|
|
|
}, 2000);
|
|
|
},
|
|
|
onShow() {
|
|
|
- // this.loadData();
|
|
|
+ // 检查是否需要显示引导
|
|
|
+ this.checkAndShowGuide('mainLand');
|
|
|
},
|
|
|
onReady() {
|
|
|
// 在组件渲染完成后获取图片尺寸
|
|
@@ -329,6 +353,9 @@ export default {
|
|
|
this.huaTianVisible = true;
|
|
|
// 将mainLand传递给HuaTian组件
|
|
|
this.$refs.huaTian && this.$refs.huaTian.setMainLand(this);
|
|
|
+
|
|
|
+ // 检查是否需要显示引导
|
|
|
+ this.checkAndShowGuide('mainLand_farm');
|
|
|
},
|
|
|
|
|
|
onShopClick(event) {
|
|
@@ -499,12 +526,78 @@ export default {
|
|
|
},
|
|
|
|
|
|
// 检查并显示引导
|
|
|
- checkAndShowGuide() {
|
|
|
+ checkAndShowGuide(stageId) {
|
|
|
+ console.log('checkAndShowGuide stageId :', stageId);
|
|
|
// 延迟执行以确保DOM已经渲染
|
|
|
setTimeout(() => {
|
|
|
- this.$refs.guideManager && this.$refs.guideManager.startGuide('mainLand');
|
|
|
- }, 500);
|
|
|
+ if (this.$refs.guideManager) {
|
|
|
+ const hasGuide = this.$refs.guideManager.startGuide(stageId);
|
|
|
+ console.log('checkAndShowGuide hasGuide :', hasGuide);
|
|
|
+ if (hasGuide) {
|
|
|
+ this.currentTalkData = this.$refs.guideManager.getCurrentTalkData();
|
|
|
+ console.log('checkAndShowGuide currentTalkData :', this.currentTalkData);
|
|
|
+ if (this.currentTalkData) {
|
|
|
+ this.showTalkGuide = true;
|
|
|
+ // 检查是否需要显示引导箭头
|
|
|
+ this.checkAndShowGuideArrow();
|
|
|
+ }else{
|
|
|
+ console.log('currentTalkData err:', this.currentTalkData);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, 200);
|
|
|
+ },
|
|
|
+
|
|
|
+ // 对话完成回调
|
|
|
+ onTalkComplete() {
|
|
|
+ // 调用引导管理器的下一步
|
|
|
+ console.log('----------- onTalkComplete');
|
|
|
+ this.$refs.guideManager && this.$refs.guideManager.nextStep();
|
|
|
+
|
|
|
+ // 获取新的对话数据
|
|
|
+ const newTalkData = this.$refs.guideManager.getCurrentTalkData();
|
|
|
+ console.log('----------- onTalkComplete newTalkData:', newTalkData);
|
|
|
+ if (newTalkData) {
|
|
|
+ // 先隐藏对话组件
|
|
|
+ this.showTalkGuide = false;
|
|
|
+ // 更新对话数据
|
|
|
+ this.currentTalkData = newTalkData;
|
|
|
+ // 使用 nextTick 确保数据更新后再显示对话组件
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.showTalkGuide = true;
|
|
|
+ // 检查是否需要显示引导箭头
|
|
|
+ this.checkAndShowGuideArrow();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // 如果没有新的对话数据,隐藏对话组件
|
|
|
+ this.showTalkGuide = false;
|
|
|
+ }
|
|
|
},
|
|
|
+
|
|
|
+ // 检查并显示引导箭头
|
|
|
+ checkAndShowGuideArrow() {
|
|
|
+ if (this.$refs.guideManager) {
|
|
|
+ const arrowPosition = this.$refs.guideManager.getCurrentArrowPosition();
|
|
|
+ console.log('----------- checkAndShowGuideArrow arrowPosition:', arrowPosition);
|
|
|
+
|
|
|
+ if (arrowPosition) {
|
|
|
+ // 显示引导箭头
|
|
|
+ this.showGuideArrow = true;
|
|
|
+ // 设置箭头位置
|
|
|
+ this.guideArrowPosition = {
|
|
|
+ x: arrowPosition.x,
|
|
|
+ y: arrowPosition.y,
|
|
|
+ r: arrowPosition.r || 0
|
|
|
+ };
|
|
|
+
|
|
|
+ console.log('----------- guideArrowPosition:', this.guideArrowPosition);
|
|
|
+ console.log('----------- showGuideArrow:', this.showGuideArrow);
|
|
|
+ } else {
|
|
|
+ // 隐藏引导箭头
|
|
|
+ this.showGuideArrow = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
@@ -580,6 +673,38 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ .guide-arrow {
|
|
|
+ position: absolute;
|
|
|
+ z-index: 10;
|
|
|
+ width: 100rpx;
|
|
|
+ height: 100rpx;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ pointer-events: none; /* 防止箭头阻挡点击事件 */
|
|
|
+
|
|
|
+ image {
|
|
|
+ width: 100rpx;
|
|
|
+ height: 100rpx;
|
|
|
+ animation: pulse 1.5s infinite; /* 添加脉冲动画 */
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @keyframes pulse {
|
|
|
+ 0% {
|
|
|
+ transform: scale(1);
|
|
|
+ opacity: 1;
|
|
|
+ }
|
|
|
+ 50% {
|
|
|
+ transform: scale(1.2);
|
|
|
+ opacity: 0.8;
|
|
|
+ }
|
|
|
+ 100% {
|
|
|
+ transform: scale(1);
|
|
|
+ opacity: 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
.home-arrow {
|
|
|
// background: rgba(255, 255, 255, 0.9);
|
|
|
position: absolute;
|