|
|
@@ -26,7 +26,7 @@ export default class EffectOpenAndClose extends cc.Component {
|
|
|
@property({ type: cc.Enum(EffectType), displayName: '打开动画节点效果', visible() { return this.effect_par } })
|
|
|
private open_effect: EffectType = EffectType.scale;
|
|
|
|
|
|
- @property({displayName: '是否打开关闭动画'})
|
|
|
+ @property({ displayName: '是否打开关闭动画' })
|
|
|
private isOpenCloseEffect: boolean = true;
|
|
|
@property({ type: cc.Enum(EffectType), displayName: '关闭动画节点效果', visible() { return this.effect_par && this.isOpenCloseEffect } })
|
|
|
private close_effect: EffectType = EffectType.scale;
|
|
|
@@ -34,10 +34,10 @@ export default class EffectOpenAndClose extends cc.Component {
|
|
|
@property({ displayName: '关闭节点缩小到此节点坐标', visible() { return this.close_effect == EffectType.scaleToPoint } })
|
|
|
private close_toPoint: string = "";
|
|
|
|
|
|
- @property({displayName: '做关闭动画之前是否关闭黑背景'})
|
|
|
+ @property({ displayName: '做关闭动画之前是否关闭黑背景' })
|
|
|
private close_uibg: boolean = false;
|
|
|
|
|
|
- @property({displayName: '是否延迟一帧做动画'})
|
|
|
+ @property({ displayName: '是否延迟一帧做动画' })
|
|
|
private isDelayOneFrame: boolean = false;
|
|
|
|
|
|
private _play_open: boolean = false;
|
|
|
@@ -72,23 +72,22 @@ export default class EffectOpenAndClose extends cc.Component {
|
|
|
|
|
|
start() {
|
|
|
if (CC_EDITOR) return;
|
|
|
- if(this.isDelayOneFrame)
|
|
|
- {
|
|
|
- cc.tween(this.effect_par).delay(0.16).call(()=>{
|
|
|
+ if (this.isDelayOneFrame) {
|
|
|
+ cc.tween(this.effect_par).delay(0.16).call(() => {
|
|
|
this.showEffect();
|
|
|
}).start();
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
this.showEffect();
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 界面打开效果
|
|
|
*/
|
|
|
private showEffect() {
|
|
|
-
|
|
|
+
|
|
|
if (this.effect_par) {
|
|
|
switch (this.open_effect) {
|
|
|
case EffectType.none:
|
|
|
@@ -109,7 +108,7 @@ export default class EffectOpenAndClose extends cc.Component {
|
|
|
case EffectType.bottomIn:
|
|
|
this.effect_par.active = true;
|
|
|
this.effect_par.x = 0;
|
|
|
- this.effect_par.y = this.effect_par.y -cc.winSize.height;
|
|
|
+ this.effect_par.y = this.effect_par.y - cc.winSize.height;
|
|
|
//let toY = this.effect_par.y + this.effect_par.height;
|
|
|
let toY = 0;
|
|
|
cc.tween(this.effect_par)
|
|
|
@@ -126,20 +125,18 @@ export default class EffectOpenAndClose extends cc.Component {
|
|
|
*/
|
|
|
public hideEffect(cb?: Function) {
|
|
|
|
|
|
- if(!this.isOpenCloseEffect)
|
|
|
+ if (!this.isOpenCloseEffect)
|
|
|
return;
|
|
|
|
|
|
if (this.effect_par) {
|
|
|
|
|
|
- if(this.close_uibg)
|
|
|
- {
|
|
|
+ if (this.close_uibg) {
|
|
|
let graph = this.node.getComponentInChildren(cc.Graphics);
|
|
|
- if(graph)
|
|
|
- {
|
|
|
+ if (graph) {
|
|
|
graph.enabled = false;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
switch (this.close_effect) {
|
|
|
case EffectType.none:
|
|
|
cb && cb();
|