update
This commit is contained in:
@@ -1,52 +1,104 @@
|
||||
import { _decorator, Component, Node,Sprite,Vec3 ,tween, UITransform} from 'cc';
|
||||
import {
|
||||
_decorator,
|
||||
Component,
|
||||
Node,
|
||||
Sprite,
|
||||
Vec3,
|
||||
tween,
|
||||
UITransform,
|
||||
path,
|
||||
} 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";
|
||||
import { ViewManager } from "db://assets/Scripts/Main/Manager/ViewManager";
|
||||
import { DataId, DataManager } from "../../data/DataManager";
|
||||
import { GirlData } from "../../data/GirlData";
|
||||
import proto from "db://assets/Scripts/proto/proto.pb.js";
|
||||
import { GButton } from "../../../Main/Common/GButton";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('ImagePopup')
|
||||
@ccclass("ImagePopup")
|
||||
export class ImagePopup extends Component {
|
||||
@property(Sprite)
|
||||
image:Sprite;
|
||||
@property(Sprite)
|
||||
image: Sprite;
|
||||
|
||||
start() {
|
||||
this.node.setPosition(new Vec3(-1500, 493, 0));
|
||||
GButton.BandClick(this.image.node, this.openImage, this);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
categoryId: string;
|
||||
girlId: number;
|
||||
resId: number;
|
||||
//url: string;
|
||||
refresh(categoryId: string, girlId: number, resId: number, clear = false) {
|
||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||
this.categoryId = categoryId;
|
||||
this.girlId = girlId;
|
||||
this.resId = resId;
|
||||
const url = girlData.getGrilPhotoPic(categoryId, girlId, resId);
|
||||
//this.url = path;
|
||||
ResManager.I.changeBundleSpriteFrame(
|
||||
this.image,
|
||||
url + (clear ? "" : "_thumbnail_blur"),
|
||||
"Girls",
|
||||
() => {
|
||||
let sizeTran = this.image.node.parent.getComponent(UITransform);
|
||||
Utils.adjustBgPixelRatioToSize(
|
||||
sizeTran.contentSize,
|
||||
this.image.node,
|
||||
2
|
||||
);
|
||||
this.popUp();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
refreshSelf() {
|
||||
this.refresh(this.categoryId, this.girlId, this.resId, true);
|
||||
}
|
||||
|
||||
openImage() {
|
||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||
const isUnlock = girlData.isImageUnlock(
|
||||
this.categoryId,
|
||||
this.girlId,
|
||||
this.resId
|
||||
);
|
||||
|
||||
if (isUnlock) {
|
||||
let data = {
|
||||
url: girlData.getGrilPhotoPic(this.categoryId, this.girlId, this.resId),
|
||||
isImg: true,
|
||||
};
|
||||
ViewManager.I.openBundlesView("ShowPanel", data);
|
||||
} else {
|
||||
ViewManager.I.openBundlesView("PopupGirlDetailPanel", {
|
||||
category: this.categoryId,
|
||||
resId: this.resId,
|
||||
girlId: this.girlId,
|
||||
base: this,
|
||||
type: proto.cs.EnmResType.ERT_Image,
|
||||
});
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
//
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user