mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-20 15:36:18 +00:00
Update 3 IGetImageListener.imageReady call sites to v8 single-arg signature
IGetImageListener.imageReady(result: IImageResult) takes a single IImageResult object (with .id, .data, .image), but three call sites in the client still used the old 3-arg destructure '(id, texture, image) => ...'. The renderer's RoomEngine.ts already passes 'new ImageResult(...)' to the listener, so the runtime payload matches the new contract; the old call-site shape just type-errored. Migrated: - LayoutPetImageView (pet thumbnail loader) - LayoutRoomObjectImageView (furniture thumbnail loader) - useFurniturePresentWidget (gift box image generator) Also tightened imageFailed handlers from 'imageFailed: null' to a proper no-op arrow — the interface requires a callback.
This commit is contained in:
@@ -67,10 +67,12 @@ export const LayoutPetImageView: FC<LayoutPetImageViewProps> = props =>
|
|||||||
if(petTypeId === 16) petHeadOnly = false;
|
if(petTypeId === 16) petHeadOnly = false;
|
||||||
|
|
||||||
const imageResult = GetRoomEngine().getRoomObjectPetImage(petTypeId, petPaletteId, petColor1, new Vector3d((direction * 45)), 64, {
|
const imageResult = GetRoomEngine().getRoomObjectPetImage(petTypeId, petPaletteId, petColor1, new Vector3d((direction * 45)), 64, {
|
||||||
imageReady: async (id, texture, image) =>
|
imageReady: async (result) =>
|
||||||
{
|
{
|
||||||
if(isDisposed.current) return;
|
if(isDisposed.current) return;
|
||||||
|
|
||||||
|
const { image, data: texture } = result;
|
||||||
|
|
||||||
if(image)
|
if(image)
|
||||||
{
|
{
|
||||||
setPetUrl(image.src);
|
setPetUrl(image.src);
|
||||||
@@ -85,9 +87,9 @@ export const LayoutPetImageView: FC<LayoutPetImageViewProps> = props =>
|
|||||||
setHeight(texture.height);
|
setHeight(texture.height);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
imageFailed: (id) =>
|
imageFailed: () =>
|
||||||
{
|
{
|
||||||
|
// no-op
|
||||||
}
|
}
|
||||||
}, petHeadOnly, 0, petCustomParts, posture);
|
}, petHeadOnly, 0, petCustomParts, posture);
|
||||||
|
|
||||||
|
|||||||
@@ -53,13 +53,16 @@ export const LayoutRoomObjectImageView: FC<LayoutRoomObjectImageViewProps> = pro
|
|||||||
useEffect(() =>
|
useEffect(() =>
|
||||||
{
|
{
|
||||||
const imageResult = GetRoomEngine().getRoomObjectImage(roomId, objectId, category, new Vector3d(direction * 45), 64, {
|
const imageResult = GetRoomEngine().getRoomObjectImage(roomId, objectId, category, new Vector3d(direction * 45), 64, {
|
||||||
imageReady: async (id, texture, image) =>
|
imageReady: async (result) =>
|
||||||
{
|
{
|
||||||
const img = await TextureUtils.generateImage(texture);
|
const img = await TextureUtils.generateImage(result.data);
|
||||||
|
|
||||||
if(img && isMounted.current) setImageElement(img);
|
if(img && isMounted.current) setImageElement(img);
|
||||||
},
|
},
|
||||||
imageFailed: null
|
imageFailed: () =>
|
||||||
|
{
|
||||||
|
// no-op
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if(!imageResult) return;
|
if(!imageResult) return;
|
||||||
|
|||||||
@@ -53,19 +53,24 @@ const useFurniturePresentWidgetState = () =>
|
|||||||
{
|
{
|
||||||
// async fix image
|
// async fix image
|
||||||
return {
|
return {
|
||||||
imageReady: (id, texture, image) =>
|
imageReady: (result) =>
|
||||||
{
|
{
|
||||||
(async () =>
|
(async () =>
|
||||||
{
|
{
|
||||||
if(!image && texture)
|
let image = result.image;
|
||||||
|
|
||||||
|
if(!image && result.data)
|
||||||
{
|
{
|
||||||
image = await TextureUtils.generateImage(texture);
|
image = await TextureUtils.generateImage(result.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
setImageUrl(image.src);
|
if(image) setImageUrl(image.src);
|
||||||
})();
|
})();
|
||||||
},
|
},
|
||||||
imageFailed: null
|
imageFailed: () =>
|
||||||
|
{
|
||||||
|
// no-op
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user