Skip to content

Commit 67d8388

Browse files
committed
添加npm run format指令自动格式化全部文件
1 parent 452daf0 commit 67d8388

File tree

665 files changed

+123100
-78031
lines changed

Some content is hidden

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

665 files changed

+123100
-78031
lines changed

Demo/API_V2/Assets/API/Ad/AdWithAudio/AdWithAudio.cs

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
using UnityEngine;
2-
using WeChatWASM;
3-
using UnityEngine.UI;
4-
using UnityEngine.Networking;
51
using System;
62
using System.Collections;
73
using System.Collections.Generic;
8-
4+
using UnityEngine;
95
using UnityEngine.Audio;
106
using UnityEngine.Networking;
7+
using UnityEngine.Networking;
8+
using UnityEngine.UI;
9+
using WeChatWASM;
1110

1211
public class AdWithAudio : Details
1312
{
14-
1513
private WXRewardedVideoAd _rewardedVideoAd;
1614
public AudioSource audioSource;
1715
public AudioClip audioClipCDN;
@@ -20,13 +18,14 @@ private void Start()
2018
{
2119
StartCoroutine(LoadCDNAudio());
2220

23-
2421
// 创建激励视频广告组件
25-
_rewardedVideoAd = WX.CreateRewardedVideoAd(new WXCreateRewardedVideoAdParam()
26-
{
27-
// adUnitId 请填写自己的广告位 ID
28-
adUnitId = "adunit-881d549c5a14a7e3"
29-
});
22+
_rewardedVideoAd = WX.CreateRewardedVideoAd(
23+
new WXCreateRewardedVideoAdParam()
24+
{
25+
// adUnitId 请填写自己的广告位 ID
26+
adUnitId = "adunit-881d549c5a14a7e3"
27+
}
28+
);
3029

3130
_rewardedVideoAd.OnError(err =>
3231
{
@@ -50,7 +49,8 @@ IEnumerator LoadCDNAudio()
5049
// 添加 AudioSource 组件
5150
audioSource = newGameObject.AddComponent<AudioSource>();
5251

53-
string uriString = "https://res.wx.qq.com/wechatgame/product/webpack/userupload/20220901/211827/CallMeTeenTop.mp3";
52+
string uriString =
53+
"https://res.wx.qq.com/wechatgame/product/webpack/userupload/20220901/211827/CallMeTeenTop.mp3";
5454
Uri uri = new Uri(uriString);
5555
UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(uri, AudioType.MPEG);
5656
yield return request.SendWebRequest();
@@ -79,26 +79,31 @@ public void PlayCDN()
7979
// 展示广告
8080
private void ShowAd()
8181
{
82-
_rewardedVideoAd.Show(res =>
83-
{
84-
Debug.Log("Show success");
85-
Debug.Log(JsonUtility.ToJson(res));
86-
}, err =>
87-
{
88-
Debug.Log(JsonUtility.ToJson(err));
89-
_rewardedVideoAd.Load(res =>
82+
_rewardedVideoAd.Show(
83+
res =>
9084
{
91-
Debug.Log("load success");
92-
_rewardedVideoAd.Show();
93-
}, err =>
85+
Debug.Log("Show success");
86+
Debug.Log(JsonUtility.ToJson(res));
87+
},
88+
err =>
9489
{
95-
Debug.Log("load fail");
9690
Debug.Log(JsonUtility.ToJson(err));
97-
});
98-
});
91+
_rewardedVideoAd.Load(
92+
res =>
93+
{
94+
Debug.Log("load success");
95+
_rewardedVideoAd.Show();
96+
},
97+
err =>
98+
{
99+
Debug.Log("load fail");
100+
Debug.Log(JsonUtility.ToJson(err));
101+
}
102+
);
103+
}
104+
);
99105
}
100106

101-
102107
public void Destroy()
103108
{
104109
if (audioSource != null)
@@ -107,4 +112,4 @@ public void Destroy()
107112
audioSource = null;
108113
}
109114
}
110-
}
115+
}

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

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -22,32 +22,41 @@ protected override void TestAPI(string[] args)
2222
// 创建预设的 Banner 广告
2323
_bannerAd = WX.CreateFixedBottomMiddleBannerAd("adunit-xxxxxxxxxxxxxxxx", 30, 200);
2424

25-
_bannerAd.OnLoad((res) =>
26-
{
27-
WX.ShowModal(new ShowModalOption()
25+
_bannerAd.OnLoad(
26+
(res) =>
2827
{
29-
content = "BannerAd OnLoad Result:" + JsonUtility.ToJson(res)
30-
});
31-
});
32-
_bannerAd.OnError((res) =>
33-
{
34-
WX.ShowModal(new ShowModalOption()
28+
WX.ShowModal(
29+
new ShowModalOption()
30+
{
31+
content = "BannerAd OnLoad Result:" + JsonUtility.ToJson(res)
32+
}
33+
);
34+
}
35+
);
36+
_bannerAd.OnError(
37+
(res) =>
3538
{
36-
content = "BannerAd onError Result:" + JsonUtility.ToJson(res)
37-
});
38-
});
39-
_bannerAd.OnResize((res) =>
40-
{
41-
WX.ShowModal(new ShowModalOption()
39+
WX.ShowModal(
40+
new ShowModalOption()
41+
{
42+
content = "BannerAd onError Result:" + JsonUtility.ToJson(res)
43+
}
44+
);
45+
}
46+
);
47+
_bannerAd.OnResize(
48+
(res) =>
4249
{
43-
content = "BannerAd onResize Result:" + JsonUtility.ToJson(res)
44-
});
45-
});
50+
WX.ShowModal(
51+
new ShowModalOption()
52+
{
53+
content = "BannerAd onResize Result:" + JsonUtility.ToJson(res)
54+
}
55+
);
56+
}
57+
);
4658

47-
WX.ShowToast(new ShowToastOption()
48-
{
49-
title = "已创建广告"
50-
});
59+
WX.ShowToast(new ShowToastOption() { title = "已创建广告" });
5160
}
5261

5362
// 切换广告显示状态
@@ -57,34 +66,25 @@ private void SwitchAdState()
5766
{
5867
// 隐藏广告
5968
_bannerAd.Hide();
60-
WX.ShowToast(new ShowToastOption()
61-
{
62-
title = "已隐藏广告"
63-
});
69+
WX.ShowToast(new ShowToastOption() { title = "已隐藏广告" });
6470
}
6571
else
6672
{
6773
// 展示广告
6874
_bannerAd.Show();
69-
WX.ShowToast(new ShowToastOption()
70-
{
71-
title = "已展示广告"
72-
});
75+
WX.ShowToast(new ShowToastOption() { title = "已展示广告" });
7376
}
7477
}
7578

7679
// 销毁广告
7780
private void DestroyAd()
7881
{
7982
_bannerAd.Destroy();
80-
WX.ShowToast(new ShowToastOption()
81-
{
82-
title = "已销毁广告"
83-
});
83+
WX.ShowToast(new ShowToastOption() { title = "已销毁广告" });
8484
}
8585

8686
private void OnDestroy()
8787
{
8888
_bannerAd.Destroy();
8989
}
90-
}
90+
}

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

Lines changed: 35 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -19,43 +19,44 @@ private void Start()
1919
protected override void TestAPI(string[] args)
2020
{
2121
// 创建原生模板广告组件
22-
_customAd = WX.CreateCustomAd(new WXCreateCustomAdParam()
23-
{
24-
// adUnitId 请填写自己的广告位 ID
25-
adUnitId = "adunit-xxxxxxxxxxxxxxxx",
26-
adIntervals = 30,
27-
style = {
28-
left = 0,
29-
top = 100,
30-
},
31-
});
32-
_customAd.OnLoad((res) =>
33-
{
34-
WX.ShowModal(new ShowModalOption()
22+
_customAd = WX.CreateCustomAd(
23+
new WXCreateCustomAdParam()
3524
{
36-
content = "CustomAd OnLoad Result:" + JsonUtility.ToJson(res)
37-
});
38-
});
39-
_customAd.OnError((res) =>
40-
{
41-
WX.ShowModal(new ShowModalOption()
25+
// adUnitId 请填写自己的广告位 ID
26+
adUnitId = "adunit-xxxxxxxxxxxxxxxx",
27+
adIntervals = 30,
28+
style = { left = 0, top = 100, },
29+
}
30+
);
31+
_customAd.OnLoad(
32+
(res) =>
4233
{
43-
content = "CustomAd onError Result:" + JsonUtility.ToJson(res)
44-
});
45-
});
34+
WX.ShowModal(
35+
new ShowModalOption()
36+
{
37+
content = "CustomAd OnLoad Result:" + JsonUtility.ToJson(res)
38+
}
39+
);
40+
}
41+
);
42+
_customAd.OnError(
43+
(res) =>
44+
{
45+
WX.ShowModal(
46+
new ShowModalOption()
47+
{
48+
content = "CustomAd onError Result:" + JsonUtility.ToJson(res)
49+
}
50+
);
51+
}
52+
);
4653
_customAd.OnHide(() =>
4754
{
48-
WX.ShowModal(new ShowModalOption()
49-
{
50-
content = "CustomAd onHide"
51-
});
55+
WX.ShowModal(new ShowModalOption() { content = "CustomAd onHide" });
5256
});
5357
_customAd.OnClose(() =>
5458
{
55-
WX.ShowModal(new ShowModalOption()
56-
{
57-
content = "CustomAd onClose"
58-
});
59+
WX.ShowModal(new ShowModalOption() { content = "CustomAd onClose" });
5960
});
6061
}
6162

@@ -66,34 +67,25 @@ private void SwitchAdState()
6667
{
6768
// 隐藏广告
6869
_customAd.Hide();
69-
WX.ShowToast(new ShowToastOption()
70-
{
71-
title = "已隐藏广告"
72-
});
70+
WX.ShowToast(new ShowToastOption() { title = "已隐藏广告" });
7371
}
7472
else
7573
{
7674
// 展示广告
7775
_customAd.Show();
78-
WX.ShowToast(new ShowToastOption()
79-
{
80-
title = "已展示广告"
81-
});
76+
WX.ShowToast(new ShowToastOption() { title = "已展示广告" });
8277
}
8378
}
8479

8580
// 销毁广告
8681
private void DestroyAd()
8782
{
8883
_customAd.Destroy();
89-
WX.ShowToast(new ShowToastOption()
90-
{
91-
title = "已销毁广告"
92-
});
84+
WX.ShowToast(new ShowToastOption() { title = "已销毁广告" });
9385
}
9486

9587
private void OnDestroy()
9688
{
9789
_customAd.Destroy();
9890
}
99-
}
91+
}

0 commit comments

Comments
 (0)