Skip to content

Commit 848c743

Browse files
authored
Merge pull request #812 from kstjxy/main
统一全部Demo引擎与插件版本, 更新api_v2 中的tcp和游戏圈demo展示
2 parents 62eee4f + 9a4ff0e commit 848c743

File tree

3,972 files changed

+1948
-779487
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,972 files changed

+1948
-779487
lines changed

Demo/API_V2/Assets/API/APISO.asset

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ MonoBehaviour:
1919
- {fileID: 11400000, guid: 9977a581037b84833a32b508e00eb1a2, type: 2}
2020
- {fileID: 11400000, guid: 56f316e0e10ba419bbf19bd7a68bfc4c, type: 2}
2121
- {fileID: 11400000, guid: 6f0972f5fdc56c543b23c9873d760bf5, type: 2}
22-
- {fileID: 11400000, guid: a461b8cd70d9e4e23ad1cc953bec31e9, type: 2}
2322
- {fileID: 11400000, guid: 7ef06699cee7846b7823e4cc421418eb, type: 2}
23+
- {fileID: 11400000, guid: a461b8cd70d9e4e23ad1cc953bec31e9, type: 2}
2424
- {fileID: 11400000, guid: 55de20d536f8c4689bbd80553d87fe46, type: 2}
2525
- {fileID: 11400000, guid: f2c56d751bb7c4c398db7c1db352517d, type: 2}
2626
- {fileID: 11400000, guid: b4a6196f623dd4435a4f3bd70af92d06, type: 2}

Demo/API_V2/Assets/API/DataStorage/DataStorageSO.asset

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ MonoBehaviour:
1313
m_Name: DataStorageSO
1414
m_EditorClassIdentifier:
1515
categoryName: "\u6570\u636E\u7F13\u5B58"
16-
categorySprite: {fileID: 0}
16+
categorySprite: {fileID: 21300000, guid: aedb8ebe6c4a14a13b23dc2e9ab42dcf, type: 3}
1717
entryList:
1818
- {fileID: 11400000, guid: a587889226c1f491fa6c783db1e12837, type: 2}

Demo/API_V2/Assets/API/Facility/FacilitySO.asset

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ MonoBehaviour:
1515
categoryName: "\u8BBE\u5907"
1616
categorySprite: {fileID: 21300000, guid: fcbb6947b033746dabecaec0f84b0434, type: 3}
1717
entryList:
18-
- {fileID: 11400000, guid: bbbc9b983d6d34ad3bac2921509f612f, type: 2}
19-
- {fileID: 11400000, guid: c17ae0ce755f04419b700825b20fd386, type: 2}
2018
- {fileID: 11400000, guid: a24af43ae51914d26b0bf637c283dab2, type: 2}
2119
- {fileID: 11400000, guid: 4eba2c9f2f2064e4081be74302ca4c33, type: 2}
20+
- {fileID: 11400000, guid: bbbc9b983d6d34ad3bac2921509f612f, type: 2}
21+
- {fileID: 11400000, guid: c17ae0ce755f04419b700825b20fd386, type: 2}
2222
- {fileID: 11400000, guid: ac09abff5d8bc48bbabd08bde820b58b, type: 2}
2323
- {fileID: 11400000, guid: 3bf339b994c544db3860ddf0a0dc8e20, type: 2}
2424
- {fileID: 11400000, guid: e92d94924be504167a342e42e1162f21, type: 2}

Demo/API_V2/Assets/API/FileSystem/FileSystemSO.asset

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ MonoBehaviour:
2424
- {fileID: 11400000, guid: 65ab1b01a722b4542a14fcf9decca3de, type: 2}
2525
- {fileID: 11400000, guid: 19b80cb144f0c4ea28a4ddca7a2c2f09, type: 2}
2626
- {fileID: 11400000, guid: 0aa5d76237c844275add1612c47bddaa, type: 2}
27-
- {fileID: 11400000, guid: 73c05fc1ffae94ec1b69a00ee261d529, type: 2}
2827
- {fileID: 11400000, guid: 65a826f5f949544d8990e673231bb80f, type: 2}
28+
- {fileID: 11400000, guid: 73c05fc1ffae94ec1b69a00ee261d529, type: 2}
2929
- {fileID: 11400000, guid: 3a901e80b59ad4aafbe373ee6a8df2d8, type: 2}
3030
- {fileID: 11400000, guid: e7ea0be62dc6543b0a8dc629489c5e7e, type: 2}

Demo/API_V2/Assets/API/GUI/GUISO.asset

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ MonoBehaviour:
1313
m_Name: GUISO
1414
m_EditorClassIdentifier:
1515
categoryName: "\u754C\u9762"
16-
categorySprite: {fileID: 0}
16+
categorySprite: {fileID: 21300000, guid: bd5165d5d0b9b4f55b39dce7f4638c81, type: 3}
1717
entryList:
1818
- {fileID: 11400000, guid: 546628e39e8c246c38eebcdfbfd35b47, type: 2}
1919
- {fileID: 11400000, guid: 6902bd974e09745c4a185485a99c165d, type: 2}

Demo/API_V2/Assets/API/Network/NetworkSO.asset

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ MonoBehaviour:
1212
m_Script: {fileID: 11500000, guid: 4a9e19ed69c041c408533b50f5572d0f, type: 3}
1313
m_Name: NetworkSO
1414
m_EditorClassIdentifier:
15-
categoryName: "\u4E0B\u8F7D"
16-
categorySprite: {fileID: 0}
15+
categoryName: "\u7F51\u7EDC"
16+
categorySprite: {fileID: 21300000, guid: bb0b97758d57042a296e1ecd925f8088, type: 3}
1717
entryList:
1818
- {fileID: 11400000, guid: 8fb54c5918d454eea90d5147f2c316ea, type: 2}
1919
- {fileID: 11400000, guid: 1e0539509d074443f92d17035efbe40f, type: 2}

Demo/API_V2/Assets/API/Network/TCPSocket/TCPSocket.cs

Lines changed: 92 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,44 +6,114 @@
66
public class TCPSocket : Details
77
{
88
private WXTCPSocket _tcpSocket;
9+
private bool _connected = false;
10+
11+
// 数据
12+
private string _stringData1 = "String Data";
13+
private string _stringData2 = "123\n";
14+
15+
16+
private byte[] _bufferData1 = { 66, 117, 102, 102, 101, 114, 32, 68, 97, 116, 97, 32 };
17+
private byte[] _bufferData2 = { 0xab, 0x05, 0xd7, 0x05 };
18+
private byte[] _bufferData3 = new byte[8];
919

1020
private void Start() {
11-
GameManager.Instance.detailsController.BindExtraButtonAction(0, connect);
12-
GameManager.Instance.detailsController.BindExtraButtonAction(1, close);
21+
GameManager.Instance.detailsController.BindExtraButtonAction(0, connect);
22+
GameManager.Instance.detailsController.BindExtraButtonAction(1, write);
23+
GameManager.Instance.detailsController.BindExtraButtonAction(2, writeBuffer);
24+
GameManager.Instance.detailsController.BindExtraButtonAction(3, close);
1325
}
1426

1527
// 测试 API
1628
protected override void TestAPI(string[] args)
1729
{
18-
_tcpSocket = WX.CreateTCPSocket();
19-
Debug.Log("tcpSocket: " + JsonUtility.ToJson(_tcpSocket));
30+
if(_tcpSocket == null)
31+
{
32+
_tcpSocket = WX.CreateTCPSocket();
33+
Debug.Log("tcpSocket: " + JsonUtility.ToJson(_tcpSocket));
2034

21-
_tcpSocket.OnConnect((res) => {
22-
Debug.Log("onConnect: " + JsonUtility.ToJson(res));
23-
});
35+
_tcpSocket.OnMessage((res) => {
36+
Debug.Log("onMessage: " + JsonUtility.ToJson(res));
37+
});
2438

25-
_tcpSocket.OnError((res) => {
26-
Debug.Log("onError: " + JsonUtility.ToJson(res));
27-
});
39+
_tcpSocket.OnConnect((res) => {
40+
Debug.Log("onConnect: " + JsonUtility.ToJson(res));
41+
});
2842

29-
_tcpSocket.OnClose((res) => {
30-
Debug.Log("onClose: " + JsonUtility.ToJson(res));
31-
});
43+
_tcpSocket.OnError((res) => {
44+
Debug.Log("onError: " + JsonUtility.ToJson(res));
45+
});
3246

33-
_tcpSocket.OnMessage((res) => {
34-
Debug.Log("onMessage: " + JsonUtility.ToJson(res));
35-
});
47+
_tcpSocket.OnClose((res) => {
48+
Debug.Log("onClose: " + JsonUtility.ToJson(res));
49+
});
50+
} else
51+
{
52+
Debug.Log("tcp实例已初始化");
53+
}
54+
3655
}
3756

57+
private void close()
58+
{
59+
if(_tcpSocket != null && _connected)
60+
{
61+
Debug.Log("close test start");
62+
_tcpSocket.Close();
63+
_connected = false;
64+
} else
65+
{
66+
Debug.Log("关闭失败:tcp实例未初始化或未连接");
67+
}
68+
69+
}
70+
71+
3872
private void connect() {
39-
_tcpSocket.Connect(new TCPSocketConnectOption() {
40-
address = "192.168.193.2",
41-
port = 8848
42-
});
73+
if (_tcpSocket != null && !_connected) {
74+
Debug.Log("connect test start");
75+
_tcpSocket.Connect(new TCPSocketConnectOption()
76+
{
77+
address = "www.oooceanworld.com",
78+
port = 8101
79+
});
80+
_connected = true;
81+
} else
82+
{
83+
Debug.Log("连接失败:tcp实例未初始化或已连接");
84+
}
85+
}
86+
87+
private void write() {
88+
if (_tcpSocket != null && _connected)
89+
{
90+
Debug.Log("write string test start:");
91+
Debug.Log("test 1: " + _stringData1);
92+
_tcpSocket.Write(_stringData1);
93+
Debug.Log("test 2: " + _stringData2);
94+
_tcpSocket.Write(_stringData2);
95+
} else
96+
{
97+
Debug.Log("发送失败:tcp实例未初始化或未连接");
98+
}
99+
43100
}
44101

45-
private void close() {
46-
_tcpSocket.Close();
102+
private void writeBuffer() {
103+
if (_tcpSocket != null && _connected)
104+
{
105+
Debug.Log("write buffer test start:");
106+
Debug.Log("test 1: " + _bufferData1);
107+
_tcpSocket.Write(_bufferData1);
108+
Debug.Log("test 2: " + _bufferData2);
109+
_tcpSocket.Write(_bufferData2);
110+
Debug.Log("test 3: " + _bufferData3);
111+
_tcpSocket.Write(_bufferData3);
112+
}
113+
else
114+
{
115+
Debug.Log("发送失败:tcp实例未初始化或未连接");
116+
}
47117
}
48118
}
49119

Demo/API_V2/Assets/API/Network/TCPSocket/TCPSocketSO.asset

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,7 @@ MonoBehaviour:
2020
initialButtonText: "\u521B\u5EFAtcp\u5B9E\u4F8B"
2121
extraButtonList:
2222
- buttonText: "\u8FDE\u63A5"
23+
- buttonText: "\u53D1\u9001String"
24+
- buttonText: "\u53D1\u9001Buffer"
2325
- buttonText: "\u5173\u95ED"
2426
initialResultList: []

Demo/API_V2/Assets/Plugins/Editor.meta renamed to Demo/API_V2/Assets/API/OpenInterface/GameClub.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!114 &11400000
4+
MonoBehaviour:
5+
m_ObjectHideFlags: 0
6+
m_CorrespondingSourceObject: {fileID: 0}
7+
m_PrefabInstance: {fileID: 0}
8+
m_PrefabAsset: {fileID: 0}
9+
m_GameObject: {fileID: 0}
10+
m_Enabled: 1
11+
m_EditorHideFlags: 0
12+
m_Script: {fileID: 11500000, guid: fb48e4613a53bb941a20036d7c08fefb, type: 3}
13+
m_Name: GameClub SO
14+
m_EditorClassIdentifier:
15+
entryScriptTypeName: GameClub
16+
entryName: "\u6E38\u620F\u5708"
17+
entryAPI: "getGameClubData\uFF0C createGameClubButton"
18+
entryDescription:
19+
optionList: []
20+
initialButtonText: "\u83B7\u53D6\u6E38\u620F\u5708\u6570\u636E"
21+
extraButtonList:
22+
- buttonText: "\u8FDB\u5165\u6E38\u620F\u5708"
23+
initialResultList: []

0 commit comments

Comments
 (0)