77using UnityEngine ;
88
99/// <summary>
10- /// 渠道信息获取工具类
10+ /// 渠道信息获取工具类。
1111/// </summary>
1212/// <remarks>
13- /// 用于在Unity应用中获取当前运行平台的渠道信息。
13+ /// Utility class for retrieving channel information in Unity applications.
1414///
15- /// <para><b>Android 平台配置: </b></para>
16- /// 需要在主启动的 Activity 中添加以下 meta-data 标签:
15+ /// <para><b>Android Platform Configuration: </b></para>
16+ /// Add the following meta-data tag to the main launch Activity:
1717/// <code><![CDATA[
1818/// <meta-data android:name="channel" android:value="android_cn_taptap" />
1919/// ]]></code>
2020///
21- /// <para><b>iOS/tvOS/visionOS 平台配置: </b></para>
22- /// 需要在 Info.plist 中添加以下键值对( String 类型):
21+ /// <para><b>iOS/tvOS/visionOS Platform Configuration: </b></para>
22+ /// Add the following key-value pair ( String type) to Info.plist:
2323/// <code><![CDATA[
2424/// <key>channel</key>
2525/// <string>ios_cn_xxx</string>
2626/// ]]></code>
2727///
28- /// <para><b>Editor/PC/WebGL/UWP/主机平台配置: </b></para>
29- /// 在 Resources 文件夹下创建 application_config.txt 文件,格式如下:
28+ /// <para><b>Editor/PC/WebGL/UWP/Console Platform Configuration: </b></para>
29+ /// Create an application_config.txt file in the Resources folder with the following format:
3030/// <code><![CDATA[
3131/// channel=editor_cn_test
3232/// sub_channel=test
@@ -37,46 +37,53 @@ public sealed class BlankGetChannel
3737{
3838#if UNITY_IOS || UNITY_TVOS || UNITY_VISIONOS
3939 /// <summary>
40- /// iOS/tvOS/visionOS 平台原生方法:从 Info.plist 中获取渠道名称
40+ /// iOS/tvOS/visionOS 平台原生方法:从 Info.plist 中获取渠道名称。
4141 /// </summary>
42- /// <param name="channelKey">渠道键名,默认为 "channel"</param>
43- /// <returns>渠道名称</returns>
42+ /// <remarks>
43+ /// iOS/tvOS/visionOS platform native method: retrieves channel name from Info.plist.
44+ /// </remarks>
45+ /// <param name="channelKey">渠道键名,默认为 "channel" / Channel key name, defaults to "channel"</param>
46+ /// <returns>渠道名称 / Channel name</returns>
4447 [ DllImport ( "__Internal" ) ]
4548 private static extern string getChannelName ( string channelKey ) ;
4649
4750#endif
4851 /// <summary>
49- /// 渠道信息缓存字典,用于避免重复读取配置
52+ /// 渠道信息缓存字典,用于避免重复读取配置。
5053 /// </summary>
54+ /// <remarks>
55+ /// Channel information cache dictionary, used to avoid repeated configuration reads.
56+ /// </remarks>
5157 private static readonly Dictionary < string , string > ChannelCache = new Dictionary < string , string > ( 32 ) ;
5258
5359 /// <summary>
54- /// 获取指定渠道键对应的渠道名称
60+ /// 获取指定渠道键对应的渠道名称。
5561 /// </summary>
5662 /// <remarks>
57- /// 该方法会根据当前运行平台从相应的配置源读取渠道信息,并使用缓存避免重复读取。
63+ /// Retrieves the channel name for the specified channel key based on the current
64+ /// platform's configuration source, using cache to avoid repeated reads.
5865 /// <list type="table">
5966 /// <listheader>
60- /// <term>平台 </term>
61- /// <description>配置源 </description>
67+ /// <term>Platform </term>
68+ /// <description>Configuration Source </description>
6269 /// </listheader>
6370 /// <item>
6471 /// <term>Android</term>
65- /// <description>AndroidManifest.xml 中的 meta-data</description>
72+ /// <description>meta-data in AndroidManifest.xml </description>
6673 /// </item>
6774 /// <item>
6875 /// <term>iOS/tvOS/visionOS</term>
69- /// <description>Info.plist 中的键值对 </description>
76+ /// <description>Key-value pairs in Info.plist</description>
7077 /// </item>
7178 /// <item>
72- /// <term>Editor/PC/WebGL/UWP/主机平台 </term>
73- /// <description>Resources/application_config.txt 文件 </description>
74- /// </item>
75- /// </list>
79+ /// <term>Editor/PC/WebGL/UWP/Console </term>
80+ /// <description>Resources/application_config.txt file </description>
81+ /// </item>
82+ /// </list>
7683 /// </remarks>
77- /// <param name="channelKey">渠道键名,默认为 "channel"</param>
78- /// <param name="defaultValue">当未找到渠道配置时返回的默认值,默认为 "default"</param>
79- /// <returns>渠道名称,如果未配置则返回 <paramref name="defaultValue"/></returns>
84+ /// <param name="channelKey">渠道键名,默认为 "channel" / Channel key name, defaults to "channel" </param>
85+ /// <param name="defaultValue">当未找到渠道配置时返回的默认值,默认为 "default" / Default value returned when channel configuration is not found, defaults to "default" </param>
86+ /// <returns>渠道名称,如果未配置则返回 <paramref name="defaultValue"/> / Channel name, or <paramref name="defaultValue"/> if not configured </returns>
8087 /// <example>
8188 /// 以下示例展示如何获取渠道名称:
8289 /// <code><![CDATA[
0 commit comments