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

Commit 8fb2a57

Browse files
authored
Merge pull request #17 from cjsjy123/master
more easy and more faster and less gc
2 parents 1e9016e + a6aacfb commit 8fb2a57

40 files changed

+3676
-3566
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@
3535
*.csproj
3636
*.sln
3737
*.suo
38+
/Assets/Plugins
-7.8 KB
Binary file not shown.
-5.67 KB
Binary file not shown.
1.28 KB
Binary file not shown.
31.1 KB
Binary file not shown.

Assets/Examples/Scene/.DS_Store

6 KB
Binary file not shown.

Assets/Examples/Scene/Chat.unity

-13.1 KB
Binary file not shown.

Assets/Examples/Scene/Text.unity

320 Bytes
Binary file not shown.

Assets/Examples/Scripts/ChatTest.cs

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,39 @@
1212
using UnityEngine.UI;
1313
using EmojiUI;
1414

15-
public class ChatTest : MonoBehaviour {
16-
17-
[SerializeField]
18-
private GameObject _PreChatItem;
19-
[SerializeField]
20-
private RectTransform _ChatParent;
21-
[SerializeField]
22-
private RectTransform _ViewContent;
23-
[SerializeField]
24-
private InputField _InputText;
25-
26-
public int testcnt;
27-
28-
#region 点击发送
29-
public void OnClickSend()
30-
{
31-
string _chatString = _InputText.text;
32-
if (string.IsNullOrEmpty(_chatString))
33-
return;
34-
35-
for(int i =0;i < testcnt;++i)
36-
{
37-
GameObject _chatClone = Instantiate(_PreChatItem);
38-
_chatClone.transform.SetParent(_ChatParent);
39-
40-
InlineText _chatText = _chatClone.GetComponentInChildren<InlineText>();
41-
if (_chatText != null)
42-
{
43-
_chatText.text = _chatString;
44-
}
45-
}
46-
47-
}
48-
#endregion
15+
public class ChatTest : MonoBehaviour
16+
{
17+
18+
[SerializeField]
19+
private GameObject _PreChatItem;
20+
[SerializeField]
21+
private RectTransform _ChatParent;
22+
[SerializeField]
23+
private RectTransform _ViewContent;
24+
[SerializeField]
25+
private InputField _InputText;
26+
27+
public int testcnt;
28+
29+
#region 点击发送
30+
public void OnClickSend()
31+
{
32+
string _chatString = _InputText.text;
33+
if (string.IsNullOrEmpty(_chatString))
34+
return;
35+
36+
for (int i = 0; i < testcnt; ++i)
37+
{
38+
GameObject _chatClone = Instantiate(_PreChatItem);
39+
_chatClone.transform.SetParent(_ChatParent);
40+
41+
InlineText _chatText = _chatClone.GetComponentInChildren<InlineText>();
42+
if (_chatText != null)
43+
{
44+
_chatText.text = _chatString;
45+
}
46+
}
47+
48+
}
49+
#endregion
4950
}
Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,39 @@
1-
/// ========================================================
2-
/// file:ClickTest.cs
3-
/// brief:
4-
/// author: coding2233
5-
/// date:
6-
/// version:v1.0
7-
/// ========================================================
8-
9-
using System.Collections;
10-
using System.Collections.Generic;
11-
using UnityEngine;
12-
using EmojiUI;
13-
14-
public class ClickTest : MonoBehaviour {
15-
16-
private InlineText _text;
17-
18-
void Awake()
19-
{
20-
_text = GetComponent<InlineText>();
21-
}
22-
23-
void OnEnable()
24-
{
25-
_text.OnHrefClick.AddListener(OnHrefClick);
26-
}
27-
28-
void OnDisable()
29-
{
30-
_text.OnHrefClick.RemoveListener(OnHrefClick);
31-
}
32-
33-
private void OnHrefClick(string hrefName,int id)
34-
{
35-
Debug.Log("点击了 " + hrefName+" id:"+id);
36-
// Application.OpenURL("www.baidu.com");
37-
}
38-
}
1+
/// ========================================================
2+
/// file:ClickTest.cs
3+
/// brief:
4+
/// author: coding2233
5+
/// date:
6+
/// version:v1.0
7+
/// ========================================================
8+
9+
using System.Collections;
10+
using System.Collections.Generic;
11+
using UnityEngine;
12+
using EmojiUI;
13+
14+
public class ClickTest : MonoBehaviour
15+
{
16+
17+
private InlineText _text;
18+
19+
void Awake()
20+
{
21+
_text = GetComponent<InlineText>();
22+
}
23+
24+
void OnEnable()
25+
{
26+
27+
}
28+
29+
void OnDisable()
30+
{
31+
32+
}
33+
34+
private void OnHrefClick(string hrefName, int id)
35+
{
36+
Debug.Log("点击了 " + hrefName + " id:" + id);
37+
// Application.OpenURL("www.baidu.com");
38+
}
39+
}

0 commit comments

Comments
 (0)