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(-1500,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() { let data = {url:"Image/Girls/10001/DetailImg/10001_3"}; ViewManager.I.openBundlesView('ShowPanel',data); } 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(-1500,493,0)},{easing:"backIn"}).start(); } }