949 lines
34 KiB
JavaScript
949 lines
34 KiB
JavaScript
|
|
const BasePage = require( "act.page.base" );
|
|
const ItemLayout = require( "cmp.common.itemlayout" );
|
|
const FxSVC = require( "nx.fx.sv.expand" );
|
|
const NxSpine = require( "nx.fx.spine" );
|
|
const TipsController = require( "tips_controller" );
|
|
const MainUiController = require( "mainui_controller" );
|
|
const { data2Icon } = require( "bridge.utils.item" );
|
|
const FID = require( "bridge.function.ids" );
|
|
const MCT = require( "mall_const" );
|
|
const RoleController = require("role_controller");
|
|
const lines = [ [ 1, 2, 3,4,5 ], [ 6, 7, 8,9,10 ], [11,12,13,14,15], [16,17,18,19,20],
|
|
[ 21, 22, 23, 24, 25 ], [5, 9, 13, 17, 21], [1,6,11,16,21],[ 2, 7, 12, 17, 22 ],
|
|
[ 3 , 8, 13, 18, 23], [ 4, 9, 14, 19, 24], [5, 10, 15, 20, 25],
|
|
[ 1, 7, 13, 19, 25 ] ];
|
|
|
|
cc.Class({
|
|
|
|
extends: BasePage,
|
|
|
|
properties: {
|
|
|
|
nodAwards : { default: null, type: FxSVC, displayName: "所有道具列表" },
|
|
spRole : { default: null, type: NxSpine, displayName: "人物動畫" },
|
|
nodTips : { default: null, type: cc.Node, displayName: "说明" },
|
|
nodReaches : { default: null, type: cc.Node, displayName: "纍計獎勵" },
|
|
nodTimes : { default: null, type: cc.Node, displayName: "纍計次數" },
|
|
nodMat : { default: null, type: cc.Node, displayName: "右上角材料" },
|
|
nodScore : { default: null, type: cc.Node, displayName: "積分" },
|
|
nodOps : { default: null, type: cc.Node, displayName: "操作" },
|
|
nodLineR : { default: null, type: cc.Node, displayName: "連綫獎勵" },
|
|
},
|
|
|
|
// 初始化
|
|
build: function( _data ) {
|
|
|
|
this._super( _data );
|
|
|
|
nx.gui.setCdTxt( this.nodTips, "top/time/txt", ( _data.end_time - Math.floor( cc.sys.now() / 1000 ) ), () => {
|
|
// nx.gui.setString( this.nodEndTime, "txt", nx.text.getKey( "lab_planesafk_main_have_over" ) );
|
|
} );
|
|
|
|
let cfgs = gdata( this.data.config, "data_star_const" );
|
|
let efg = gdata( this.data.config, "data_explain" );
|
|
|
|
|
|
let scoreid = cfgs.card_shard_id.val;
|
|
this.scoreid = scoreid;
|
|
|
|
|
|
nx.bridge.setIconS( this.nodScore, "icon", scoreid );
|
|
|
|
this.spriteid = scoreid;
|
|
// 右邊 次數獎勵設置
|
|
nx.gui.setActive( this, "jump", false );
|
|
|
|
|
|
this.anims = [];
|
|
nx.gui.setString( this.nodTips, "cnt/view/content/tip", efg[2].desc );
|
|
|
|
this.twween = [];
|
|
this.freshInfo( this.mod.period );
|
|
|
|
|
|
// 视图监听
|
|
this.mod.vbind( this, [
|
|
[ "ActsCollectCard", this.freshCollectCardInfo.bind( this ) ],
|
|
] );
|
|
|
|
this.isdoing = false;
|
|
this.actdoing = false;
|
|
// // this.mod.reqBaseData();
|
|
// nx.debug( "$ActPage onEnable");
|
|
// 获取指定主题信息
|
|
},
|
|
|
|
onEnable: function(){
|
|
|
|
if( this.twwn ){
|
|
this.twwn.stop();
|
|
}
|
|
|
|
this.stopAllTwwen();
|
|
|
|
this.unscheduleAllCallbacks();
|
|
if( nx.dt.arrNEmpty( this.anims ) ){
|
|
for ( let i = 0; i < this.anims.length; i++ ) {
|
|
let nod = this.anims[i];
|
|
if( nod ){
|
|
nod.stop();
|
|
}
|
|
}
|
|
}
|
|
this.mod.reqBaseInfo();
|
|
this.dealOps( true );
|
|
nx.gui.setActive( this, "jump", false );
|
|
},
|
|
|
|
onDisable: function(){
|
|
|
|
this.isdoing = false;
|
|
this.actdoing = false;
|
|
this.stopAllTwwen();
|
|
|
|
let chd = nx.gui.find( this.nodAwards, "content" ).children;
|
|
//切换光环位置
|
|
for (let i = 0; i < chd.length; i++) {
|
|
let nod = chd[i];
|
|
// nx.tween.fadeOut( nod, "node/focus", 0.01 );
|
|
nx.gui.setActive( nod, "node/focus", false );
|
|
}
|
|
|
|
},
|
|
|
|
// 销毁
|
|
onDestroy: function() {
|
|
|
|
// 活动监听解除
|
|
if( this.mod ) {
|
|
this.mod.vunbind( this );
|
|
}
|
|
if( nx.dt.arrNEmpty( this.anims ) ){
|
|
for ( let i = 0; i < this.anims.length; i++ ) {
|
|
let nod = this.anims[i];
|
|
if( nod ){
|
|
nod.stop();
|
|
}
|
|
}
|
|
}
|
|
this._super();
|
|
},
|
|
|
|
|
|
// 刷新基本顯示相關
|
|
freshInfo: function( _data ){
|
|
|
|
let period = _data;
|
|
this.period = period;
|
|
let rfg = gdata( this.data.config, "data_static_reward" )[ period ];
|
|
// let first = [];
|
|
|
|
let rfgs = gdata( this.data.config, "data_reward" )[ period ];
|
|
let chd = this.nodReaches.children;
|
|
for (let i = 0; i < chd.length; i++ ) {
|
|
let nod = chd[i];
|
|
let rewardd = rfgs[i+1].items[0];
|
|
let itemcmp = nx.gui.getComponent( nod, "reward", "cmp.item.base" );
|
|
nx.gui.find( nod, "get" ).idd = rfgs[i+1].id;
|
|
nx.gui.setString( nod, "times", rfgs[i+1].count );
|
|
if( itemcmp ){
|
|
itemcmp.setData( rewardd );
|
|
}
|
|
nx.gui.setActive( nod, "get", false );
|
|
nx.gui.setActive( nod, "got", false );
|
|
}
|
|
|
|
// let second = [];
|
|
let chdline = this.nodLineR.children;
|
|
// let count = Object.keys( rfg ).length;
|
|
for (let i in rfg ) {
|
|
let info = rfg[i];
|
|
let nod = chdline[info.id - 1];
|
|
let cmp = nx.gui.getComponent( nod, "", "cmp.item.base" );
|
|
|
|
nx.gui.find( nod, "get" ).idd = info.id;
|
|
nx.gui.setActive( nod, "get", false );
|
|
nx.gui.setActive( nod, "got", false );
|
|
nx.gui.setActive( nod, "cannot", true );
|
|
nx.gui.setActive( nod, "rare", false );
|
|
if( cmp ){
|
|
cmp.setData( info.rewards[0] );
|
|
}
|
|
|
|
}
|
|
let mfg = gdata( this.data.config, "data_star_card" )[period];
|
|
let mat = mfg.one_loss[0][0];
|
|
|
|
let path = "resDB/models/" + mfg.partner_model + "/show";
|
|
this.spRole.node.scaleX = mfg.is_flip == 1 ? -this.spRole.node.scaleX : this.spRole.node.scaleX;
|
|
|
|
this.spRole.load( path, ( _e ) => {
|
|
if( !_e ) {
|
|
this.spRole.action( "drama4", true );
|
|
} else {
|
|
this.spRole.stop();
|
|
}
|
|
} );
|
|
|
|
|
|
nx.gui.setString( this, "panel/periodtip/txt", mfg.str1 );
|
|
|
|
let mcmp = nx.gui.getComponent( this.nodMat, "", "bridge.binder.item.icon.count" );
|
|
if( mcmp ){
|
|
mcmp.setID( mat );
|
|
}
|
|
|
|
|
|
|
|
let showtxtxt = "";
|
|
switch( mfg.ten_loss[0][1] ){
|
|
case 10 : { showtxtxt = nx.text.getKey( "ActCollectTenTime" ) };break;
|
|
case 5 : { showtxtxt = nx.text.getKey( "ActCollectFiveTime" ) };break;
|
|
}
|
|
|
|
nx.gui.setString( this.nodOps, "one/txt", nx.text.getKey( "ActCollectOne" ) );
|
|
nx.gui.setString( this.nodOps, "noone/txt", nx.text.format( "ActCollectTen", showtxtxt ) );
|
|
|
|
nx.gui.find( this.nodOps, "noone" ).times = mfg.ten_loss[0][1];
|
|
nx.gui.find( this.nodOps, "one" ).times = mfg.one_loss[0][1];
|
|
|
|
nx.bridge.setIconS( this.nodOps, "one/mat/icon", mat );
|
|
nx.gui.setString( this.nodOps, "one/mat/count", "X" + mfg.one_loss[0][1] );
|
|
nx.bridge.setIconS( this.nodOps, "noone/mat/icon", mat );
|
|
nx.gui.setString( this.nodOps, "noone/mat/count", "X" + mfg.ten_loss[0][1] );
|
|
|
|
this.nodAwards.rebuild( this.dealShow() );
|
|
|
|
},
|
|
|
|
dealShow: function(){
|
|
|
|
let carddss = [];
|
|
|
|
if( this.data && this.data.config ){
|
|
|
|
let cfg = gdata( this.data.config, "data_card_info" )[ this.period ];
|
|
|
|
for (let r in cfg ) {
|
|
let card = nx.dt.objClone( cfg[r] ) ;
|
|
card.status = 0;
|
|
carddss.push( card );
|
|
}
|
|
|
|
carddss.sort( ( a, b) =>{
|
|
return a.position - b.position;
|
|
})
|
|
|
|
}
|
|
|
|
|
|
return carddss;
|
|
|
|
},
|
|
|
|
stopAllTwwen: function(){
|
|
|
|
if( this.twween && nx.dt.arrNEmpty( this.twween ) ){
|
|
this.twween.forEach( _tw =>{
|
|
_tw.stop();
|
|
} )
|
|
this.twween = [];
|
|
}
|
|
|
|
},
|
|
|
|
// 處理集卡活動基本數據
|
|
freshCollectCardInfo: function( _carddata ){
|
|
|
|
if( !_carddata ){
|
|
return;
|
|
}
|
|
let carddss = this.dealShow();
|
|
let info = _carddata;
|
|
|
|
let havecard = info.ids;
|
|
let reachreward = info.reach_reward;
|
|
let linereward = info.rewards;
|
|
let times = info.draw_times;
|
|
|
|
nx.gui.setString( this.nodTimes, "txt", times );
|
|
|
|
// 積分顯示 爲了做動畫效果
|
|
let role = RoleController.getInstance().getRoleVo();
|
|
if( !this.isdoing ){
|
|
nx.gui.setString( this.nodScore, "txt", role.star_card_point );
|
|
}
|
|
|
|
if( nx.dt.arrNEmpty( reachreward ) && this.nodReaches ){
|
|
let chd = this.nodReaches.children;
|
|
for (let r = 0; r < reachreward.length; r++) {
|
|
let reward = reachreward[r];
|
|
let nod = chd[ reward.id - 1 ];
|
|
nx.gui.setActive( nod, "get", reward.status == 1 );
|
|
nx.gui.setActive( nod, "got", reward.status == 2 );
|
|
}
|
|
|
|
}
|
|
|
|
if( nx.dt.arrNEmpty( havecard ) && this.nodAwards ){
|
|
let chd = nx.gui.find( this.nodAwards, "content" ).children;
|
|
let shows = [];
|
|
if( chd ){
|
|
for( let i = 0; i < havecard.length; ++i ) {
|
|
let have = havecard[i];
|
|
let temp = chd[ have.id - 1 ];
|
|
let show = carddss[have.id - 1 ];
|
|
show.status = 1;
|
|
if( temp.svItem && !this.isdoing ) {
|
|
temp.svItem.rebind( i, show );
|
|
|
|
}
|
|
|
|
}
|
|
chd.forEach( _nod=>{
|
|
if( _nod.svItem.mdata.status == 0 && _nod.svItem.mdata.is_show == 1 ){
|
|
shows.push( _nod );
|
|
}
|
|
} )
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
if( nx.dt.arrNEmpty( linereward ) && this.nodLineR ){
|
|
|
|
let chd = this.nodLineR.children;
|
|
let chda = nx.gui.find( this.nodAwards, "content" ).children;
|
|
for (let i = 0; i < linereward.length; i++) {
|
|
let award = linereward[i];
|
|
let nod = chd[ award.id - 1 ];
|
|
|
|
if( !this.isdoing ){
|
|
let linecontent = lines[ award.id - 1 ];
|
|
for (let idx = 0; idx < linecontent.length; idx++) {
|
|
let idds = linecontent[idx];
|
|
let nod = chda[idds-1];
|
|
let nxpine = nx.gui.getComponent( nod, "node/linespine", "nx.fx.spine" );
|
|
if( nxpine ){
|
|
if( award.status != 1 ){
|
|
nxpine.stop();
|
|
}else{
|
|
nxpine.stop();
|
|
// nxpine.load( "resDB/effects/E90912/action", ( _e ) => {
|
|
// if( !_e ) {
|
|
// nxpine.action( "action", true );
|
|
// } else {
|
|
// nxpine.stop();
|
|
// }
|
|
// } );
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
nx.gui.setActive( nod, "get", award.status == 1 );
|
|
nx.gui.setActive( nod, "got", award.status == 2 );
|
|
nx.gui.setActive( nod, "cannot", award.status == 0 );
|
|
nx.gui.setActive( nod, "rare", award.status == 1 );
|
|
}else{
|
|
|
|
if( award.status == 2 ){
|
|
// nx.gui.setActive( nod, "get", award.status == 1 );
|
|
nx.gui.setActive( nod, "got", true );
|
|
nx.gui.setActive( nod, "get", false );
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
// reachreward
|
|
|
|
},
|
|
|
|
onTouchReachTime: function( _item ){
|
|
|
|
let idd = _item.idd;
|
|
this.mod.reqGetCollectReachTimesReward( idd );
|
|
|
|
},
|
|
|
|
onTouchHelp: function(){
|
|
|
|
let TC = TipsController.getInstance();
|
|
let explain = gdata( this.mod.data.config, "data_explain" )[1];
|
|
let probcfg = gdata( this.mod.data.config, "data_prob_info" );
|
|
let prob = "";
|
|
for (let i in probcfg ) {
|
|
let desc = probcfg[i];
|
|
prob += "\n" + desc.name + "\t\t\t\t\t" + desc.probability + "%";
|
|
|
|
}
|
|
let txt = explain.desc + "\n" + nx.text.getKey( "PrayRate" ) + prob;
|
|
|
|
TC.showTextPanel( explain.name, txt );
|
|
|
|
},
|
|
|
|
onTouchCollectCard: function( _btn ){
|
|
|
|
let times = _btn.times;
|
|
this.isdoing = true;
|
|
|
|
this.index = -1; //当前光环在哪个奖品上
|
|
// this.nodFocus.position = this.nodReward.children[this.index].position; //初始化光环位置
|
|
this.delayTime = 0.1; //开始的时候延迟调用的时间(最小时间间隔)
|
|
this.delayTime_max = 1.5; //最大时间间隔
|
|
// this.addOrSub = false; //增加还是减少的bool值
|
|
this.loopCount = 0; //循环次数
|
|
this.circleCount = 1; //前面循环的圈数(效果圈,只为效果,和奖品无关)
|
|
// 動畫表現形式 ---- 先閃隨機動畫 然後定點顯示相關獲得 呈現達成效果 最終彈出相關的固定獎勵
|
|
this.mod.reqCollectCard( times, ( _ret, _data, _code )=>{
|
|
|
|
if( ( !_ret && _code == 101 ) || !_data.face_list ){
|
|
nx.tbox( _data );
|
|
this.onTouchMat();
|
|
return;
|
|
}
|
|
|
|
if( this.actdoing ){
|
|
nx.tbox( "ActDoing" );
|
|
return;
|
|
}
|
|
|
|
this.dealOps( false );
|
|
|
|
this.actdoing = true;
|
|
_data.face_list.sort( ( a, b )=>{
|
|
return a.is_debris - b.is_debris;
|
|
} )
|
|
// 動畫表現
|
|
this.unscheduleAllCallbacks();
|
|
this.onDoAni( 0, _data, 0 );
|
|
|
|
} );
|
|
|
|
nx.gui.setActive( this, "jump", true );
|
|
},
|
|
|
|
|
|
dealOps : function( _status ){
|
|
|
|
let ops = this.nodOps.children;
|
|
for (let o = 0; o < ops.length; o++) {
|
|
let opnod = ops[o];
|
|
let cmp = nx.gui.getComponent( opnod, "", cc.Button );
|
|
if( cmp ){
|
|
cmp.interactable = _status;
|
|
}
|
|
}
|
|
|
|
},
|
|
|
|
onTouchGetLineReward : function( _btn ){
|
|
|
|
let idd = _btn.idd;
|
|
this.mod.reqGetLineCollectReward( idd );
|
|
|
|
},
|
|
|
|
onTouchMat: function(){
|
|
|
|
let jump_shop = gdata( this.data.config, "data_star_card" )[this.period].shop_id;
|
|
if( this.actRoot && jump_shop ) {
|
|
this.actRoot.jumpToMenu( jump_shop );
|
|
}
|
|
},
|
|
|
|
onTouchExchange: function(){
|
|
|
|
nx.bridge.jumper.jump2Window( FID.Shop, {
|
|
p1 : MCT.MallType.SummonShop,
|
|
p2: MCT.MallType.CollectCardStore,
|
|
} )
|
|
|
|
},
|
|
|
|
// 播放輪轉動畫
|
|
onDoAni: function( _time, _result, _loop, _usetype ){
|
|
|
|
// let animnod = nx.gui.find( this, "item" );
|
|
// let chd = nx.gui.find( this.nodAwards, "content" ).children;
|
|
let posss = nx.gui.find( this.nodAwards.node, "pos" );
|
|
let chd = nx.gui.find( this.nodAwards, "content" ).children;
|
|
let animcount = [];
|
|
chd.forEach( _item =>{
|
|
if( _item.svItem.mdata.status == 0 ){
|
|
animcount.push( _item.svItem.mdata.position )
|
|
}
|
|
} )
|
|
|
|
let result = _result.face_list;
|
|
let rewards = _result.item_list;
|
|
if( this.tween ){
|
|
this.tween.stop();
|
|
}
|
|
this.loopCount = _loop >= 0 ? _loop : this.loopCount;
|
|
// this.nodFocus.opacity = 156;
|
|
let num = 1;
|
|
// self.posssnod = [];
|
|
let all = num + this.circleCount * ( chd.length );
|
|
this.unscheduleAllCallbacks();
|
|
let self = this;
|
|
this.scheduleOnce(() => {
|
|
|
|
this.index++;
|
|
|
|
//循环到最后一个值之后从0开始
|
|
if ( this.index >= chd.length ) {
|
|
|
|
this.index = 0;
|
|
|
|
}
|
|
|
|
if( this.loopCount > 0 ){
|
|
this.delayTime = 0.08;
|
|
this.onDoing = true;
|
|
}
|
|
|
|
//当前运行次数++
|
|
if ( this.loopCount >= ( chd.length * ( this.circleCount - 0.2 ) ) ) {
|
|
|
|
//加速度,为最大时间间隔/空转之外需要运行的间隔(空转之外需要运行的间隔是一圈+抽奖的结果)
|
|
this.delayTime = 0.2;
|
|
|
|
}
|
|
|
|
if ( this.loopCount >= ( all - 6 ) ) {
|
|
|
|
//加速度,为最大时间间隔/空转之外需要运行的间隔(空转之外需要运行的间隔是一圈+抽奖的结果)
|
|
this.delayTime = 0.3;
|
|
|
|
}
|
|
|
|
this.loopCount++;
|
|
|
|
if( this.loopCount > all ){
|
|
this.loopCount = all ;
|
|
}
|
|
//总的运行次数 = 空转三圈 + 一圈缓冲 + 抽奖结果
|
|
|
|
this.count = chd.length * ( this.circleCount + 0.3 ) + _time;
|
|
|
|
//判断是不是运行完了
|
|
if ( this.loopCount >= all ) {
|
|
|
|
let cfg = gdata( self.data.config, "data_card_info" )[self.period];
|
|
for (let i = 0; i < chd.length; i++) {
|
|
let nod = chd[i];
|
|
nx.gui.setActive( nod, "node/focus", false );
|
|
// nx.tween.fadeOut( nod, "node/focus", 0.01 );
|
|
}
|
|
self.stopAllTwwen();
|
|
let rewardnods = [];
|
|
let cell = posss;
|
|
let poss = cell.convertToWorldSpaceAR( cc.Vec2.ZERO );
|
|
// let pos = self.nodAwards.node.parent.parent.convertToWorldSpaceAR( cc.Vec2.ZERO );
|
|
cell.position = self.nodAwards.node.convertToNodeSpaceAR( poss );
|
|
let nodtwen = cc.tween( self.nodAwards )
|
|
.delay( 0.001 )
|
|
.call( ()=>{
|
|
|
|
// TODO 閃卡牌 設置相關顯示
|
|
let domain = function(){
|
|
|
|
if( nx.dt.arrEmpty( result ) ){
|
|
|
|
for (let i = 0; i < chd.length; i++) {
|
|
let nod = chd[i];
|
|
let nxpine = nx.gui.getComponent( nod, "node/spine", "nx.fx.spine" );
|
|
if( nxpine ){
|
|
nxpine.stop();
|
|
}
|
|
let rewardnode = nx.gui.find( nod, "node/itemnormal" );
|
|
if( rewardnode.active ){
|
|
rewardnods.push( rewardnode );
|
|
}
|
|
// nx.gui.setActive( nod, "node/itemnormal", false );
|
|
}
|
|
|
|
self.doOtherAnimation( rewardnods );
|
|
// self.actdoing = false;
|
|
return;
|
|
}
|
|
// console.log( "遞加" + first );/
|
|
let resultitem = result.shift();
|
|
// console.log( "當前的數據顯示相關" + JSON.stringify( resultitem ) );
|
|
let item = resultitem;
|
|
let pos = cfg[item.id].position;
|
|
let nod = chd[pos-1];
|
|
let cost = cfg[item.id].debris;
|
|
let twen = cc.tween( nod )
|
|
.delay( 0.001 )
|
|
.call( ()=>{
|
|
nx.gui.setActive( nod, "node/focus", true );
|
|
// nx.tween.fadeIn( nod, "node/focus", 0.01 );
|
|
nx.audio.playSFX( "audios/effects/cardsure" );
|
|
} )
|
|
.delay( 0.5 )
|
|
.call( ()=>{
|
|
nx.gui.setActive( nod, "node/focus", false );
|
|
let path = cc.path.join( "resDB/effects/E9090" + nod.svItem.mdata.quality, "action" )
|
|
// nx.tween.fadeOut( nod, "node/focus", 0.01 );
|
|
nx.gui.setActive( nod, "node/bgspine", false );
|
|
let nxpine = nx.gui.getComponent( nod, "node/spine", "nx.fx.spine" );
|
|
if( item.is_debris == 0 ){
|
|
if( nxpine ){
|
|
nxpine.load( path, ( _e ) => {
|
|
// console.log( "change动画设置数据xxxx" + JSON.stringify( _e ) );
|
|
if( !_e ) {
|
|
nxpine.action( "action", false, ( _event ) => {
|
|
// console.log( path + "change设置数据xxxx" + JSON.stringify( item ) );
|
|
// console.log( "動畫節點" + _event );
|
|
if( _event == "change" ) {
|
|
// raffle();
|
|
nx.audio.playSFX( "audios/effects/cardboom" );
|
|
let show = nod.svItem.mdata;
|
|
show.status = 1;
|
|
|
|
if( nod.svItem ) {
|
|
nod.svItem.rebind( nod.svItem.index, show );
|
|
}
|
|
domain();
|
|
// return;
|
|
}
|
|
|
|
});
|
|
} else {
|
|
nxpine.stop();
|
|
}
|
|
} );
|
|
}
|
|
|
|
}else{
|
|
let noddd = nx.gui.find( nod, "node/itemnormal" );
|
|
let cmpp = nx.gui.getComponent( noddd, "item", "cmp.item.base" );
|
|
if( cmpp ){
|
|
nx.audio.playSFX( "audios/effects/cardboom" );
|
|
if( !nx.gui.find( nod, "node/get" ).active ){
|
|
let show = nod.svItem.mdata;
|
|
show.status = 1;
|
|
|
|
if( nod.svItem ) {
|
|
nod.svItem.rebind( nod.svItem.index, show );
|
|
}
|
|
}
|
|
|
|
let dataa = {
|
|
bid : self.spriteid,
|
|
num : cost
|
|
}
|
|
if( cmpp.mdata ){
|
|
dataa = {
|
|
bid : self.spriteid,
|
|
num : cost + cmpp.mdata.num
|
|
}
|
|
}
|
|
|
|
// reward.push( dataa );
|
|
cmpp.setData( dataa );
|
|
}
|
|
let goto = cc.tween( noddd )
|
|
.delay( 0.03 )
|
|
.call( ()=>{
|
|
( noddd.active && noddd.opacity == 255 ) || noddd.opacity == 255 ? "" : nx.tween.fadeIn( noddd, "", 0.02 );
|
|
} )
|
|
.delay( 0.5 )
|
|
.call( ()=>{
|
|
domain();
|
|
} )
|
|
.union()
|
|
.start();
|
|
self.twween.push( goto );
|
|
|
|
}
|
|
} )
|
|
// .delay( )
|
|
.start();
|
|
|
|
self.twween.push( twen );
|
|
}
|
|
domain();
|
|
|
|
} )
|
|
.start();
|
|
self.twween.push( nodtwen );
|
|
return;
|
|
|
|
} else {
|
|
|
|
//切换光环位置
|
|
for (let i = 0; i < chd.length; i++) {
|
|
let nod = chd[i];
|
|
// nx.tween.fadeOut( nod, "node/focus", 0.01 );
|
|
nx.gui.setActive( nod, "node/focus", false );
|
|
}
|
|
let indexxx = nx.dt.randomRange( this.index, ( chd.length - 1 ) );
|
|
nx.gui.setActive( chd[ indexxx ], "node/focus", true );
|
|
// nx.tween.fadeIn( chd[ indexxx ], "node/focus", 0.01 );
|
|
nx.audio.playSFX( "audios/effects/cardsure" );
|
|
|
|
this.onDoAni( _time, _result, self.loopCount );
|
|
|
|
}
|
|
|
|
}, this.delayTime, 0 ); //执行次数为0,实际执行次数为1
|
|
|
|
|
|
},
|
|
|
|
|
|
doOtherAnimation: function( _nodds ){
|
|
|
|
let self = this;
|
|
let chd = nx.gui.find( this.nodAwards, "content" ).children;
|
|
let chdr = self.nodLineR.children;
|
|
|
|
let rewardss = [];
|
|
let rewardnow = self.mod.vget( "ActsCollectCard" ).rewards;
|
|
for ( let rr = 0; rr < rewardnow.length; rr++ ) {
|
|
let line = rewardnow[rr];
|
|
let focus = nx.gui.find( chdr[ line.id - 1], "get" );
|
|
if( line.status == 1 && !focus.active ){
|
|
rewardss.push( line );
|
|
}
|
|
}
|
|
for (let i = 0; i < chd.length; i++) {
|
|
let nod = chd[i];
|
|
nx.gui.setActive( nod, "node/focus", false );
|
|
// nx.tween.fadeOut( nod, "node/focus", 0.01 );
|
|
let nodd = nx.gui.find( nod, "node/itemnormal" );
|
|
nodd.position = cc.Vec2.ZERO;
|
|
nodd.scale = 1;
|
|
}
|
|
// let rewardss = self.mod.vget( "ActsCollectCard" ).rewards;
|
|
|
|
let doindex = 0;
|
|
|
|
|
|
// console.log( JSON.stringify( self.mod.vget( "ActsCollectCard" ) ) + "當前的連綫獎勵--" + JSON.stringify( rewardss ) );
|
|
|
|
let doanimaline = function( _idx ){
|
|
|
|
if( nx.dt.arrEmpty( rewardss ) ){
|
|
|
|
self.flyToMat( _nodds );
|
|
return;
|
|
}
|
|
|
|
let ritem = rewardss.shift();
|
|
|
|
let linereward = chdr[ ritem.id - 1 ];
|
|
|
|
let linecontent = lines[ ritem.id - 1 ];
|
|
|
|
let rewardshowtween = cc.tween( self.nodAwards.node )
|
|
.delay( 0.01 )
|
|
.call( ()=>{
|
|
nx.audio.playSFX( "audios/effects/liner" );
|
|
for (let idx = 0; idx < linecontent.length; idx++) {
|
|
let idds = linecontent[idx];
|
|
let nod = chd[idds-1];
|
|
nx.gui.setActive( nod, "node/focus", true );
|
|
// nx.tween.fadeIn( nod, "node/focus", 0.1 );
|
|
}
|
|
} )
|
|
.delay( 1 )
|
|
.call( ()=>{
|
|
for (let idx = 0; idx < linecontent.length; idx++) {
|
|
let idds = linecontent[idx];
|
|
let nod = chd[idds-1];
|
|
nx.gui.setActive( nod, "node/focus", false );
|
|
// nx.tween.fadeOut( nod, "node/focus", 0.01 );
|
|
}
|
|
} )
|
|
.delay( 0.2 )
|
|
.call( ()=>{
|
|
for (let idx = 0; idx < linecontent.length; idx++) {
|
|
let idds = linecontent[idx];
|
|
let nod = chd[idds-1];
|
|
nx.gui.setActive( nod, "node/focus", true );
|
|
// nx.tween.fadeIn( nod, "node/focus", 0.1 );
|
|
}
|
|
} )
|
|
.delay( 0.6 )
|
|
.call( ()=>{
|
|
for (let idx = 0; idx < linecontent.length; idx++) {
|
|
let idds = linecontent[idx];
|
|
let nod = chd[idds-1];
|
|
nx.gui.setActive( nod, "node/focus", false );
|
|
// nx.tween.fadeOut( nod, "node/focus", 0.01 );
|
|
}
|
|
} )
|
|
.delay( 0.1 )
|
|
.call( ()=>{
|
|
doindex++;
|
|
|
|
let nxpine = nx.gui.getComponent( linereward, "reachspine", "nx.fx.spine" );
|
|
if( nxpine ){
|
|
nxpine.load( "resDB/effects/E90911/action", ( _e ) => {
|
|
if( !_e ) {
|
|
nxpine.action( "action", false, ( _event ) => {
|
|
|
|
if( _event == "complete" ) {
|
|
nxpine.stop();
|
|
// raffle();
|
|
nx.audio.playSFX( "audios/effects/lineresult" );
|
|
nx.gui.setActive( linereward, "cannot", false );
|
|
nx.gui.setActive( linereward, "get", true );
|
|
nx.gui.setActive( linereward, "rare", true );
|
|
|
|
doanimaline( doindex );
|
|
}
|
|
|
|
});
|
|
} else {
|
|
nxpine.stop();
|
|
}
|
|
} );
|
|
}
|
|
} )
|
|
// .delay( 0.3 )
|
|
// .call( ()=>{
|
|
// for (let idx = 0; idx < linecontent.length; idx++) {
|
|
// let idds = linecontent[idx];
|
|
// let nod = chd[idds-1];
|
|
// let nxpine = nx.gui.getComponent( nod, "node/linespine", "nx.fx.spine" );
|
|
// if( nxpine ){
|
|
// nxpine.load( "resDB/effects/E90912/action", ( _e ) => {
|
|
// if( !_e ) {
|
|
// nxpine.stop();
|
|
// // nxpine.action( "action", true );
|
|
// } else {
|
|
// nxpine.stop();
|
|
// }
|
|
// } );
|
|
// }
|
|
|
|
// }
|
|
// } )
|
|
.start();
|
|
self.twween.push( rewardshowtween );
|
|
}
|
|
doanimaline( doindex );
|
|
|
|
},
|
|
|
|
flyToMat: function( _noddds ){
|
|
|
|
let self = this;
|
|
let chd = nx.gui.find( this.nodAwards, "content" ).children;
|
|
if( nx.dt.arrEmpty( _noddds ) ){
|
|
|
|
for (let i = 0; i < chd.length; i++) {
|
|
let nod = chd[i];
|
|
let nodd = nx.gui.find( nod, "node/itemnormal" );
|
|
nodd.position = cc.Vec2.ZERO;
|
|
nodd.scale = 1;
|
|
}
|
|
|
|
this.isdoing = false;
|
|
this.actdoing = false;
|
|
this.dealOps( true );
|
|
return;
|
|
}
|
|
|
|
let cell = this.nodScore;
|
|
let tonod = cell.parent.convertToWorldSpaceAR( cell.position );
|
|
|
|
let gotoscore = cc.tween( this.nodAwards.node )
|
|
.delay( 0.01 )
|
|
.call( ()=>{
|
|
for (let n = 0; n < _noddds.length; n++) {
|
|
let noddd = _noddds[n];
|
|
let twengoto = cc.tween( noddd )
|
|
.to( 0.6, { position : noddd.parent.convertToNodeSpaceAR( tonod ), scale : 0.5, opacity : 0 } )
|
|
.call( ()=>{
|
|
nx.audio.playSFX( "audios/effects/getscore" );
|
|
noddd.position = cc.Vec2.ZERO;
|
|
noddd.scale = 1;
|
|
let cmpp = nx.gui.getComponent( noddd, "item", "cmp.item.base" );
|
|
if( cmpp ){
|
|
let data = {
|
|
bid : self.spriteid,
|
|
num : 0
|
|
}
|
|
|
|
cmpp.setData( data );
|
|
}
|
|
} )
|
|
.start();
|
|
self.twween.push( twengoto );
|
|
}
|
|
} )
|
|
.delay( 0.1 )
|
|
.call( ()=>{
|
|
|
|
for (let i = 0; i < chd.length; i++) {
|
|
let nod = chd[i];
|
|
let nodd = nx.gui.find( nod, "node/itemnormal" );
|
|
nodd.position = cc.Vec2.ZERO;
|
|
nodd.scale = 1;
|
|
}
|
|
let role = RoleController.getInstance().getRoleVo();
|
|
|
|
nx.gui.setString( self.nodScore, "txt", role.star_card_point );
|
|
|
|
self.isdoing = false;
|
|
self.actdoing = false;
|
|
this.dealOps( true );
|
|
} )
|
|
.start();
|
|
this.twween.push( gotoscore );
|
|
|
|
},
|
|
|
|
onTouchScore: function(){
|
|
let TC = TipsController.getInstance();
|
|
TC.showItemTips( this.scoreid );
|
|
},
|
|
|
|
onTouchStopAnim: function(){
|
|
|
|
|
|
this.isdoing = false;
|
|
this.actdoing = false;
|
|
this.stopAllTwwen();
|
|
nx.gui.setActive( this, "jump", false );
|
|
let chd = nx.gui.find( this.nodAwards, "content" ).children;
|
|
//切换光环位置
|
|
for (let i = 0; i < chd.length; i++) {
|
|
let nod = chd[i];
|
|
// nx.tween.fadeOut( nod, "node/focus", 0.01 );
|
|
nx.gui.setActive( nod, "node/focus", false );
|
|
}
|
|
|
|
if( this.twwn ){
|
|
this.twwn.stop();
|
|
}
|
|
|
|
this.stopAllTwwen();
|
|
|
|
this.unscheduleAllCallbacks();
|
|
if( nx.dt.arrNEmpty( this.anims ) ){
|
|
for ( let i = 0; i < this.anims.length; i++ ) {
|
|
let nod = this.anims[i];
|
|
if( nod ){
|
|
nod.stop();
|
|
}
|
|
}
|
|
}
|
|
this.mod.reqBaseInfo();
|
|
this.dealOps( true );
|
|
|
|
},
|
|
|
|
}); |