fix:1、添加h5.2、修复bug
This commit is contained in:
@@ -1340,7 +1340,7 @@ namespace ChillConnect
|
||||
{
|
||||
if (RainPlayUI == null)
|
||||
{
|
||||
RainPlayUI = GameObject.Find("(RainPlayUI)sheep_play");
|
||||
RainPlayUI = GameObject.Find("(ArrowGameUI)com_arrow_game");
|
||||
}
|
||||
|
||||
if (RainPlayUI != null)
|
||||
@@ -1636,28 +1636,33 @@ namespace ChillConnect
|
||||
// return true; //zhushi
|
||||
return SaveData.GetSaveObject().ExchangeModeToggle == 1;
|
||||
}
|
||||
private static HashSet<string> generatedKeys = new HashSet<string>();
|
||||
public static string GenerateUniqueKey()
|
||||
// private static HashSet<string> generatedKeys = new HashSet<string>();
|
||||
public static string GenerateUniqueKey(Makeup vo, int index)
|
||||
{
|
||||
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
|
||||
string key;
|
||||
do
|
||||
// 处理数组为空的边界情况
|
||||
if (vo.T_Redeemcode == null || vo.T_Redeemcode.Length == 0)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.Append(GenerateRandomString(chars, 4));
|
||||
sb.Append("-");
|
||||
sb.Append(GenerateRandomString(chars, 6));
|
||||
sb.Append("-");
|
||||
sb.Append(GenerateRandomString(chars, 4));
|
||||
|
||||
key = sb.ToString();
|
||||
} while (generatedKeys.Contains(key)); // 如果重复就重新生成
|
||||
|
||||
generatedKeys.Add(key); // 添加到集合中
|
||||
return key;
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
// 如果 index 超出范围,取最后一个元素;否则直接返回对应索引的元素
|
||||
int validIndex = index >= 0 && index < vo.T_Redeemcode.Length ? index : vo.T_Redeemcode.Length - 1;
|
||||
return vo.T_Redeemcode[validIndex];
|
||||
}
|
||||
|
||||
public static string GenerateUniqueKey1(Makeup_2 vo, int index)
|
||||
{
|
||||
// 处理数组为空的边界情况
|
||||
if (vo.C_Redeemcode == null || vo.C_Redeemcode.Length == 0)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
// 如果 index 超出范围,取最后一个元素;否则直接返回对应索引的元素
|
||||
int validIndex = index >= 0 && index < vo.C_Redeemcode.Length ? index : vo.C_Redeemcode.Length - 1;
|
||||
return vo.C_Redeemcode[validIndex];
|
||||
}
|
||||
|
||||
static string GenerateRandomString(string charSet, int length)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
Reference in New Issue
Block a user