Skip to content

Commit 8b5c407

Browse files
committed
[增加] 是否是测试模式的接口
1 parent 6ba7466 commit 8b5c407

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Editor/Inspector/AdvertisementComponentInspector.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ internal sealed class AdvertisementComponentInspector : ComponentTypeComponentIn
2020
private SerializedProperty m_adUnitIdWebGL = null;
2121
private SerializedProperty m_adUnitIdWebGLWeChat = null;
2222
private SerializedProperty m_adUnitIdWebGLDouYin = null;
23+
private SerializedProperty m_debug = null;
24+
private GUIContent m_debugGUIContent = new GUIContent("是否是测试模式");
2325
private GUIContent m_adUnitIdAndroidGUIContent = new GUIContent("Android 广告位ID");
2426
private GUIContent m_adUnitIdiOSGUIContent = new GUIContent("IOS 广告位ID");
2527
private GUIContent m_adUnitIdWebGLGUIContent = new GUIContent("WebGL 广告位ID");
@@ -34,6 +36,7 @@ public override void OnInspectorGUI()
3436

3537
EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode & Application.isPlaying);
3638
{
39+
EditorGUILayout.PropertyField(m_debug, m_debugGUIContent);
3740
EditorGUILayout.PropertyField(m_adUnitIdAndroid, m_adUnitIdAndroidGUIContent);
3841
EditorGUILayout.PropertyField(m_adUnitIdiOS, m_adUnitIdiOSGUIContent);
3942
EditorGUILayout.PropertyField(m_adUnitIdWebGL, m_adUnitIdWebGLGUIContent);
@@ -59,6 +62,7 @@ protected override void Enable()
5962
m_adUnitIdWebGL = serializedObject.FindProperty("m_adUnitIdWebGL");
6063
m_adUnitIdWebGLWeChat = serializedObject.FindProperty("m_adUnitIdWebGLWeChat");
6164
m_adUnitIdWebGLDouYin = serializedObject.FindProperty("m_adUnitIdWebGLDouYin");
65+
m_debug = serializedObject.FindProperty("m_debug");
6266
}
6367
}
6468
}

Runtime/Advertisement/AdvertisementComponent.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ public class AdvertisementComponent : GameFrameworkComponent
3636
/// </summary>
3737
[SerializeField] private string m_adUnitIdWebGLDouYin = string.Empty;
3838

39+
/// <summary>
40+
/// 是否是测试模式
41+
/// </summary>
42+
[SerializeField] private bool m_debug = false;
43+
3944
/// <summary>
4045
/// 广告位ID
4146
/// </summary>
@@ -75,7 +80,7 @@ protected override void Awake()
7580

7681
private void Start()
7782
{
78-
_advertisementManager.Initialize(AdUnitId);
83+
_advertisementManager.Initialize(AdUnitId, m_debug);
7984
}
8085

8186
/// <summary>

0 commit comments

Comments
 (0)