| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using System.Text.RegularExpressions; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | using UnityEngine; |
| | | public class ImgAnalysis : TRichAnalysis<ImgAnalysis> |
| | |
| | | } |
| | | } |
| | | |
| | | 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) |