Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

Commit 1e9016e

Browse files
authored
Merge pull request #16 from cjsjy123/master
自动适配,移除richtext依赖
2 parents 203c7ab + 4c77b09 commit 1e9016e

File tree

10 files changed

+211
-98
lines changed

10 files changed

+211
-98
lines changed
0 Bytes
Binary file not shown.
8.27 KB
Binary file not shown.

Assets/Examples/Prefabs/Text.prefab.meta

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 Bytes
Binary file not shown.
-31.1 KB
Binary file not shown.

Assets/Examples/Scene/Chat.unity

-120 Bytes
Binary file not shown.

Assets/Examples/Scene/Text.unity

12.8 KB
Binary file not shown.

Assets/TextInlineSprite/Scripts/EmojiUIData.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,26 @@ public class SpriteTagInfo
4848
//表情位置
4949
public Vector3[] _Pos;
5050
//位置索引
51-
public int _Position;
51+
private int _Position =-1;
5252
//uv
5353
public Vector2[] _UV;
54+
55+
private const int dv = 100000;
56+
57+
public void FillIdxAndPlaceHolder(int idx,int cnt)
58+
{
59+
_Position = cnt * dv + idx;
60+
}
61+
62+
public int GetPlaceHolderCnt()
63+
{
64+
return _Position / dv;
65+
}
66+
67+
public int GetPositionIdx()
68+
{
69+
return _Position % dv;
70+
}
5471
}
5572

5673
public class UnitMeshInfo:IEquatable<UnitMeshInfo>

Assets/TextInlineSprite/Scripts/InlineManager.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ void Initialize()
143143
EmojiTools.EndSample();
144144

145145
RebuildTagList();
146+
147+
ForceRebuild();
146148
}
147149

148150
void LateUpdate()
@@ -348,6 +350,17 @@ public void UnRegister(InlineText _key)
348350
EmojiTools.EndSample();
349351
}
350352

353+
public void ForceRebuild()
354+
{
355+
EmojiTools.BeginSample("Emoji_ForceRebuild");
356+
InlineText[] alltexts = GetComponentsInChildren<InlineText>();
357+
for (int i = 0; i < alltexts.Length; i++)
358+
{
359+
alltexts[i].SetVerticesDirty();
360+
}
361+
EmojiTools.EndSample();
362+
}
363+
351364
/// <summary>
352365
/// 清除所有的精灵
353366
/// </summary>

0 commit comments

Comments
 (0)