update_blur
This commit is contained in:
@@ -166,34 +166,33 @@ export class GirlDetailPanel extends li_BaseView {
|
||||
// 也立即尝试调整(以防已经加载完成)
|
||||
this.adjustVideoScale();
|
||||
this.vids = dataDetail.commercialVideos.slice(0);
|
||||
const paths = dataDetail.commercialImages.map((a) => a.path);
|
||||
this.refreshImgs(paths, true);
|
||||
this.refreshImgs(dataDetail.commercialImages);
|
||||
}
|
||||
|
||||
vids: purchase.CommercialVideo[];
|
||||
bindImgToggle() {
|
||||
const dataDetail = ConfigManager.tables.TbGirlsDetail.get(this.id);
|
||||
const paths = dataDetail.commercialImages.map((a) => a.path);
|
||||
const images = dataDetail.commercialImages;
|
||||
|
||||
this.refreshImgs(paths, true);
|
||||
this.refreshImgs(images);
|
||||
}
|
||||
|
||||
bindVideoToggle() {
|
||||
const paths = this.vids.map((a) => a.path);
|
||||
|
||||
this.refreshImgs(paths, false);
|
||||
this.refreshImgs(this.vids);
|
||||
}
|
||||
|
||||
refreshImgs(paths: string[], isImg: boolean) {
|
||||
refreshImgs(
|
||||
resouces: purchase.CommercialImage[] | purchase.CommercialVideo[]
|
||||
) {
|
||||
for (let i = this.imgsLayout.children.length - 1; i >= 0; i--) {
|
||||
this.imgsLayout.children[i].destroy();
|
||||
}
|
||||
|
||||
for (let i = 1; i < paths.length; i++) {
|
||||
const path = paths[i];
|
||||
for (let i = 1; i < resouces.length; i++) {
|
||||
const resource = resouces[i];
|
||||
let newNode = instantiate(this.imgItemInst.node);
|
||||
let item = newNode.getComponent(DetailImageItem);
|
||||
item.refresh(path, this, isImg);
|
||||
item.refresh(resource, this);
|
||||
newNode.active = true;
|
||||
this.imgsLayout.addChild(newNode);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import ResManager from "db://assets/Scripts/Main/Manager/ResManager";
|
||||
import { ViewManager } from "db://assets/Scripts/Main/Manager/ViewManager";
|
||||
import { GButton } from "db://assets/Scripts/Main/Common/GButton";
|
||||
import { GirlDetailPanel } from "../ui/panels/GirlDetailPanel";
|
||||
import { purchase } from "../../schema/schema";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -80,17 +81,28 @@ export class DetailImageItem extends Component {
|
||||
);
|
||||
}
|
||||
}
|
||||
refresh(path: string, base: GirlDetailPanel, isImage: boolean = true) {
|
||||
refresh(
|
||||
resource: purchase.CommercialImage | purchase.CommercialVideo,
|
||||
base: GirlDetailPanel
|
||||
) {
|
||||
this.base = base;
|
||||
this.lock.active = false;
|
||||
this.question.active = true; // 显示问号,表示加载中
|
||||
this.url = path;
|
||||
this.url = resource.path;
|
||||
|
||||
let imgPath = this.url;
|
||||
this.isImage = isImage;
|
||||
if (!isImage) {
|
||||
imgPath = this.url + "_thumbnail";
|
||||
|
||||
if (resource instanceof purchase.CommercialImage) {
|
||||
this.isImage = true;
|
||||
} else {
|
||||
this.isImage = false;
|
||||
if (resource.videoPrice > 0) {
|
||||
imgPath = this.url + "_thumbnail_blur";
|
||||
} else {
|
||||
imgPath = this.url + "_thumbnail";
|
||||
}
|
||||
}
|
||||
|
||||
ResManager.I.changeBundleSpriteFrame(this.img, imgPath, "Chat18x", () => {
|
||||
this.question.active = false; // 图片加载成功后隐藏问号
|
||||
this.scaleToFillItem();
|
||||
|
||||
Reference in New Issue
Block a user