Skip to content

Commit e1b720b

Browse files
committed
feat: API_V2
1 parent 14e841d commit e1b720b

File tree

702 files changed

+148130
-0
lines changed

Some content is hidden

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

702 files changed

+148130
-0
lines changed

Demo/API_V2/.gitignore

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# This .gitignore file should be placed at the root of your Unity project directory
2+
#
3+
# Get latest from https://github.com/github/gitignore/blob/main/Unity.gitignore
4+
#
5+
/[Ll]ibrary/
6+
/[Tt]emp/
7+
/[Oo]bj/
8+
/[Bb]uild/
9+
/[Bb]uilds/
10+
/[Ll]ogs/
11+
/[Uu]ser[Ss]ettings/
12+
13+
# MemoryCaptures can get excessive in size.
14+
# They also could contain extremely sensitive data
15+
/[Mm]emoryCaptures/
16+
17+
# Recordings can get excessive in size
18+
/[Rr]ecordings/
19+
20+
# Uncomment this line if you wish to ignore the asset store tools plugin
21+
# /[Aa]ssets/AssetStoreTools*
22+
23+
# Autogenerated Jetbrains Rider plugin
24+
/[Aa]ssets/Plugins/Editor/JetBrains*
25+
26+
# Visual Studio cache directory
27+
.vs/
28+
29+
# Gradle cache directory
30+
.gradle/
31+
32+
# Autogenerated VS/MD/Consulo solution and project files
33+
ExportedObj/
34+
.consulo/
35+
*.csproj
36+
*.unityproj
37+
*.sln
38+
*.suo
39+
*.tmp
40+
*.user
41+
*.userprefs
42+
*.pidb
43+
*.booproj
44+
*.svd
45+
*.pdb
46+
*.mdb
47+
*.opendb
48+
*.VC.db
49+
50+
# Unity3D generated meta files
51+
*.pidb.meta
52+
*.pdb.meta
53+
*.mdb.meta
54+
55+
# Unity3D generated file on crash reports
56+
sysinfo.txt
57+
58+
# Builds
59+
*.apk
60+
*.aab
61+
*.unitypackage
62+
*.app
63+
64+
# Crashlytics generated file
65+
crashlytics-build.properties
66+
67+
# Packed Addressables
68+
/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*
69+
70+
# Temporary auto-generated Android Assets
71+
/[Aa]ssets/[Ss]treamingAssets/aa.meta
72+
/[Aa]ssets/[Ss]treamingAssets/aa/*
73+
74+
# macOS
75+
.DS_Store
76+
77+
# Dist
78+
/Dist/*
79+
/D:/*
80+
81+
# WXAssetsTools
82+
/TextToolDatas/*
83+
84+
# Idea
85+
.idea/

Demo/API_V2/Assets/API.meta

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Demo/API_V2/Assets/API/APISO.asset

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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: fee214ecdf43741c28f0d097c66bfecc, type: 3}
13+
m_Name: APISO
14+
m_EditorClassIdentifier:
15+
categoryList:
16+
- {fileID: 11400000, guid: 587fe4b03da9d44779ac921ffdb216a7, type: 2}
17+
- {fileID: 11400000, guid: 56f316e0e10ba419bbf19bd7a68bfc4c, type: 2}
18+
- {fileID: 11400000, guid: 6f0972f5fdc56c543b23c9873d760bf5, type: 2}
19+
- {fileID: 11400000, guid: 7ef06699cee7846b7823e4cc421418eb, type: 2}
20+
- {fileID: 11400000, guid: f2c56d751bb7c4c398db7c1db352517d, type: 2}
21+
- {fileID: 11400000, guid: 8c2a99491f3c0446097220cd580dfe38, type: 2}
22+
abilityList:
23+
- {fileID: 11400000, guid: 948907759756641618ba1b031955ec2b, type: 2}
24+
- {fileID: 11400000, guid: 14a1a853f10124ee2b276992e2d40448, type: 2}
25+
- {fileID: 11400000, guid: 1aa518b2f8ca04c6e81821bcb9a3cc49, type: 2}
26+
- {fileID: 11400000, guid: 27654a238f98e4f7e8756e4caed418e1, type: 2}

Demo/API_V2/Assets/API/APISO.asset.meta

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Demo/API_V2/Assets/API/Ad.meta

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Demo/API_V2/Assets/API/Ad/AdSO.asset

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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: 4a9e19ed69c041c408533b50f5572d0f, type: 3}
13+
m_Name: AdSO
14+
m_EditorClassIdentifier:
15+
categoryName: "\u5E7F\u544A"
16+
categorySprite: {fileID: 21300000, guid: 9865c656be3004b6f8d509f0134ccdda, type: 3}
17+
entryList:
18+
- {fileID: 11400000, guid: 46bca0e1609784a2f876ea58df90e8b8, type: 2}
19+
- {fileID: 11400000, guid: ab9ad3727f48045839570ecbda60c455, type: 2}
20+
- {fileID: 11400000, guid: 11f09745641b4493b99b3ee8bd3e5334, type: 2}
21+
- {fileID: 11400000, guid: eff9a9f0744fa4169b70f7439868e5cb, type: 2}

Demo/API_V2/Assets/API/Ad/AdSO.asset.meta

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Demo/API_V2/Assets/API/Ad/BannerAd.meta

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
using UnityEngine;
2+
using WeChatWASM;
3+
4+
public class BannerAd : Details
5+
{
6+
private WXBannerAd _bannerAd;
7+
8+
private bool _isShow = false;
9+
10+
private void Start()
11+
{
12+
// 绑定按钮事件
13+
GameManager.Instance.detailsController.BindExtraButtonAction(0, SwitchAdState);
14+
GameManager.Instance.detailsController.BindExtraButtonAction(1, DestroyAd);
15+
}
16+
17+
// 创建预设的 Banner 广告组件并挂载事件
18+
// 如需自定义style请调用WX.CreateBannerAd(WXCreateBannerAdParam param)接口
19+
protected override void TestAPI(string[] args)
20+
{
21+
// adUnitId 请填写自己的广告位 ID
22+
// 创建预设的 Banner 广告
23+
_bannerAd = WX.CreateFixedBottomMiddleBannerAd("adunit-xxxxxxxxxxxxxxxx", 30, 200);
24+
25+
_bannerAd.OnLoad((res) =>
26+
{
27+
WX.ShowModal(new ShowModalOption()
28+
{
29+
content = "BannerAd OnLoad Result:" + JsonUtility.ToJson(res)
30+
});
31+
});
32+
_bannerAd.OnError((res) =>
33+
{
34+
WX.ShowModal(new ShowModalOption()
35+
{
36+
content = "BannerAd onError Result:" + JsonUtility.ToJson(res)
37+
});
38+
});
39+
_bannerAd.OnResize((res) =>
40+
{
41+
WX.ShowModal(new ShowModalOption()
42+
{
43+
content = "BannerAd onResize Result:" + JsonUtility.ToJson(res)
44+
});
45+
});
46+
47+
WX.ShowToast(new ShowToastOption()
48+
{
49+
title = "已创建广告"
50+
});
51+
}
52+
53+
// 切换广告显示状态
54+
private void SwitchAdState()
55+
{
56+
if (_isShow)
57+
{
58+
// 隐藏广告
59+
_bannerAd.Hide();
60+
WX.ShowToast(new ShowToastOption()
61+
{
62+
title = "已隐藏广告"
63+
});
64+
}
65+
else
66+
{
67+
// 展示广告
68+
_bannerAd.Show();
69+
WX.ShowToast(new ShowToastOption()
70+
{
71+
title = "已展示广告"
72+
});
73+
}
74+
}
75+
76+
// 销毁广告
77+
private void DestroyAd()
78+
{
79+
_bannerAd.Destroy();
80+
WX.ShowToast(new ShowToastOption()
81+
{
82+
title = "已销毁广告"
83+
});
84+
}
85+
86+
private void OnDestroy()
87+
{
88+
_bannerAd.Destroy();
89+
}
90+
}

Demo/API_V2/Assets/API/Ad/BannerAd/BannerAd.cs.meta

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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: BannerAdSO
14+
m_EditorClassIdentifier:
15+
entryScriptTypeName: BannerAd
16+
entryName: "Banner\u5E7F\u544A"
17+
entryAPI: 'CreateBannerAd
18+
19+
BannerAd.Destroy/Hide/Show
20+
21+
BannerAd.OnError/Load/Resize'
22+
entryDescription: "\u6CE8\uFF1AadUnitId \u8BF7\u586B\u5199\u81EA\u5DF1\u7684\u5E7F\u544A\u4F4D
23+
ID\n\u6CE8\uFF1A\u793A\u4F8B\u8C03\u7528\u7684\u662F\u9884\u8BBE\u7684BannerAd\uFF0C\u5982\u9700\u81EA\u5B9A\u4E49style\u8BF7\u8C03\u7528WX.CreateBannerAd()\u63A5\u53E3"
24+
optionList: []
25+
initialButtonText: "\u521B\u5EFA\u5E7F\u544A"
26+
extraButtonList:
27+
- buttonText: "\u5207\u6362\u5E7F\u544A\u72B6\u6001"
28+
- buttonText: "\u9500\u6BC1\u5E7F\u544A"
29+
initialResultList: []

Demo/API_V2/Assets/API/Ad/BannerAd/BannerAdSO.asset.meta

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Demo/API_V2/Assets/API/Ad/CustomAd.meta

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)