咸鱼的反击
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.
 
 
 
xianyudefanji/assets/Scripts/Mishu/MishuReward.ts

213 lines
9.3 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 { ryw_Event } from "../../FrameWork/Event/EventEnum";
import EventMgr from "../../FrameWork/Event/EventMgr";
import User from "../../FrameWork/User/User";
import Common5 from "../../Platform/th/Common5";
import UiBase from "../GameBase/UiBase";
import TaskManager, { MainTaskIdEnum } from "../JuQingChat/TaskManager";
import MiShuManager from "../Manager/MiShuManager";
import NewGuideScript from "../NewGuide/NewGuideScript";
import PrefabManage, { GameType } from "../PrefabManager/PrefabManage";
const {ccclass, property} = cc._decorator;
@ccclass
export default class MishuReward extends UiBase {
chatConfig = [
{effectUrl:'sound/mishuSound/亲爱的,有你在身边真好', str:'亲爱的,有你在身边真好',name:'茜滢'},
{effectUrl:'sound/mishuSound/你的心已经被我悄悄俘获了', str:'你的心已经被我悄悄俘获了',name:'云欣'},
{effectUrl:'sound/mishuSound/你难道不想靠近一点,感受我的魅力吗', str:'你难道不想靠近一点,感受我的魅力吗',name:'媱安'},
{effectUrl:'sound/mishuSound/你,是不是在偷偷想我呢', str:'你,是不是在偷偷想我呢',name:'诗涵'},
{effectUrl:'sound/mishuSound/人家就喜欢黏着你嘛', str:'人家就喜欢黏着你嘛',name:'婉仪'},
{effectUrl:'sound/mishuSound/哎呀,今天又是可爱满满的一天呢!', str:'哎呀,今天又是可爱满满的一天呢!',name:'诺依'},
{effectUrl:'sound/mishuSound/我不仅会搬砖,还会抬杠', str:'我不仅会搬砖,还会抬杠',name:'班的多'},
{effectUrl:'sound/mishuSound/你的心,已经被我占据了', str:'你的心,已经被我占据了',name:'蕾蕾'},
{effectUrl:'sound/mishuSound/爱护环境人人有责', str:'爱护环境人人有责',name:'邵干净'},
{effectUrl:'sound/mishuSound/亲爱的,人家好想你呀', str:'亲爱的,人家好想你呀',name:'水萌'},
{effectUrl:'sound/mishuSound/你好,请出示一下证件', str:'你好,请出示一下证件',name:'保平安'},
{effectUrl:'sound/mishuSound/别轻易靠近我,除非你有足够的勇气', str:'别轻易靠近我,除非你有足够的勇气',name:'可微'},
{effectUrl:'sound/mishuSound/游泳健身了解一下吗帅哥', str:'游泳健身了解一下吗帅哥',name:'花传单'},
{effectUrl:'sound/mishuSound/看着我,你还能移开目光吗', str:'看着我,你还能移开目光吗',name:'夏彤'},
{effectUrl:'sound/mishuSound/我的美丽,只为你绽放', str:'我的美丽,只为你绽放',name:'以南'},
{effectUrl:'sound/mishuSound/又来新单了,赶紧出发', str:'又来新单了,赶紧出发',name:'宋的快'},
{effectUrl:'sound/mishuSound/好想和你有一个属于我们的家', str:'好想和你有一个属于我们的家',name:'悦澄'},
{effectUrl:'sound/mishuSound/每一个碗都得洗得干干净净', str:'每一个碗都得洗得干干净净',name:'习婉工'},
{effectUrl:'sound/mishuSound/天冷了,记得多穿点衣服哦', str:'天冷了,记得多穿点衣服哦',name:'紫琳'},
{effectUrl:'sound/mishuSound/哎呀,人家的小心脏都被你弄乱了', str:'哎呀,人家的小心脏都被你弄乱了',name:'羽婷'},
{effectUrl:'sound/mishuSound/我不想理你了', str:'我不想理你了',name:'梵音'},
{effectUrl:'sound/mishuSound/你有没有好好吃饭呀?不许饿着自己', str:'你有没有好好吃饭呀?不许饿着自己',name:'诗锦'},
{effectUrl:'sound/mishuSound/钱对我来说,不过是数字罢了', str:'钱对我来说,不过是数字罢了',name:'钱多发'},
]
@property(cc.Label)
labelName: cc.Label = null;
@property(cc.Label)
labelName2: cc.Label = null;
@property(cc.Label)
tigaoLab: cc.Label = null;
@property(cc.Node)
guangSpine: cc.Node = null;
@property(cc.Node)
peopleSpine: cc.Node = null;
@property(cc.Node)
duiyouNode: cc.Node = null;
@property(cc.Node)
zhuliNode: cc.Node = null;
isMishu = false
mishuId = 0
type = 'levelUp'
// LIFE-CYCLE CALLBACKS:
effectData = null
onDestroy(){
EventMgr.emitEvent_custom(ryw_Event.exitMishuReward);
}
// onLoad () {}
setViewDate(mishuId, isMishu, type){
this.mishuId = mishuId
this.isMishu = isMishu
this.type = type
}
guideNewStep(){
let config = MiShuManager.getConfigDateById(this.mishuId)
let mainTaskInfo:any = TaskManager.getCurUnLockMainTaskInfo()
let mainId = mainTaskInfo.Id
if(mainId == MainTaskIdEnum.MainTask_502 && config.name=='茜滢'){
let node = this.node.getChildByName('getPeople').getChildByName('sureBtn')
this.guideView([node])
}
}
guideView(nodeArray, opacity = -1){
PrefabManage.loadPrefabByType(GameType.GuideMskNode, null, (prefab)=>{
// prefab.zIndex = 199
let guideNodeArray = nodeArray
let firstNode = guideNodeArray.shift()
prefab.getComponent(NewGuideScript).setBindNode(firstNode, guideNodeArray)
if(opacity!=-1){
prefab.getComponent(NewGuideScript).setOpacityMaskNode(opacity)
}
})
}
closeView(): void {
//Common5.playEffect("sound/按键点击")
cc.audioEngine.stopAllEffects();
this.node.removeFromParent()
this.node.destroy()
}
start () {
//加载东海
let config = MiShuManager.getConfigDateById(this.mishuId)
let spineName = config.spineName
let spineName2 = config.spineName2
if(this.isMishu){
Common5.playRemoteSpine(this.peopleSpine,'Spine/mishu/人物解锁',spineName, spineName2)
}else{
Common5.playRemoteSpine(this.peopleSpine,'Spine/mishu/人物解锁',spineName, spineName2)
}
for(let i = 0;i<this.chatConfig.length;i++){
if(this.chatConfig[i].name == config.name){
this.effectData = this.chatConfig[i]
break
}
}
if(config.name=='花传单'){
let posi = this.peopleSpine.getPosition()
this.peopleSpine.setPosition(posi.x,posi.y+150)
}else if(config.name=='蕾蕾'){
let posi = this.peopleSpine.getPosition()
this.peopleSpine.setPosition(posi.x,posi.y-150)
}else if(config.name=='钱多发'){
this.peopleSpine.scale = 1.3
} else if(config.name=='可微'){
let posi = this.peopleSpine.getPosition()
this.peopleSpine.setPosition(posi.x,posi.y-100)
} else if(config.name=='夏彤'){
let posi = this.peopleSpine.getPosition()
this.peopleSpine.setPosition(posi.x,posi.y-100)
} else if(config.name=='茜滢'){
this.peopleSpine.scale = 1.5
let posi = this.peopleSpine.getPosition()
this.peopleSpine.setPosition(posi.x,posi.y+120)
} else if(config.name=='云欣'){
this.peopleSpine.scale = 1.5
let posi = this.peopleSpine.getPosition()
this.peopleSpine.setPosition(posi.x,posi.y+100)
} else if(config.name=='晴萱'){
let posi = this.peopleSpine.getPosition()
this.peopleSpine.setPosition(posi.x,posi.y-150)
}
Common5.playRemoteSpine(this.guangSpine,'Spine/mishu','光晕', '光晕')
this.scheduleOnce(()=>{
Common5.playRemoteSpine(this.guangSpine,'Spine/mishu','光晕', '持续')
},1.0)
if(this.type == 'levelUp'){
this.labelName.string = config.name
this.node.getChildByName('peopleLevelUp').active = true
let addPercent = config.addPercent*100
this.tigaoLab.string = addPercent+'%'
this.scheduleOnce(()=>{
this.node.getChildByName('peopleLevelUp').getChildByName('closeClickNode').active = true
},1.0)
}else{
if(this.effectData){
Common5.loadRemoteAudioEffect(this.effectData.effectUrl)
}
this.labelName2.string = config.name
this.node.getChildByName('getPeople').active = true
if( this.isMishu){
this.zhuliNode.active= true
}else{
this.duiyouNode.active= true
}
let qipao = this.node.getChildByName('getPeople').getChildByName('气泡')
qipao.active = true
qipao.scale = 0.1
let lab = qipao.getChildByName('lab').getComponent(cc.Label)
lab.string = this.effectData.str
cc.tween(qipao)
.to(0.3,{scale:1})
.call(()=>{
if(this.effectData){
Common5.playRemoteAudioEffect(this.effectData.effectUrl)
}
})
.start()
this.guideNewStep()
}
}
// update (dt) {}
}