更新内容: 1.图片上传后自动置中显示

FUJIFILM
zc 2025-09-05 18:17:56 +08:00
parent df22f90ed2
commit 03df10c663
11 changed files with 131 additions and 13160 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -182,6 +182,7 @@ namespace HK.Tool
waitingPage.SetActive(true);
qrcodePage.SetActive(false);
int i = 0;
currentSprites.Clear();
Debug.Log(urls.Count);
foreach (string url in urls)

View File

@ -75,17 +75,19 @@ namespace HK.FUJIFILM
var image = loadGameObject.GetComponent<Image>();
image.sprite = args.sprite;
var itemPosition = Vector2.zero;
image.rectTransform.anchoredPosition = itemPosition;
ImageScaler.ScaleImageWithMaxSize_Scale(image, designItem.SizeDeltaMax);
// ImageScaler.ScaleImageWithSize(image, designItem.SizeDeltaMax);
var itemPosition = Vector2.zero;
image.rectTransform.anchoredPosition = itemPosition;
loadGameObject.SetActive(true);
var rectTransformSizeDelta = designItem.RectTransform.sizeDelta / 2;
loadGameObject.GetComponent<RectTransform>().anchoredPosition = new Vector2(
Random.Range(-rectTransformSizeDelta.x, rectTransformSizeDelta.x),
Random.Range(-rectTransformSizeDelta.y, rectTransformSizeDelta.y));
// 随机位置
// var rectTransformSizeDelta = designItem.RectTransform.sizeDelta / 2;
// loadGameObject.GetComponent<RectTransform>().anchoredPosition = new Vector2(
// Random.Range(-rectTransformSizeDelta.x, rectTransformSizeDelta.x),
// Random.Range(-rectTransformSizeDelta.y, rectTransformSizeDelta.y));
EventManager.Instance.FireNow(this,
new MugActualModel_Fixed_GenPhotoEventArgs(loadGameObject, designItem.ID));

View File

@ -296,6 +296,7 @@ namespace HK.FUJIFILM
{
foreach (var templateSprite in list)
{
Debug.Log($"gen photo {templateSprite.name}");
var loadGameObject = ResourcesManager.Instance.LoadGameObject(
AssetConst.Assets_Res_FUJIFILM_Prefabs_UI_Item_goDesignPhotoItem_prefab, scrPhoto.content);
loadGameObject.SetActive(true);

View File

@ -57,5 +57,28 @@ namespace HK.FUJIFILM
Debug.Log($"✅ 压缩成功,输出文件: {outputPath}");
}
public static void CompressPngAndSetDpi(byte[] bytes, string outputPath)
{
using (var image = new MagickImage(bytes))
{
// 设置 300 DPI
image.Density = new Density(300, 300, DensityUnit.PixelsPerInch);
// 设置压缩参数(对于 PNG 有效)
image.Format = MagickFormat.Png;
image.Quality = 100; // 保证无损
image.Depth = 8; // PNG 8bit通常足够
// 选择压缩过滤器
image.Settings.SetDefine(MagickFormat.Png, "compression-filter", "5");
image.Settings.Compression = CompressionMethod.Zip; // PNG 默认
// 写入输出文件
image.Write(outputPath);
}
Debug.Log($"✅ 压缩成功,输出文件: {outputPath}");
}
}
}

View File

@ -1,7 +1,7 @@
{
"FileVersion": "1.0.0",
"PackageName": "DefaultPackage",
"PackageVersion": "2025-09-04-762",
"PackageVersion": "2025-09-05-1073",
"Wrappers": [
{
"BundleGUID": "01184a0f7f1c00a9e28a6932cfbe1a4f",
@ -11,10 +11,6 @@
"BundleGUID": "020c3fa177ffad0c70a67bed6489dda2",
"FileName": "020c3fa177ffad0c70a67bed6489dda2.bundle"
},
{
"BundleGUID": "025fe3704124c293e0f7e63c6622777d",
"FileName": "025fe3704124c293e0f7e63c6622777d.bundle"
},
{
"BundleGUID": "02cf0baf2ee9ba4839b2f252a6cdffc6",
"FileName": "02cf0baf2ee9ba4839b2f252a6cdffc6.bundle"
@ -263,6 +259,10 @@
"BundleGUID": "a3f05fe1cb86fe6f198e4c9aeb8ca797",
"FileName": "a3f05fe1cb86fe6f198e4c9aeb8ca797.bundle"
},
{
"BundleGUID": "a4f4e2337e67cdb78a8ecc0591f85f33",
"FileName": "a4f4e2337e67cdb78a8ecc0591f85f33.bundle"
},
{
"BundleGUID": "a552779b664e1b6387821881b9501070",
"FileName": "a552779b664e1b6387821881b9501070.bundle"

View File

@ -1 +1 @@
2025-09-04-762
2025-09-05-1073

View File

@ -129,7 +129,9 @@ public class RenderPrintingManager : MonoBehaviour
var fileInfo = new FileInfo(uploadTmp);
var cutBG = fileInfo.Directory.FullName + $"cut bg {fileInfo.Name}";
yield return StartCoroutine(Wait(uploadTmp, cutBG));
// 褪底功能
// yield return StartCoroutine(Wait(uploadTmp, cutBG));
Debug.Log(cutBG);
Debug.Log("finish");
@ -149,9 +151,10 @@ public class RenderPrintingManager : MonoBehaviour
var nowTicks = DateTime.Now.Ticks;
string filePath = Path.Combine(FolderPath, $"printing-{nowTicks}");
var outputPath = $"{filePath}.png";
File.WriteAllBytes(outputPath, B83.Image.PNGTools.ChangePPI(bytes, 300, 300));
var changePpi = B83.Image.PNGTools.ChangePPI(bytes, 300, 300);
// File.WriteAllBytes(outputPath, changePpi);
PngCompressor.CompressPngAndSetDpi(outputPath, outputPath);
PngCompressor.CompressPngAndSetDpi(changePpi, outputPath);
printingDatas.Add(File.ReadAllBytes(outputPath));
string tmpPath = outputPath;
// File.WriteAllBytes(tmpPath, B83.Image.PNGTools.ChangePPI(bytes, 300, 300));

View File

@ -33,26 +33,26 @@ MonoBehaviour:
m_Settings:
m_SettingsList:
m_List:
- rid: 5235812828566782114
- rid: 5235812892772401233
- rid: 7138963020590612481
- rid: 5235812828566782115
- rid: 5235812892772401234
- rid: 7138963020590612483
- rid: 5235812828566782116
- rid: 5235812892772401235
- rid: 7138963020590612485
- rid: 7138963020590612486
- rid: 5235812828566782117
- rid: 5235812892772401236
- rid: 7138963020590612488
- rid: 7138963020590612489
- rid: 7138963020590612490
- rid: 5235812828566782118
- rid: 5235812892772401237
- rid: 7138963020590612492
- rid: 5235812828566782119
- rid: 5235812828566782120
- rid: 5235812828566782121
- rid: 5235812828566782122
- rid: 5235812892772401238
- rid: 5235812892772401239
- rid: 5235812892772401240
- rid: 5235812892772401241
- rid: 7138963020590612497
- rid: 5235812828566782123
- rid: 5235812828566782124
- rid: 5235812892772401242
- rid: 5235812892772401243
- rid: 7138963020590612500
m_RuntimeSettings:
m_List:
@ -96,7 +96,7 @@ MonoBehaviour:
references:
version: 2
RefIds:
- rid: 5235812828566782114
- rid: 5235812892772401233
type: {class: UniversalRenderPipelineEditorShaders, ns: UnityEngine.Rendering.Universal,
asm: Unity.RenderPipelines.Universal.Runtime}
data:
@ -118,7 +118,7 @@ MonoBehaviour:
type: 3}
m_DefaultSpeedTree9Shader: {fileID: -6465566751694194690, guid: cbd3e1cc4ae141c42a30e33b4d666a61,
type: 3}
- rid: 5235812828566782115
- rid: 5235812892772401234
type: {class: Renderer2DResources, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime}
data:
m_Version: 0
@ -142,7 +142,7 @@ MonoBehaviour:
type: 2}
m_DefaultMaskMaterial: {fileID: 2100000, guid: 15d0c3709176029428a0da2f8cecf0b5,
type: 2}
- rid: 5235812828566782116
- rid: 5235812892772401235
type: {class: UniversalRenderPipelineEditorMaterials, ns: UnityEngine.Rendering.Universal,
asm: Unity.RenderPipelines.Universal.Runtime}
data:
@ -156,7 +156,7 @@ MonoBehaviour:
type: 2}
m_DefaultDecalMaterial: {fileID: 2100000, guid: 31d0dcc6f2dd4e4408d18036a2c93862,
type: 2}
- rid: 5235812828566782117
- rid: 5235812892772401236
type: {class: URPShaderStrippingSetting, ns: UnityEngine.Rendering.Universal,
asm: Unity.RenderPipelines.Universal.Runtime}
data:
@ -164,7 +164,7 @@ MonoBehaviour:
m_StripUnusedPostProcessingVariants: 1
m_StripUnusedVariants: 1
m_StripScreenCoordOverrideVariants: 1
- rid: 5235812828566782118
- rid: 5235812892772401237
type: {class: GPUResidentDrawerResources, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.GPUDriven.Runtime}
data:
m_Version: 0
@ -186,7 +186,7 @@ MonoBehaviour:
type: 3}
m_DebugOccluderPS: {fileID: 4800000, guid: b3c92426a88625841ab15ca6a7917248,
type: 3}
- rid: 5235812828566782119
- rid: 5235812892772401238
type: {class: ProbeVolumeRuntimeResources, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime}
data:
m_Version: 1
@ -196,14 +196,14 @@ MonoBehaviour:
type: 3}
probeVolumeUploadDataL2CS: {fileID: 7200000, guid: 6196f34ed825db14b81fb3eb0ea8d931,
type: 3}
- rid: 5235812828566782120
- rid: 5235812892772401239
type: {class: IncludeAdditionalRPAssets, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime}
data:
m_version: 0
m_IncludeReferencedInScenes: 0
m_IncludeAssetsByLabel: 0
m_LabelToInclude:
- rid: 5235812828566782121
- rid: 5235812892772401240
type: {class: ProbeVolumeBakingResources, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime}
data:
m_Version: 1
@ -225,13 +225,13 @@ MonoBehaviour:
type: 3}
renderingLayerRT: {fileID: -5126288278712620388, guid: 94a070d33e408384bafc1dea4a565df9,
type: 3}
- rid: 5235812828566782122
- rid: 5235812892772401241
type: {class: STP/RuntimeResources, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime}
data:
m_setupCS: {fileID: 7200000, guid: 33be2e9a5506b2843bdb2bdff9cad5e1, type: 3}
m_preTaaCS: {fileID: 7200000, guid: a679dba8ec4d9ce45884a270b0e22dda, type: 3}
m_taaCS: {fileID: 7200000, guid: 3923900e2b41b5e47bc25bfdcbcdc9e6, type: 3}
- rid: 5235812828566782123
- rid: 5235812892772401242
type: {class: ProbeVolumeDebugResources, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime}
data:
m_Version: 1
@ -247,7 +247,7 @@ MonoBehaviour:
type: 3}
numbersDisplayTex: {fileID: 2800000, guid: 73fe53b428c5b3440b7e87ee830b608a,
type: 3}
- rid: 5235812828566782124
- rid: 5235812892772401243
type: {class: ProbeVolumeGlobalSettings, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime}
data:
m_Version: 1