You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
131 lines
3.4 KiB
131 lines
3.4 KiB
// Learn TypeScript:
|
|
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
|
|
// Learn Attribute:
|
|
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
|
|
// Learn life-cycle callbacks:
|
|
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
|
|
|
|
import User from "../../FrameWork/User/User";
|
|
import Common5 from "../../Platform/th/Common5";
|
|
import PrefabManage, { GameType } from "../PrefabManager/PrefabManage";
|
|
|
|
const {ccclass, property} = cc._decorator;
|
|
|
|
@ccclass
|
|
export default class GuideEndScript extends cc.Component {
|
|
|
|
|
|
@property(cc.Node)
|
|
shuxieNode: cc.Node = null;
|
|
@property(cc.Node)
|
|
answerItem: cc.Node = null;
|
|
@property(cc.Node)
|
|
startGame: cc.Node = null;
|
|
|
|
@property(cc.Node)
|
|
canhuiluSpine: cc.Node = null;
|
|
|
|
// LIFE-CYCLE CALLBACKS:
|
|
duihuaIndex = 1
|
|
// onLoad () {}
|
|
duihualogStrTab= [
|
|
"",
|
|
"这本子会自己...",//2
|
|
"",
|
|
"村里大家伙都...",//4
|
|
"",
|
|
""
|
|
]
|
|
|
|
isFanye = false
|
|
isSkipGame = false
|
|
start () {
|
|
|
|
this.shuxieNode.active = true
|
|
this.showduihua()
|
|
|
|
|
|
this.canhuiluSpine.getComponent(sp.Skeleton).setCompleteListener(()=>{
|
|
if(this.isSkipGame){
|
|
return
|
|
}
|
|
if(this.duihuaIndex>6){
|
|
return
|
|
|
|
}
|
|
|
|
if(this.isFanye){
|
|
let btnStr = this.duihualogStrTab[this.duihuaIndex-1]
|
|
this.answerItem.active = true
|
|
this.answerItem.getChildByName('contentStr').getComponent(cc.Label).string = btnStr
|
|
|
|
return
|
|
}
|
|
//忏悔书
|
|
this.duihuaIndex++
|
|
let btnStr = this.duihualogStrTab[this.duihuaIndex-1]
|
|
if(btnStr == ''){
|
|
this.showduihua()
|
|
}else{
|
|
this.answerItem.active = true
|
|
this.answerItem.getChildByName('contentStr').getComponent(cc.Label).string = btnStr
|
|
}
|
|
|
|
console.log(this.duihuaIndex,'this.duihuaIndex++++=')
|
|
if(this.duihuaIndex>6){
|
|
this.startGame.active = true
|
|
this.answerItem.active = false
|
|
}
|
|
})
|
|
|
|
|
|
}
|
|
|
|
showduihua(){
|
|
if(this.duihuaIndex>6){
|
|
return
|
|
|
|
}
|
|
if(this.duihuaIndex==2||this.duihuaIndex==4){
|
|
Common5.playEffect("sound/写字")
|
|
}
|
|
let anim = this.duihuaIndex+''
|
|
this.canhuiluSpine.getComponent(sp.Skeleton).setAnimation(0,anim,false)
|
|
|
|
}
|
|
|
|
|
|
starGame(){
|
|
Common5.playMusicCustom('CommonRes', 'sound/背景音');
|
|
PrefabManage.loadPrefabByType(GameType.MyRoom)
|
|
User.setFirstIn(false)
|
|
this.node.removeFromParent()
|
|
this.node.destroy()
|
|
}
|
|
|
|
duihuaMyClick(){
|
|
this.isFanye = false
|
|
this.answerItem.active = false
|
|
this.showduihua()
|
|
}
|
|
|
|
skipJuqing(event){
|
|
this.isSkipGame = true
|
|
|
|
event.target.active = false
|
|
this.canhuiluSpine.getComponent(sp.Skeleton).paused = true
|
|
|
|
this.canhuiluSpine.getComponent(sp.Skeleton).paused = false
|
|
|
|
this.shuxieNode.active = true
|
|
|
|
this.canhuiluSpine.getComponent(sp.Skeleton).setAnimation(0,'6',false)
|
|
this.answerItem.active = false
|
|
|
|
this.scheduleOnce(()=>{
|
|
this.startGame.active = true
|
|
},1.0)
|
|
|
|
}
|
|
// update (dt) {}
|
|
}
|
|
|