update
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
import { _decorator, Component, Node,Sprite,Vec3 ,tween, UITransform} from 'cc';
|
||||
import ResManager from "db://assets/Scripts/Main/Manager/ResManager";
|
||||
import Utils from "db://assets/Scripts/Main/Common/Utils";
|
||||
import {ViewManager} from "db://assets/Scripts/Main/Manager/ViewManager";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('ImagePopup')
|
||||
export class ImagePopup extends Component {
|
||||
@property(Sprite)
|
||||
image:Sprite;
|
||||
|
||||
|
||||
start()
|
||||
{
|
||||
this.node.setPosition(new Vec3(-1000,493,0));
|
||||
this.image.node.on(Node.EventType.TOUCH_START,this.openImage);
|
||||
}
|
||||
|
||||
onDestroy()
|
||||
{
|
||||
this.image.node.off(Node.EventType.TOUCH_START,this.openImage);
|
||||
}
|
||||
|
||||
refresh(path:string)
|
||||
{
|
||||
ResManager.I.changeBundleSpriteFrame(this.image,path,"Chat18x",()=>{
|
||||
let sizeTran = this.image.node.parent.getComponent(UITransform);
|
||||
Utils.adjustBgPixelRatioToSize(sizeTran.contentSize,this.image.node,2);
|
||||
this.popUp();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
openImage()
|
||||
{
|
||||
ViewManager.I.openBundlesView('ShowPanel');
|
||||
}
|
||||
popUp()
|
||||
{
|
||||
tween(this.node).to(0.5,{position:new Vec3(-559.374,493,0)},{easing:"backOut"}).start();
|
||||
this.scheduleOnce(()=>{
|
||||
this.popDown();
|
||||
},5);
|
||||
}
|
||||
popDown()
|
||||
{
|
||||
tween(this.node).to(0.5,{position:new Vec3(-1000,493,0)},{easing:"backIn"}).start();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user