From 3f2cd27c5dfb3b450245bf1a37fc1b3414031c7c Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期三, 11 二月 2026 11:03:58 +0800
Subject: [PATCH] 小游戏适配 资源系统改造
---
Main/System/Message/ImgAnalysis.cs | 41 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/Main/System/Message/ImgAnalysis.cs b/Main/System/Message/ImgAnalysis.cs
index 05c8164..b678705 100644
--- a/Main/System/Message/ImgAnalysis.cs
+++ b/Main/System/Message/ImgAnalysis.cs
@@ -2,6 +2,7 @@
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
+using Cysharp.Threading.Tasks;
using UnityEngine;
public class ImgAnalysis : TRichAnalysis<ImgAnalysis>
@@ -229,6 +230,46 @@
}
}
+ private async UniTask LoadSpriteAsync()
+ {
+ if (presentImgInfo.IsFace) return;
+ if (IconConfig.isInit)
+ {
+ if (!string.IsNullOrEmpty(presentImgInfo.folderName))
+ {
+ presentImgInfo.sprite = await UILoader.LoadSpriteAsync(presentImgInfo.folderName, presentImgInfo.spriteName);
+ }
+ else
+ {
+ presentImgInfo.sprite = await UILoader.LoadSpriteAsync(presentImgInfo.spriteName);
+ }
+ }
+
+ if (presentImgInfo.sprite != null)
+ {
+ RichText text = RichTextMgr.Inst.presentRichText;
+ if (text != null)
+ {
+ if (text.LockImgSize)
+ {
+ presentImgInfo.width = presentImgInfo.height = text.fontSize;
+ return;
+ }
+ else if (text.ModifyImgSiez)
+ {
+ presentImgInfo.width = text.ModifyImgWidth;
+ presentImgInfo.height = text.ModifyImgHeight;
+ return;
+ }
+ }
+ if (presentImgInfo.scale != 1f)
+ {
+ presentImgInfo.width = presentImgInfo.sprite.rect.width * presentImgInfo.scale;
+ presentImgInfo.height = presentImgInfo.sprite.rect.height * presentImgInfo.scale;
+ }
+ }
+ }
+
private const string FACE_REPLACE = @"#~([0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z])";
public static Regex FaceRegex = new Regex(FACE_REPLACE, RegexOptions.Singleline);
public static string ReplaceFace(string msg)
--
Gitblit v1.8.0