引导完善+ 说小贴士

This commit is contained in:
2025-08-25 23:42:31 +08:00
parent 6c95b3acc3
commit c3b9977b0c
11 changed files with 3973 additions and 2902 deletions

View File

@@ -66,4 +66,5 @@ export enum GameEvent {
DIAMOND_UPDATE = "DIAMOND_UPDATE",
MEAT_UPDATE = "MEAT_UPDATE",
MISSION_UPDATE = "MISSION_UPDATE",
HeroSpeek = "HeroSpeek",
}

View File

@@ -67,7 +67,7 @@ export const GuideConfig: { [key: number]: IGuideStep } = {
0: {
id: "welcome", type: GuideStepType.WAIT,key:0,
targetPath: "root/gui/LayerUI/role_controller/mission_home/start/name",
tipText: "欢迎来到游戏",
tipText: "伟大的勇者,欢迎来到 『像素大陆』,可恶的兽人日常入侵我们的村庄,请带领您的英雄抵御兽人的入侵吧!",
handOffset: { x: 42, y: -45 }, tipOffset: { x: 0, y: 600 },
nextStep: "start_battle", waitTime: 2, end_event: "click", noInput: true,
@@ -75,7 +75,6 @@ export const GuideConfig: { [key: number]: IGuideStep } = {
1: {
id: "start_battle", type: GuideStepType.CLICK,key:1,
targetPath: "root/gui/LayerUI/role_controller/mission_home/start/name",
tipText: "让我们抵御兽人的入侵吧!",
handOffset: { x: 42, y: -45 }, tipOffset: { x: 0, y: 200 },
// 42 45是手指的偏移量 0 0是提示的偏移量
},
@@ -83,62 +82,56 @@ export const GuideConfig: { [key: number]: IGuideStep } = {
id: "hero_page", type: GuideStepType.CLICK,key:2,
// 使用相对路径,从场景根节点开始查找
targetPath: "root/gui/LayerUI/role_controller/mission_home/btns/heros",
tipText: "招募更多英雄增强队伍",
tipText: "伟大的勇者,感谢你愿意加入我们,可以到酒馆招募更多英雄增强队伍",
handOffset: { x: 42, y: -45 }, tipOffset: { x: 0, y: 200 },
},
3: {
id: "to_hero_info", type: GuideStepType.CLICK,key:3,
// 使用相对路径,从场景根节点开始查找
targetPath: "root/gui/LayerUI/role_controller/mission_home/heros_page",
tipText: "选择可以解锁的英雄吧",
handOffset: { x: 42, y: -45 }, tipOffset: { x: 0, y: 200 } // 向上偏移50像素避免遮挡
},
4: {
id: "do_hero_info", type: GuideStepType.CLICK,key:4,
// 使用相对路径,从场景根节点开始查找
targetPath: "root/gui/LayerUI/Hinfo/unLock",
tipText: "招募这个英雄",
handOffset: { x: 42, y: -45 }, tipOffset: { x: 0, y: 200 }// 向上偏移50像素避免遮挡
},
5: {
id: "up_lv_hero", type: GuideStepType.CLICK,key:5,
// 使用相对路径,从场景根节点开始查找
targetPath: "root/gui/LayerUI/Hinfo/upBtn",
tipText: "升级强化这个英雄",
handOffset: { x: 42, y: -45 },tipOffset: { x: 0, y: 200 } // 向上偏移50像素避免遮挡
},
6: {
id: "close_hinfo", type: GuideStepType.CLICK,key:6,
// 使用相对路径,从场景根节点开始查找
targetPath: "root/gui/LayerUI/Hinfo/back",
tipText: "返回",
handOffset: { x: 42, y: -45 },tipOffset: { x: 0, y: 200 } // 向上偏移50像素避免遮挡
},
7: {
id: "to_mission", type: GuideStepType.CLICK,key:7,
// 使用相对路径,从场景根节点开始查找
targetPath: "root/gui/LayerUI/role_controller/mission_home/btns/fight",
tipText: "再次进入战斗",
handOffset: { x: 42, y: -45 }, tipOffset: { x: 0, y: 200 },
},
8: {
id: "to_add_hero", type: GuideStepType.CLICK,key:8,
// 使用相对路径,从场景根节点开始查找
targetPath: "root/gui/LayerUI/role_controller/mission_home/readyheros/hero3",
tipText: "添加上阵英雄",
tipText: "伟大的勇者,请设置你的上阵英雄",
handOffset: { x: 42, y: -45 }, tipOffset: { x: 0, y: 200 },
},
9: {
id: "to_hero_select", type: GuideStepType.CLICK,key:9,
// 使用相对路径,从场景根节点开始查找
targetPath: "root/gui/LayerUI/hero_select/main/view/heros/hero2",
tipText: "选择英雄",
handOffset: { x: 42, y: -45 }, tipOffset: { x: 0, y: 200 },
},
10: {
id: "start_battle", type: GuideStepType.CLICK,key:10,
targetPath: "root/gui/LayerUI/role_controller/mission_home/start/name",
tipText: "享受你的游戏",
tipText: "伟大的勇者,请再次为我们抵御兽人的入侵吧",
handOffset: { x: 42, y: -45 }, tipOffset: { x: 0, y: 200 },
// 42 45是手指的偏移量 0 0是提示的偏移量
},

View File

@@ -1,3 +1,16 @@
export const Speeks = [
["点击我可以调整上阵英雄"],
["点击英雄可以查看英雄信息"],
["点击英雄可以升级英雄"],
["点击英雄可以强化英雄"],
["点击英雄可以觉醒英雄"],
["点击英雄可以升星英雄"],
["点击英雄可以突破英雄"],
["点击英雄可以觉醒英雄"],
]
export const randomSpeek=()=>{
return Speeks[Math.floor(Math.random()*Speeks.length)]
}
export const Tasks = [
{
id: 0,

View File

@@ -189,7 +189,7 @@ export class GuideSetpComp extends CCComp {
/** 显示组件 */
private show() {
this.node.active = true;
if (this.tipNode) {
if (this.tipLabel.string!="") {
this.tipNode.active = true;
}
if (this.handNode) {

View File

@@ -15,12 +15,26 @@ export class HeroReadyCom extends Component {
protected onLoad(): void {
oops.message.on(GameEvent.UpdateHero,this.update_hero,this)
oops.message.on(GameEvent.UpdateFightHero,this.update_hero,this)
oops.message.on(GameEvent.HeroSpeek,this.to_speek,this)
}
start() {
this.hide_speek()
this.update_hero()
}
hide_speek(){
this.node.getChildByName("tooltip").active=false
}
to_speek(e:any,args:any){
console.log("[HeroReadyCom]:to_speek",args,this.slot)
if(args.slot!=this.slot) return
if(smc.fight_heros[this.slot]==0) return
this.node.getChildByName("tooltip").active=true
this.node.getChildByName("tooltip").getChildByName("words").getComponent(Label)!.string = args.words
this.scheduleOnce(()=>{
this.hide_speek()
},3)
}
update(deltaTime: number) {
}
@@ -45,6 +59,7 @@ export class HeroReadyCom extends Component {
// console.log("[HeroReadyCom]clip",this.node.getChildByName("icon").getComponent(Animation))
}
no_hero(){
this.node.getChildByName("lv").active=false
this.node.getChildByName("add").active=true

View File

@@ -6,6 +6,8 @@ import { smc } from "../common/SingletonModuleComp";
import { GameEvent } from "../common/config/GameEvent";
import { HeroPageComp } from "./HeroPageComp";
import { finishCurrGuide, GuideConfig, startGuide } from "../common/config/Guide";
import { Timer } from "db://oops-framework/core/common/timer/Timer";
import { randomSpeek, Speeks } from "../common/config/Tasks";
const { ccclass, property } = _decorator;
@@ -13,7 +15,8 @@ const { ccclass, property } = _decorator;
@ccclass('MissionHomeComp')
@ecs.register('MissionHome', false)
export class MissionHomeComp extends CCComp {
speek_time:number=0
speek_cd:Timer=new Timer(10)
protected onLoad(): void {
this.on(GameEvent.MissionEnd,this.mission_end,this)
}
@@ -26,7 +29,14 @@ export class MissionHomeComp extends CCComp {
startGuide(1)
startGuide(2)
}
update(dt:number){
if(this.speek_cd.update(dt)){
let speek=randomSpeek()
let slot=Math.floor(Math.random()*2)
oops.message.dispatchEvent(GameEvent.HeroSpeek,{words:speek[0],slot:slot})
console.log("[MissionHomeComp]:speek",speek,slot)
}
}
/** 启动下一个引导 */
private startNextGuide() {
// 检查是否还有未完成的引导