Skip to content

Commit ae5bcaf

Browse files
committed
实时语音/登录/隐私/渲染-demo
1 parent b5a962f commit ae5bcaf

22 files changed

+2317
-95
lines changed

Demo/API_V2/Assets/API/APISO.asset

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,21 @@ MonoBehaviour:
1414
m_EditorClassIdentifier:
1515
categoryList:
1616
- {fileID: 11400000, guid: 587fe4b03da9d44779ac921ffdb216a7, type: 2}
17+
- {fileID: 11400000, guid: 82450cc74b3b4439da53b9f0f2298454, type: 2}
18+
- {fileID: 11400000, guid: b34629c67a7664a428561dd0b3621995, type: 2}
19+
- {fileID: 11400000, guid: 9977a581037b84833a32b508e00eb1a2, type: 2}
20+
- {fileID: 11400000, guid: 6f6fdc677ed96437eb1fa0e7e272b6d8, type: 2}
1721
- {fileID: 11400000, guid: 56f316e0e10ba419bbf19bd7a68bfc4c, type: 2}
1822
- {fileID: 11400000, guid: 6f0972f5fdc56c543b23c9873d760bf5, type: 2}
23+
- {fileID: 11400000, guid: a461b8cd70d9e4e23ad1cc953bec31e9, type: 2}
1924
- {fileID: 11400000, guid: 7ef06699cee7846b7823e4cc421418eb, type: 2}
25+
- {fileID: 11400000, guid: 55de20d536f8c4689bbd80553d87fe46, type: 2}
2026
- {fileID: 11400000, guid: f2c56d751bb7c4c398db7c1db352517d, type: 2}
2127
- {fileID: 11400000, guid: 8c2a99491f3c0446097220cd580dfe38, type: 2}
28+
- {fileID: 11400000, guid: 59792dcce94fc48f6ab5654a02c78c6d, type: 2}
29+
- {fileID: 11400000, guid: b363337bfb49b490e81fbfac3612f793, type: 2}
30+
- {fileID: 11400000, guid: 2bf0b496956fe4d89af32d301c33d9a6, type: 2}
31+
- {fileID: 11400000, guid: 96c20c2f2bb504877a24cb359162c323, type: 2}
2232
abilityList:
2333
- {fileID: 11400000, guid: 948907759756641618ba1b031955ec2b, type: 2}
2434
- {fileID: 11400000, guid: 14a1a853f10124ee2b276992e2d40448, type: 2}

Demo/API_V2/Assets/API/Media/MediaSO.asset

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ MonoBehaviour:
1919
- {fileID: 11400000, guid: 1055cfc5cdda7407298fa2ff9997d0c6, type: 2}
2020
- {fileID: 11400000, guid: ad04526c3748b4e2b8498f998dfea973, type: 2}
2121
- {fileID: 11400000, guid: 38b7b2300105146ce94a785a915252de, type: 2}
22+
- {fileID: 11400000, guid: 04a7c5dbfc2464252841043ba677dcab, type: 2}

Demo/API_V2/Assets/API/Media/VoipManager.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using LitJson;
4+
using UnityEngine;
5+
using WeChatWASM;
6+
7+
public class VoipManager : Details
8+
{
9+
private void Start()
10+
{
11+
GameManager.Instance.detailsController.BindExtraButtonAction(0, ExitVoIPChat);
12+
}
13+
14+
// 测试 API
15+
protected override void TestAPI(string[] args)
16+
{
17+
JoinVoIPChat();
18+
}
19+
20+
public void JoinVoIPChat()
21+
{
22+
WX.JoinVoIPChat(new JoinVoIPChatOption()
23+
{
24+
signature = "xxxxxxxx",
25+
nonceStr = "xxxxxxx",
26+
timeStamp = 111111,
27+
groupId = "xxxxxxxx",
28+
success = (res) =>
29+
{
30+
Debug.Log("JoinVoIPChat success");
31+
Debug.Log(JsonUtility.ToJson(res));
32+
},
33+
fail = (res) =>
34+
{
35+
Debug.Log("JoinVoIPChat fail");
36+
Debug.Log(JsonUtility.ToJson(res));
37+
},
38+
complete = (res) =>
39+
{
40+
Debug.Log("JoinVoIPChat complete");
41+
Debug.Log(JsonUtility.ToJson(res));
42+
},
43+
});
44+
45+
WX.OnVoIPChatInterrupted((res) =>
46+
{
47+
Debug.Log("OnVoIPChatInterrupted");
48+
Debug.Log(JsonUtility.ToJson(res));
49+
});
50+
51+
WX.OnVoIPChatMembersChanged((res) =>
52+
{
53+
Debug.Log("OnVoIPChatMembersChanged");
54+
Debug.Log(JsonUtility.ToJson(res));
55+
});
56+
57+
WX.OnVoIPChatSpeakersChanged((res) =>
58+
{
59+
Debug.Log("OnVoIPChatSpeakersChanged");
60+
Debug.Log(JsonUtility.ToJson(res));
61+
});
62+
63+
WX.OnVoIPChatStateChanged((res) =>
64+
{
65+
Debug.Log("OnVoIPChatStateChanged");
66+
Debug.Log(JsonUtility.ToJson(res));
67+
});
68+
}
69+
70+
public void ExitVoIPChat()
71+
{
72+
WX.ExitVoIPChat(new ExitVoIPChatOption()
73+
{
74+
success = (res) =>
75+
{
76+
Debug.Log("ExitVoIPChat success");
77+
Debug.Log(JsonUtility.ToJson(res));
78+
},
79+
fail = (res) =>
80+
{
81+
Debug.Log("ExitVoIPChat fail");
82+
Debug.Log(JsonUtility.ToJson(res));
83+
},
84+
complete = (res) =>
85+
{
86+
Debug.Log("ExitVoIPChat complete");
87+
Debug.Log(JsonUtility.ToJson(res));
88+
},
89+
});
90+
}
91+
}

Demo/API_V2/Assets/API/Media/VoipManager/VoipManager.cs.meta

Lines changed: 11 additions & 0 deletions
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: VoipManagerSO
14+
m_EditorClassIdentifier:
15+
entryScriptTypeName: VoipManager
16+
entryName: "\u5B9E\u65F6\u8BED\u97F3"
17+
entryAPI: "\u5B9E\u65F6\u8BED\u97F3\u76F8\u5173api"
18+
entryDescription:
19+
optionList: []
20+
initialButtonText: "\u52A0\u5165 (\u521B\u5EFA) \u5B9E\u65F6\u8BED\u97F3\u901A\u8BDD"
21+
extraButtonList:
22+
- buttonText: "\u9000\u51FA\uFF08\u9500\u6BC1\uFF09\u5B9E\u65F6\u8BED\u97F3\u901A\u8BDD"
23+
initialResultList: []

Demo/API_V2/Assets/API/Media/VoipManager/VoipManagerSO.asset.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Demo/API_V2/Assets/API/OpenInterface/OpenData.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using LitJson;
4+
using UnityEngine;
5+
using WeChatWASM;
6+
public class OpenData : Details
7+
{
8+
private void Start()
9+
{
10+
11+
GameManager.Instance.detailsController.BindExtraButtonAction(0, checkSession);
12+
GameManager.Instance.detailsController.BindExtraButtonAction(1, authorize);
13+
GameManager.Instance.detailsController.BindExtraButtonAction(2, getGroupEnterInfo);
14+
GameManager.Instance.detailsController.BindExtraButtonAction(3, requirePrivacyAuthorize);
15+
GameManager.Instance.detailsController.BindExtraButtonAction(4, openPrivacyContract);
16+
GameManager.Instance.detailsController.BindExtraButtonAction(5, getPrivacySetting);
17+
}
18+
19+
// 测试 API
20+
protected override void TestAPI(string[] args)
21+
{
22+
login();
23+
}
24+
25+
public void login() {
26+
WX.Login(new LoginOption
27+
{
28+
timeout = 2000,
29+
success = (res) => {
30+
WX.ShowModal(new ShowModalOption
31+
{
32+
content = JsonMapper.ToJson(res)
33+
});
34+
},
35+
fail = (res) => {
36+
Debug.Log("fail : " + res.errMsg);
37+
},
38+
complete = (res) => {
39+
Debug.Log("complete");
40+
}
41+
});
42+
}
43+
44+
public void checkSession() {
45+
WX.CheckSession(new CheckSessionOption
46+
{
47+
success = (res) => {
48+
Debug.Log("success");
49+
},
50+
fail = (res) => {
51+
Debug.Log("fail : " + res.errMsg);
52+
},
53+
complete = (res) => {
54+
Debug.Log("complete");
55+
}
56+
});
57+
}
58+
59+
public void authorize() {
60+
WX.Authorize(new AuthorizeOption
61+
{
62+
scope = "scope.writePhotosAlbum",
63+
success = (res) => {
64+
Debug.Log("success");
65+
},
66+
fail = (res) => {
67+
Debug.Log("fail : " + res.errMsg);
68+
},
69+
complete = (res) => {
70+
Debug.Log("complete");
71+
}
72+
});
73+
}
74+
75+
public void getGroupEnterInfo() {
76+
WX.GetGroupEnterInfo(new GetGroupEnterInfoOption
77+
{
78+
success = (res) => {
79+
WX.ShowModal(new ShowModalOption
80+
{
81+
content = JsonMapper.ToJson(res)
82+
});
83+
},
84+
fail = (res) => {
85+
Debug.Log("fail : " + res.errMsg);
86+
},
87+
complete = (res) => {
88+
Debug.Log("complete");
89+
}
90+
});
91+
}
92+
93+
public void requirePrivacyAuthorize() {
94+
WX.RequirePrivacyAuthorize(new RequirePrivacyAuthorizeOption
95+
{
96+
success = (res) => {
97+
Debug.Log("success");
98+
},
99+
fail = (res) => {
100+
Debug.Log("fail : " + res.errMsg);
101+
},
102+
complete = (res) => {
103+
Debug.Log("complete");
104+
}
105+
});
106+
}
107+
108+
public void openPrivacyContract() {
109+
WX.OpenPrivacyContract(new OpenPrivacyContractOption
110+
{
111+
success = (res) => {
112+
Debug.Log("success");
113+
},
114+
fail = (res) => {
115+
Debug.Log("fail : " + res.errMsg);
116+
},
117+
complete = (res) => {
118+
Debug.Log("complete");
119+
}
120+
});
121+
}
122+
123+
public void getPrivacySetting() {
124+
WX.GetPrivacySetting(new GetPrivacySettingOption
125+
{
126+
success = (res) => {
127+
Debug.Log("success " + JsonMapper.ToJson(res));
128+
},
129+
fail = (res) => {
130+
Debug.Log("fail : " + res.errMsg);
131+
},
132+
complete = (res) => {
133+
Debug.Log("complete");
134+
}
135+
});
136+
}
137+
}

Demo/API_V2/Assets/API/OpenInterface/OpenData/OpenData.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)