Skip to content

Commit 072b3ae

Browse files
committed
test dotnet format in progress
1 parent c202b06 commit 072b3ae

File tree

112 files changed

+2002
-3452
lines changed

Some content is hidden

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

112 files changed

+2002
-3452
lines changed

.editorconfig

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Remove the line below if you want to inherit .editorconfig settings from higher directories
2+
root = true
3+
4+
#### Core EditorConfig Options ####
5+
6+
[*]
7+
# Indentation and spacing: https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties
8+
indent_style = space
9+
indent_size = 4
10+
end_of_line = crlf
11+
charset = utf-8
12+
trim_trailing_whitespace = false
13+
insert_final_newline = false
14+
15+
# C# files
16+
[*.cs]
17+
# C# formatting options: https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/csharp-formatting-options
18+
csharp_new_line_before_open_brace = none
19+
csharp_new_line_before_else = false
20+
csharp_new_line_before_catch = false
21+
csharp_new_line_before_finally = false
22+
csharp_new_line_before_members_in_object_initializers = true
23+
csharp_new_line_before_members_in_anonymous_types = true
24+
csharp_new_line_between_query_expression_clauses = true
25+
26+
#### .NET Coding Conventions ####
27+
28+
# this. and Me. preferences
29+
dotnet_style_qualification_for_method = true
30+
31+
#### Diagnostic configuration ####
32+
33+
# CA1000: Do not declare static members on generic types
34+
dotnet_diagnostic.CA1000.severity = warning

Demo/API_V2/.editorconfig

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Remove the line below if you want to inherit .editorconfig settings from higher directories
2+
root = true
3+
4+
#### Core EditorConfig Options ####
5+
6+
[*]
7+
# Indentation and spacing: https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties
8+
indent_style = space
9+
indent_size = 4
10+
end_of_line = crlf
11+
charset = utf-8
12+
trim_trailing_whitespace = false
13+
insert_final_newline = false
14+
15+
# C# files
16+
[*.cs]
17+
# C# formatting options: https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/csharp-formatting-options
18+
csharp_new_line_before_open_brace = none
19+
csharp_new_line_before_else = false
20+
csharp_new_line_before_catch = false
21+
csharp_new_line_before_finally = false
22+
csharp_new_line_before_members_in_object_initializers = true
23+
csharp_new_line_before_members_in_anonymous_types = true
24+
csharp_new_line_between_query_expression_clauses = true
25+
26+
#### .NET Coding Conventions ####
27+
28+
# this. and Me. preferences
29+
dotnet_style_qualification_for_method = true
30+
31+
#### Diagnostic configuration ####
32+
33+
# CA1000: Do not declare static members on generic types
34+
dotnet_diagnostic.CA1000.severity = warning

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

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,40 +9,35 @@
99
using UnityEngine.Audio;
1010
using UnityEngine.Networking;
1111

12-
public class AdWithAudio : Details
13-
{
12+
public class AdWithAudio : Details {
1413

1514
private WXRewardedVideoAd _rewardedVideoAd;
1615
public AudioSource audioSource;
1716
public AudioClip audioClipCDN;
18-
19-
private void Start()
20-
{
17+
18+
private void Start() {
2119
StartCoroutine(LoadCDNAudio());
2220

23-
21+
2422
// 创建激励视频广告组件
25-
_rewardedVideoAd = WX.CreateRewardedVideoAd(new WXCreateRewardedVideoAdParam()
26-
{
23+
_rewardedVideoAd = WX.CreateRewardedVideoAd(new WXCreateRewardedVideoAdParam() {
2724
// adUnitId 请填写自己的广告位 ID
2825
adUnitId = "adunit-881d549c5a14a7e3"
2926
});
30-
27+
3128
_rewardedVideoAd.OnError(err => {
3229
Debug.Log(JsonUtility.ToJson(err));
3330
});
34-
31+
3532
GameManager.Instance.detailsController.BindExtraButtonAction(0, PlayCDN);
3633
}
3734

3835
// 创建激励视频广告组件并挂载事件、预加载广告
39-
protected override void TestAPI(string[] args)
40-
{
36+
protected override void TestAPI(string[] args) {
4137
ShowAd();
4238
}
4339

44-
IEnumerator LoadCDNAudio()
45-
{
40+
IEnumerator LoadCDNAudio() {
4641
// 创建一个新的游戏对象
4742
GameObject newGameObject = new GameObject("New GameObject");
4843

@@ -53,31 +48,25 @@ IEnumerator LoadCDNAudio()
5348
Uri uri = new Uri(uriString);
5449
UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(uri, AudioType.MPEG);
5550
yield return request.SendWebRequest();
56-
if (request.result == UnityWebRequest.Result.Success)
57-
{
51+
if (request.result == UnityWebRequest.Result.Success) {
5852
audioClipCDN = DownloadHandlerAudioClip.GetContent(request);
5953
// yield return new WaitUntil(() => audioClipCDN.loadState == AudioDataLoadState.Loaded);
6054
// Debug.Log("audioClipCDN loaded, clip length: " + audioClipCDN.length);
61-
}
62-
else
63-
{
55+
} else {
6456
Debug.Log("request error: " + request.error);
6557
}
6658
}
6759

68-
public void PlayCDN()
69-
{
70-
if (audioClipCDN != null)
71-
{
60+
public void PlayCDN() {
61+
if (audioClipCDN != null) {
7262
audioSource.clip = audioClipCDN;
7363
audioSource.loop = true;
7464
audioSource.Play();
7565
}
7666
}
7767

7868
// 展示广告
79-
private void ShowAd()
80-
{
69+
private void ShowAd() {
8170
_rewardedVideoAd.Show(res => {
8271
Debug.Log("Show success");
8372
Debug.Log(JsonUtility.ToJson(res));
@@ -92,13 +81,12 @@ private void ShowAd()
9281
});
9382
});
9483
}
95-
9684

97-
public void Destroy()
98-
{
85+
86+
public void Destroy() {
9987
if (audioSource != null) {
10088
audioSource.clip = null;
10189
audioSource = null;
10290
}
10391
}
104-
}
92+
}
Lines changed: 24 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,71 @@
1-
using UnityEngine;
1+
using UnityEngine;
22
using WeChatWASM;
33

4-
public class BannerAd : Details
5-
{
4+
public class BannerAd : Details {
65
private WXBannerAd _bannerAd;
7-
6+
87
private bool _isShow = false;
9-
10-
private void Start()
11-
{
8+
9+
private void Start() {
1210
// 绑定按钮事件
1311
GameManager.Instance.detailsController.BindExtraButtonAction(0, SwitchAdState);
1412
GameManager.Instance.detailsController.BindExtraButtonAction(1, DestroyAd);
1513
}
1614

1715
// 创建预设的 Banner 广告组件并挂载事件
1816
// 如需自定义style请调用WX.CreateBannerAd(WXCreateBannerAdParam param)接口
19-
protected override void TestAPI(string[] args)
20-
{
17+
protected override void TestAPI(string[] args) {
2118
// adUnitId 请填写自己的广告位 ID
2219
// 创建预设的 Banner 广告
2320
_bannerAd = WX.CreateFixedBottomMiddleBannerAd("adunit-xxxxxxxxxxxxxxxx", 30, 200);
24-
25-
_bannerAd.OnLoad((res) =>
26-
{
27-
WX.ShowModal(new ShowModalOption()
28-
{
21+
22+
_bannerAd.OnLoad((res) => {
23+
WX.ShowModal(new ShowModalOption() {
2924
content = "BannerAd OnLoad Result:" + JsonUtility.ToJson(res)
3025
});
3126
});
32-
_bannerAd.OnError((res) =>
33-
{
34-
WX.ShowModal(new ShowModalOption()
35-
{
27+
_bannerAd.OnError((res) => {
28+
WX.ShowModal(new ShowModalOption() {
3629
content = "BannerAd onError Result:" + JsonUtility.ToJson(res)
3730
});
3831
});
39-
_bannerAd.OnResize((res) =>
40-
{
41-
WX.ShowModal(new ShowModalOption()
42-
{
32+
_bannerAd.OnResize((res) => {
33+
WX.ShowModal(new ShowModalOption() {
4334
content = "BannerAd onResize Result:" + JsonUtility.ToJson(res)
4435
});
4536
});
46-
47-
WX.ShowToast(new ShowToastOption()
48-
{
37+
38+
WX.ShowToast(new ShowToastOption() {
4939
title = "已创建广告"
5040
});
5141
}
5242

5343
// 切换广告显示状态
54-
private void SwitchAdState()
55-
{
56-
if (_isShow)
57-
{
44+
private void SwitchAdState() {
45+
if (_isShow) {
5846
// 隐藏广告
5947
_bannerAd.Hide();
60-
WX.ShowToast(new ShowToastOption()
61-
{
48+
WX.ShowToast(new ShowToastOption() {
6249
title = "已隐藏广告"
6350
});
64-
}
65-
else
66-
{
51+
} else {
6752
// 展示广告
6853
_bannerAd.Show();
69-
WX.ShowToast(new ShowToastOption()
70-
{
54+
WX.ShowToast(new ShowToastOption() {
7155
title = "已展示广告"
7256
});
7357
}
7458
}
7559

7660
// 销毁广告
77-
private void DestroyAd()
78-
{
61+
private void DestroyAd() {
7962
_bannerAd.Destroy();
80-
WX.ShowToast(new ShowToastOption()
81-
{
63+
WX.ShowToast(new ShowToastOption() {
8264
title = "已销毁广告"
8365
});
8466
}
8567

86-
private void OnDestroy()
87-
{
68+
private void OnDestroy() {
8869
_bannerAd.Destroy();
8970
}
90-
}
71+
}

0 commit comments

Comments
 (0)