4.7 KiB
4.7 KiB
Chat Emoji Progress Summary
Scope
- Muc tieu: hoan thien luong chat co emoji (input -> send -> render TMP) cho Unity client.
- Ngu canh: du an dang chuyen doi tu C++ PC sang C# Unity, uu tien giong logic goc.
Bugs Da Tim Thay Va Da Sua
-
AUICommon.FilterEmotionSetbi crashNullReferenceException.- Nguyen nhan: dung
Dictionaryenumerator sai (docCurrenttruocMoveNext). - Da sua: doi sang
while (it.MoveNext()), them check null item.
- Nguyen nhan: dung
-
UnmarshalEditBoxTextkhong extract item nao.- Nguyen nhan:
itemMask = 0. - Da sua: dung
ITEMMASK_ALL = ~0.
- Nguyen nhan:
-
EditBoxItemsSetdung range item-code sai (\u0001..\u0010) gay vo toan bo parse/lookup.- Nguyen nhan: constants local khong dong bo voi
AUICommon.AUICOMMON_ITEM_CODE_START/END(\uE000..\uE3FF). - Da sua:
- bo constants sai trong
EditBoxItemsSet, - dung range cua
AUICommoncho check/next-char.
- bo constants sai trong
- Nguyen nhan: constants local khong dong bo voi
-
Hien thi raw wire text trong TMP: `` +
<0><0:41>.- Nguyen nhan: wire format khong phai TMP rich text.
- Da sua:
- input chen
<sprite name="...">neu resolve duoc, - truoc khi gui convert
<sprite>-> wire.
- input chen
Thay Doi Ve Architecture Emoji/TMP
-
Ho tro nhieu bo emoji (9 bo) bang mapping theo set:
EmotionSetSpriteAssetEntry(EmotionSetIndex -> TMP_SpriteAsset).EmotionLibrarySpriteMap.SpriteAssetsPerEmotionSet.
-
EmotionLibrarySpriteMapda cap nhat:- tra dung sprite asset theo
emotionSet, - fallback ve
TmpSpriteAssetde tuong thich cau hinh cu, - fallback ten
cell_XXXXcho asset cu.
- tra dung sprite asset theo
-
Converter atlas dat ten sprite theo namespace:
- tu
cell_XXXX->s{N}_cell_XXXX(N = EmotionSetIndex), - tranh trung ten khi gom nhieu pack vao TMP.
- tu
Cac File Da Duoc Them/Sua
-
Sua:
Assets/PerfectWorld/Scripts/Network/CSNetwork/AUICommon.csAssets/Scripts/ChatInputHandler.csAssets/Scripts/CECUIManager.csAssets/PerfectWorld/Scripts/Chat/EmotionData/EmotionLibrarySpriteMap.csAssets/PerfectWorld/Scripts/Editor/EmotionAtlasConverterCore.csAssets/PerfectWorld/Scripts/Editor/EmotionAtlasConverterWindow.cs
-
Them moi:
Assets/PerfectWorld/Scripts/Chat/ChatInputTmpSpriteConverter.csAssets/PerfectWorld/Scripts/Chat/EmotionData/EmotionSetSpriteAssetEntry.csAssets/PerfectWorld/Scripts/Editor/EmotionLibrarySpriteMapEditor.csAssets/Scripts/ChatEmojiQuickTest.cs
Class Test Nhanh
ChatEmojiQuickTestda duoc tao de test local:- nhap text + chen emoji,
- send va hien thi len
TextMeshProUGUI, - mo phong luong: TMP tag -> wire -> TMP display.
Viec Can Setup Trong Unity (Bat Buoc)
-
EmotionLibrarySpriteMap:- gan
Library, - sync va gan du
SpriteAssetsPerEmotionSetcho 9 bo.
- gan
-
TMP asset:
- dam bao sprite naming khop (
s{N}_cell_XXXX), - setup fallback sprite assets de resolve du tat ca bo khi dung
<sprite name>.
- dam bao sprite naming khop (
-
Input/Output TMP:
- co sprite asset va fallback phu hop.
Ket Qua Ky Vong
- Khong con crash tai
FilterEmotionSet. - Khong con hien raw wire text khi da qua conversion dung luong.
- Co the nhap emoji, gui len, va hien thi icon tren
TextMeshProUGUI(neu setup asset dung).
Cap nhat bug nghiem trong: chon set khac van ra emoji set 1 (2026-04-09)
-
Hien tuong:
- Co 9 bo emoji.
- Chon emoji o set 1 thi dung.
- Chon set 2..8 van render hinh cua set 1.
-
Nguyen nhan goc:
- Tag TMP dang tao dang
<sprite name="cell_XXXX">(hoac<sprite index=...>), khong chi dinh roTMP_SpriteAsset. - Khi nhieu sprite asset deu co cung ten
cell_XXXX, TMP uu tien asset mac dinh/fallback dau tien => thuong la set 1.
- Tag TMP dang tao dang
-
Cach sua da ap dung:
- Them
SpriteAssetNamevaoEmotionSpriteInfo. EmotionLibrarySpriteMap.TryGetSprite(...)tra them ten asset theo tungemotionSet(set.TmpSpriteAsset.name).EmotionTMPTagBuilder.BuildSpriteTag(...)tao tag co kem asset:<sprite="Emotions N" name="cell_XXXX">- hoac
<sprite="Emotions N" anim="start,end,fps"> - hoac
<sprite="Emotions N" index=N>.
AUICommon.ConvertEmotionsToTMP(...)dung chungEmotionTMPTagBuilder.BuildSpriteTag(info)de tat ca luong render dong nhat.
- Them
-
File da sua cho fix nay:
Assets/PerfectWorld/Scripts/Network/CSNetwork/AUICommon.csAssets/PerfectWorld/Scripts/Chat/EmotionTMPTagBuilder.csAssets/PerfectWorld/Scripts/Chat/EmotionData/EmotionLibrarySpriteMap.cs
-
Dieu kien setup de hoat dong dung:
- Trong
EmotionLibrarySO, moiEmotionSetSnapshotphai gan dungTmpSpriteAssettuong ung tung set. - Ten asset can on dinh, vi du
Emotions 0,Emotions 1, ...; tag su dung chinh ten nay.
- Trong
-
Ket qua sau fix:
- Emoji duoc resolve dung theo
emotionSet. - Khong con tinh trang chon set khac nhung hien thi hinh cua set 1.
- Emoji duoc resolve dung theo