This commit is contained in:
2020-08-17 11:13:33 +08:00
parent 19e730574b
commit 21eb68aeab
93 changed files with 6713 additions and 143 deletions

View File

@@ -3,6 +3,7 @@ using System.Collections;
//using System;
using System.Collections.Generic;
//using System.Net;
using NPinyin;
using System.Text;
using System.Net.Sockets;
using System.Net.NetworkInformation;
@@ -32,7 +33,7 @@ namespace Coolape
startActivity(intent);
这种方式的特点就是直接拨打了你所输入的号码所以这种方式对于用户没有直接的提示效果Android推荐使用第一种方式如果是第二种的话建议在之前加一个提示是否拨打号码然后确定后再拨打。
*/
/*
/// </summary>
/// <param name="phoneNum">Phone number.</param>
public static void callPhone (string phoneNum)
@@ -41,7 +42,7 @@ namespace Coolape
Debug.LogWarning ("phoneNum is null");
return;
}
#if UNITY_ANDROID && !UNITY_EDITOR
#if UNITY_ANDROID && !UNITY_EDITOR
try {
AndroidJavaClass Intent = new AndroidJavaClass("android.content.Intent");
string actionCall = Intent.GetStatic<string>("ACTION_CALL");
@@ -54,8 +55,10 @@ namespace Coolape
} catch (System.Exception e) {
Debug.LogError(e);
}
#endif
}
#else
Application.OpenURL("tel:" + phoneNum);
#endif
}
/// <summary>
/// Gets the phone number. 取得本机号码
@@ -78,7 +81,7 @@ namespace Coolape
#endif
}
*/
/// <summary>
/// Identities the code valid.身份证号验证
/// </summary>
@@ -200,15 +203,19 @@ namespace Coolape
public static string GetChineseSpell(string strText)
{
int len = strText.Length;
string myStr = "";
for (int i = 0; i < len; i++)
{
myStr += getSpell(strText.Substring(i, 1));
}
return myStr;
return Pinyin.GetInitials(strText);
//int len = strText.Length;
//string myStr = "";
//for (int i = 0; i < len; i++)
//{
// myStr += getSpell(strText.Substring(i, 1));
//}
//return myStr;
}
public static string GetPinyin(string strText)
{
return Pinyin.GetPinyin(strText);
}
/// <summary>
/// 得到一个汉字的拼音第一个字母,如果是一个英文字母则直接返回大写字母
@@ -339,6 +346,7 @@ namespace Coolape
int area = (short)arrCN[0];
int pos = (short)arrCN[1];
int code = (area << 8) + pos;
int[] areacode = {45217, 45253, 45761, 46318, 46826, 47010, 47297, 47614, 48119, 48119, 49062, 49324, 49896, 50371, 50614, 50622,
50906, 51387, 51446, 52218, 52698, 52698, 52698, 52980, 53689, 54481