美术更新
- detail页面修改 - ui布局修改
This commit is contained in:
@@ -55,19 +55,12 @@ export class DetailImageItem extends Component {
|
||||
const itemSize = this.uitransform.contentSize;
|
||||
const imageSize = this.img.spriteFrame.originalSize;
|
||||
|
||||
console.log("DetailImageItem doScaleToFill:", {
|
||||
itemSize,
|
||||
imageSize,
|
||||
url: this.url
|
||||
});
|
||||
|
||||
if (
|
||||
itemSize.width === 0 ||
|
||||
itemSize.height === 0 ||
|
||||
imageSize.width === 0 ||
|
||||
imageSize.height === 0
|
||||
) {
|
||||
console.log("DetailImageItem: Invalid size, skipping scale");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -75,44 +68,30 @@ export class DetailImageItem extends Component {
|
||||
const scaleY = itemSize.height / imageSize.height;
|
||||
const scale = Math.max(scaleX, scaleY);
|
||||
|
||||
console.log("DetailImageItem scale values:", { scaleX, scaleY, finalScale: scale });
|
||||
|
||||
// 设置Sprite的sizeMode为CUSTOM,允许自定义大小
|
||||
this.img.sizeMode = Sprite.SizeMode.CUSTOM;
|
||||
|
||||
|
||||
// 获取图片节点的UITransform并设置大小
|
||||
const imgTransform = this.img.node.getComponent(UITransform);
|
||||
if (imgTransform) {
|
||||
imgTransform.setContentSize(imageSize.width * scale, imageSize.height * scale);
|
||||
console.log("DetailImageItem: Set image size to", imgTransform.contentSize);
|
||||
}
|
||||
}
|
||||
refresh(path: string, base: GirlDetailPanel) {
|
||||
this.base = base;
|
||||
this.lock.active = false;
|
||||
this.question.active = false;
|
||||
|
||||
if (true) {
|
||||
this.url = path;
|
||||
// if (info.imageState !== ImageState.Release) {
|
||||
// this.url += '_blured';
|
||||
// if (info.imageState === ImageState.Lock)
|
||||
// this.img.color = new math.Color(127, 127, 127, 255);
|
||||
// else
|
||||
// this.img.color = new math.Color(50, 50, 50, 255);
|
||||
|
||||
// } else {
|
||||
// this.img.color = new math.Color(255, 255, 255, 255);
|
||||
// }
|
||||
|
||||
ResManager.I.changeBundleSpriteFrame(
|
||||
this.img,
|
||||
this.url,
|
||||
"Chat18x",
|
||||
() => {
|
||||
this.scaleToFillItem();
|
||||
}
|
||||
imgTransform.setContentSize(
|
||||
imageSize.width * scale,
|
||||
imageSize.height * scale
|
||||
);
|
||||
}
|
||||
}
|
||||
refresh(path: string, base: GirlDetailPanel, isImage: boolean = true) {
|
||||
this.base = base;
|
||||
this.lock.active = false;
|
||||
this.question.active = false;
|
||||
this.url = path;
|
||||
|
||||
let imgPath = this.url;
|
||||
if (!isImage) {
|
||||
imgPath = this.url + "_thumbnail";
|
||||
}
|
||||
ResManager.I.changeBundleSpriteFrame(this.img, imgPath, "Chat18x", () => {
|
||||
this.scaleToFillItem();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ export class ThemeItem extends Component {
|
||||
"Chat18x",
|
||||
() => {
|
||||
let sizeTran = this.img.node.parent.getComponent(UITransform);
|
||||
Utils.adjustBgPixelRatioToSize(sizeTran.contentSize, this.img.node, 2);
|
||||
Utils.adjustBgPixelRatioToSize(sizeTran.contentSize, this.img.node, 3);
|
||||
}
|
||||
);
|
||||
GButton.RemoveAndBandClick(this.node, this.OnClickThis, this);
|
||||
|
||||
Reference in New Issue
Block a user