Skip to content

统一全部Demo引擎与插件版本, 更新api_v2 中的tcp和游戏圈demo展示 #812

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c9094f7
updated unity version for API_V2
kstjxy Jul 5, 2024
8528158
updated unity version for Addressable demo
kstjxy Jul 5, 2024
f658190
Updated unity version for Benchmark demo
kstjxy Jul 5, 2024
080dca4
Updated unity version for LaunchOpera
kstjxy Jul 5, 2024
776efdb
updated unity version for puerts demo
kstjxy Jul 5, 2024
8fe84c7
Updated unity version for ranking demo
kstjxy Jul 5, 2024
d37c85a
updated unity version for websocket demo
kstjxy Jul 5, 2024
210ca4a
updated unity version for wx_font demo
kstjxy Jul 8, 2024
68911d6
updated unity version for wx_video demo
kstjxy Jul 8, 2024
02ba93f
updated unity version for xlua_webgl demo
kstjxy Jul 8, 2024
1a31a38
fixed tolua plugin
kstjxy Jul 8, 2024
35b289f
imported package to addressable demo
kstjxy Jul 9, 2024
b0092ae
removed unused files
kstjxy Jul 9, 2024
85623bc
updated package for API_V2 demo
kstjxy Jul 9, 2024
94ce985
cleaned out unused files for benchmark demo
kstjxy Jul 9, 2024
31c1c15
updated package for launchOpera demo
kstjxy Jul 9, 2024
98e286c
add tcp demo
kstjxy Jul 11, 2024
f97b33b
Update TCPSocket.cs
kstjxy Jul 12, 2024
bfd6db9
finished tcp demo
kstjxy Jul 12, 2024
cd0a45f
add gameclub demo
kstjxy Jul 12, 2024
c2a167d
added getGameClubData demo
kstjxy Jul 15, 2024
9b9d421
Revert "Updated unity version for ranking demo"
kstjxy Jul 17, 2024
cd1f86a
Revert "Updated unity version for ranking demo" and updated new packa…
kstjxy Jul 17, 2024
3fc0363
fixed a minor bug in ranking demo
kstjxy Jul 17, 2024
2730889
updated package version for wx_font demo
kstjxy Jul 18, 2024
afe83eb
updated package for WX_Video demo
kstjxy Jul 18, 2024
7575427
updated package for websocket demo
kstjxy Jul 18, 2024
5046c88
merged gameclub related function into a collection
kstjxy Jul 19, 2024
3577380
updated unity version for slua demo
kstjxy Jul 19, 2024
9d1abb6
updated unity version for tolua demo
kstjxy Jul 19, 2024
9a4ff0e
Merge branch 'new_version_tolua'
kstjxy Jul 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion Demo/API_V2/Assets/API/APISO.asset
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ MonoBehaviour:
- {fileID: 11400000, guid: 9977a581037b84833a32b508e00eb1a2, type: 2}
- {fileID: 11400000, guid: 56f316e0e10ba419bbf19bd7a68bfc4c, type: 2}
- {fileID: 11400000, guid: 6f0972f5fdc56c543b23c9873d760bf5, type: 2}
- {fileID: 11400000, guid: a461b8cd70d9e4e23ad1cc953bec31e9, type: 2}
- {fileID: 11400000, guid: 7ef06699cee7846b7823e4cc421418eb, type: 2}
- {fileID: 11400000, guid: a461b8cd70d9e4e23ad1cc953bec31e9, type: 2}
- {fileID: 11400000, guid: 55de20d536f8c4689bbd80553d87fe46, type: 2}
- {fileID: 11400000, guid: f2c56d751bb7c4c398db7c1db352517d, type: 2}
- {fileID: 11400000, guid: b4a6196f623dd4435a4f3bd70af92d06, type: 2}
Expand Down
2 changes: 1 addition & 1 deletion Demo/API_V2/Assets/API/DataStorage/DataStorageSO.asset
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ MonoBehaviour:
m_Name: DataStorageSO
m_EditorClassIdentifier:
categoryName: "\u6570\u636E\u7F13\u5B58"
categorySprite: {fileID: 0}
categorySprite: {fileID: 21300000, guid: aedb8ebe6c4a14a13b23dc2e9ab42dcf, type: 3}
entryList:
- {fileID: 11400000, guid: a587889226c1f491fa6c783db1e12837, type: 2}
4 changes: 2 additions & 2 deletions Demo/API_V2/Assets/API/Facility/FacilitySO.asset
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ MonoBehaviour:
categoryName: "\u8BBE\u5907"
categorySprite: {fileID: 21300000, guid: fcbb6947b033746dabecaec0f84b0434, type: 3}
entryList:
- {fileID: 11400000, guid: bbbc9b983d6d34ad3bac2921509f612f, type: 2}
- {fileID: 11400000, guid: c17ae0ce755f04419b700825b20fd386, type: 2}
- {fileID: 11400000, guid: a24af43ae51914d26b0bf637c283dab2, type: 2}
- {fileID: 11400000, guid: 4eba2c9f2f2064e4081be74302ca4c33, type: 2}
- {fileID: 11400000, guid: bbbc9b983d6d34ad3bac2921509f612f, type: 2}
- {fileID: 11400000, guid: c17ae0ce755f04419b700825b20fd386, type: 2}
- {fileID: 11400000, guid: ac09abff5d8bc48bbabd08bde820b58b, type: 2}
- {fileID: 11400000, guid: 3bf339b994c544db3860ddf0a0dc8e20, type: 2}
- {fileID: 11400000, guid: e92d94924be504167a342e42e1162f21, type: 2}
Expand Down
2 changes: 1 addition & 1 deletion Demo/API_V2/Assets/API/FileSystem/FileSystemSO.asset
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ MonoBehaviour:
- {fileID: 11400000, guid: 65ab1b01a722b4542a14fcf9decca3de, type: 2}
- {fileID: 11400000, guid: 19b80cb144f0c4ea28a4ddca7a2c2f09, type: 2}
- {fileID: 11400000, guid: 0aa5d76237c844275add1612c47bddaa, type: 2}
- {fileID: 11400000, guid: 73c05fc1ffae94ec1b69a00ee261d529, type: 2}
- {fileID: 11400000, guid: 65a826f5f949544d8990e673231bb80f, type: 2}
- {fileID: 11400000, guid: 73c05fc1ffae94ec1b69a00ee261d529, type: 2}
- {fileID: 11400000, guid: 3a901e80b59ad4aafbe373ee6a8df2d8, type: 2}
- {fileID: 11400000, guid: e7ea0be62dc6543b0a8dc629489c5e7e, type: 2}
2 changes: 1 addition & 1 deletion Demo/API_V2/Assets/API/GUI/GUISO.asset
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ MonoBehaviour:
m_Name: GUISO
m_EditorClassIdentifier:
categoryName: "\u754C\u9762"
categorySprite: {fileID: 0}
categorySprite: {fileID: 21300000, guid: bd5165d5d0b9b4f55b39dce7f4638c81, type: 3}
entryList:
- {fileID: 11400000, guid: 546628e39e8c246c38eebcdfbfd35b47, type: 2}
- {fileID: 11400000, guid: 6902bd974e09745c4a185485a99c165d, type: 2}
Expand Down
4 changes: 2 additions & 2 deletions Demo/API_V2/Assets/API/Network/NetworkSO.asset
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4a9e19ed69c041c408533b50f5572d0f, type: 3}
m_Name: NetworkSO
m_EditorClassIdentifier:
categoryName: "\u4E0B\u8F7D"
categorySprite: {fileID: 0}
categoryName: "\u7F51\u7EDC"
categorySprite: {fileID: 21300000, guid: bb0b97758d57042a296e1ecd925f8088, type: 3}
entryList:
- {fileID: 11400000, guid: 8fb54c5918d454eea90d5147f2c316ea, type: 2}
- {fileID: 11400000, guid: 1e0539509d074443f92d17035efbe40f, type: 2}
Expand Down
114 changes: 92 additions & 22 deletions Demo/API_V2/Assets/API/Network/TCPSocket/TCPSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,114 @@
public class TCPSocket : Details
{
private WXTCPSocket _tcpSocket;
private bool _connected = false;

// 数据
private string _stringData1 = "String Data";
private string _stringData2 = "123\n";


private byte[] _bufferData1 = { 66, 117, 102, 102, 101, 114, 32, 68, 97, 116, 97, 32 };
private byte[] _bufferData2 = { 0xab, 0x05, 0xd7, 0x05 };
private byte[] _bufferData3 = new byte[8];

private void Start() {
GameManager.Instance.detailsController.BindExtraButtonAction(0, connect);
GameManager.Instance.detailsController.BindExtraButtonAction(1, close);
GameManager.Instance.detailsController.BindExtraButtonAction(0, connect);
GameManager.Instance.detailsController.BindExtraButtonAction(1, write);
GameManager.Instance.detailsController.BindExtraButtonAction(2, writeBuffer);
GameManager.Instance.detailsController.BindExtraButtonAction(3, close);
}

// 测试 API
protected override void TestAPI(string[] args)
{
_tcpSocket = WX.CreateTCPSocket();
Debug.Log("tcpSocket: " + JsonUtility.ToJson(_tcpSocket));
if(_tcpSocket == null)
{
_tcpSocket = WX.CreateTCPSocket();
Debug.Log("tcpSocket: " + JsonUtility.ToJson(_tcpSocket));

_tcpSocket.OnConnect((res) => {
Debug.Log("onConnect: " + JsonUtility.ToJson(res));
});
_tcpSocket.OnMessage((res) => {
Debug.Log("onMessage: " + JsonUtility.ToJson(res));
});

_tcpSocket.OnError((res) => {
Debug.Log("onError: " + JsonUtility.ToJson(res));
});
_tcpSocket.OnConnect((res) => {
Debug.Log("onConnect: " + JsonUtility.ToJson(res));
});

_tcpSocket.OnClose((res) => {
Debug.Log("onClose: " + JsonUtility.ToJson(res));
});
_tcpSocket.OnError((res) => {
Debug.Log("onError: " + JsonUtility.ToJson(res));
});

_tcpSocket.OnMessage((res) => {
Debug.Log("onMessage: " + JsonUtility.ToJson(res));
});
_tcpSocket.OnClose((res) => {
Debug.Log("onClose: " + JsonUtility.ToJson(res));
});
} else
{
Debug.Log("tcp实例已初始化");
}

}

private void close()
{
if(_tcpSocket != null && _connected)
{
Debug.Log("close test start");
_tcpSocket.Close();
_connected = false;
} else
{
Debug.Log("关闭失败:tcp实例未初始化或未连接");
}

}


private void connect() {
_tcpSocket.Connect(new TCPSocketConnectOption() {
address = "192.168.193.2",
port = 8848
});
if (_tcpSocket != null && !_connected) {
Debug.Log("connect test start");
_tcpSocket.Connect(new TCPSocketConnectOption()
{
address = "www.oooceanworld.com",
port = 8101
});
_connected = true;
} else
{
Debug.Log("连接失败:tcp实例未初始化或已连接");
}
}

private void write() {
if (_tcpSocket != null && _connected)
{
Debug.Log("write string test start:");
Debug.Log("test 1: " + _stringData1);
_tcpSocket.Write(_stringData1);
Debug.Log("test 2: " + _stringData2);
_tcpSocket.Write(_stringData2);
} else
{
Debug.Log("发送失败:tcp实例未初始化或未连接");
}

}

private void close() {
_tcpSocket.Close();
private void writeBuffer() {
if (_tcpSocket != null && _connected)
{
Debug.Log("write buffer test start:");
Debug.Log("test 1: " + _bufferData1);
_tcpSocket.Write(_bufferData1);
Debug.Log("test 2: " + _bufferData2);
_tcpSocket.Write(_bufferData2);
Debug.Log("test 3: " + _bufferData3);
_tcpSocket.Write(_bufferData3);
}
else
{
Debug.Log("发送失败:tcp实例未初始化或未连接");
}
}
}

2 changes: 2 additions & 0 deletions Demo/API_V2/Assets/API/Network/TCPSocket/TCPSocketSO.asset
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@ MonoBehaviour:
initialButtonText: "\u521B\u5EFAtcp\u5B9E\u4F8B"
extraButtonList:
- buttonText: "\u8FDE\u63A5"
- buttonText: "\u53D1\u9001String"
- buttonText: "\u53D1\u9001Buffer"
- buttonText: "\u5173\u95ED"
initialResultList: []

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions Demo/API_V2/Assets/API/OpenInterface/GameClub/GameClub SO.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fb48e4613a53bb941a20036d7c08fefb, type: 3}
m_Name: GameClub SO
m_EditorClassIdentifier:
entryScriptTypeName: GameClub
entryName: "\u6E38\u620F\u5708"
entryAPI: "getGameClubData\uFF0C createGameClubButton"
entryDescription:
optionList: []
initialButtonText: "\u83B7\u53D6\u6E38\u620F\u5708\u6570\u636E"
extraButtonList:
- buttonText: "\u8FDB\u5165\u6E38\u620F\u5708"
initialResultList: []

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

121 changes: 121 additions & 0 deletions Demo/API_V2/Assets/API/OpenInterface/GameClub/GameClub.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using LitJson;
using WeChatWASM;
using System.Threading;

public class GameClub : Details
{
private int[] _data = { 1, 3, 4 };

private WXGameClubButton _gameClubButton;

// Start is called before the first frame update
private void Start()
{
var result = WX.GetLaunchOptionsSync();
Debug.Log(JsonUtility.ToJson(result));

StartCoroutine(CreateGameClubButton(1.0f));

GameManager.Instance.detailsController.BindExtraButtonAction(0, GameClubButtonSwitch);
}

IEnumerator CreateGameClubButton(float delay)
{
yield return new WaitForSeconds(delay);

Vector2 size = GameManager.Instance.detailsController.GetInitialButtonSize();
Vector2 position = GameManager.Instance.detailsController.GetButtonPosition(0);
var systemInfo = WX.GetSystemInfoSync();
_gameClubButton = WX.CreateGameClubButton(new WXCreateGameClubButtonParam()
{
type = GameClubButtonType.text,
style = new GameClubButtonStyle()
{
left = Math.Abs((int)(position.x / systemInfo.pixelRatio)),
top = Math.Abs((int)(position.y / systemInfo.pixelRatio)),
width = (int)(size.x * systemInfo.screenWidth / 1080f),
height = (int)(size.y * systemInfo.screenWidth / 1080f),
}
});
}

// ���� API
protected override void TestAPI(string[] args)
{
getGameClubData();
}

private void getGameClubData()
{
GetGameClubDataOption option = new GetGameClubDataOption();

option.dataTypeList = new DataType[_data.Length];

for (int i = 0; i < _data.Length; i++)
{
option.dataTypeList[i] = new DataType();
option.dataTypeList[i].type = _data[i];
}

option.fail = (res) =>
{
Debug.Log("GetGameClubData fail: " + res.errMsg);
};

option.complete = (res) =>
{
Debug.Log("GetGameClubData complete: " + JsonUtility.ToJson(res));
};

option.success = (res) =>
{
Debug.Log("GetGameClubData success: " + JsonUtility.ToJson(res));
Debug.Log("encryptedData:" + res.encryptedData);
};

WX.GetGameClubData(option);
}

private bool _isGameClubShow = false;

// �л���ϷȦ��ť��ʾ/����
private void GameClubButtonSwitch()
{
//if (_isGameClubShow)
//{
// // ��ʾ��ϷȦ��ť
// _gameClubButton.Show();
// GameManager.Instance.detailsController.ChangeExtraButtonText(0, "������ϷȦ��ť");
//}
//else
//{
// // ������ϷȦ��ť
// _gameClubButton.Hide();
// GameManager.Instance.detailsController.ChangeExtraButtonText(0, "��ʾ��ϷȦ��ť");
//}
//_isGameClubShow = !_isGameClubShow;
}

private void GameClubButtonDestroy()
{
Debug.Log("gameclub destroy");
_gameClubButton.Destroy();
}

public void Destroy()
{
if (_gameClubButton != null)
{
_gameClubButton.Hide();
GameClubButtonDestroy();
_gameClubButton = null;
}
}

}


Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Demo/API_V2/Assets/API/OpenInterface/OpenInterfaceSO.asset
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ MonoBehaviour:
m_Name: OpenInterfaceSO
m_EditorClassIdentifier:
categoryName: "\u5F00\u653E\u63A5\u53E3"
categorySprite: {fileID: 0}
categorySprite: {fileID: 21300000, guid: 655a4cabb9e794434b9c028267c63e10, type: 3}
entryList:
- {fileID: 11400000, guid: d0c8de90644082f418ae2ec91900bd8f, type: 2}
- {fileID: 11400000, guid: 8a4f679875fb6413b9b0df39d1359e57, type: 2}
- {fileID: 11400000, guid: 2957939a29ac24a2e9ca1d4f6ccdb41e, type: 2}
- {fileID: 11400000, guid: 2c8c997508e96423fa1031b948386d44, type: 2}
Expand Down
Loading