12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- import BaseEvent from "../../fight/evnet/base/BaseEvent";
- import { SpriteActionType } from "../../fight/object/FSprite";
- const {ccclass, property} = cc._decorator;
- /**
- * 剧情
- * 落单的精灵:可怜的小鹿……居然被这么古老的机关捉住了。
- 角色触碰笼子,提示需要钥匙。
- 落单的精灵:这是我见过的排名第一的倒霉动物。
- 落单的精灵:我暂且留在这里守护它。
- */
- @ccclass
- export default class JG0111_3 extends BaseEvent {
- @property({
- displayName: '困住的宠物',
- type: cc.Node,
- })
- mPet: cc.Node = null;
- @property({
- displayName: '对话用NPC',
- type: cc.Node,
- })
- mNpc: cc.Node = null;
- @property({
- displayName: '显示的钥匙',
- type: cc.Node,
- })
- mKeyNode: cc.Node = null;
- private isOver = false;
- public onBegin(tag: number) {
- if(this.isOver){
- return
- }
- this.isOver = true
- this.pause()
- this.dialog1()
- }
- private dialog1() {
- let text = [
- '可怜的小鹿……居然被这么古老的机关捉住了。',
- ]
- this.showDialog(this.mNpc, text, () => {
- this.moveMainSprite()
- })
- }
- /**
- * 角色触碰笼子,提示需要钥匙。
- */
- private moveMainSprite(){
- let mainSprite = this.ff.mainSprite
- mainSprite.setLR(1)
- mainSprite.playAction(SpriteActionType.run, true)
- cc.tween(mainSprite.node).sequence(
- cc.moveTo(0.5,cc.v2(3336,4322)),
- cc.callFunc(()=>{
- mainSprite.setLR(-1)
- mainSprite.playAction(SpriteActionType.stand, true)
- this.mKeyNode.active = true
- }),
- cc.delayTime(1),
- cc.callFunc(()=>{
- mainSprite.playAction(SpriteActionType.stand, true)
- this.dialog2()
- this.mKeyNode.active = false
- }),
- ).start()
- }
- private dialog2() {
- let text = [
- '需要一把钥匙......',
- ]
- this.showDialog(this.ff.mainSprite.node, text, () => {
- this.dialog3()
- })
- }
- private dialog3() {
- let text = [
- '这是我见过的排名第一的倒霉动物。',
- '我暂且留在这里守护它。',
- ]
- this.showDialog(this.mNpc, text, () => {
- this.node.destroy()
- this.resume()
- })
- }
- }
|