Merge branch 'main' of http://shu.sheziwanglo.cn:3000/wulongxiao/_xiaofang
This commit is contained in:
commit
38bbe2ff4e
@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
|
||||
@ -8,7 +10,7 @@ public class ZZZPlayer : MonoBehaviour
|
||||
|
||||
public static ZZZPlayer CSZS;
|
||||
public JSONReader jSONReader;
|
||||
public Dictionary<int, string> CSB1 = new Dictionary<int, string>(); //Key是判断是不是一组,string是ID tanchuang1用的
|
||||
public Dictionary<int, List<string>> CSB1 = new Dictionary<int,List<string>>(); //Key是判断是不是一组,string是ID tanchuang1用的
|
||||
public bool isYou=true;
|
||||
|
||||
public void Start()
|
||||
@ -101,59 +103,81 @@ public class ZZZPlayer : MonoBehaviour
|
||||
/// <returns>是否存在</returns>
|
||||
public void FindPlayerTaskID(int number,string Type)
|
||||
{
|
||||
foreach (var item in jSONReader.ZZSelectsDictionary)
|
||||
foreach (var item in jSONReader.ZZSelectsDictionary)
|
||||
{
|
||||
Select data = item.Value;
|
||||
if (data.AppliedUI == "tanchuang1")
|
||||
{
|
||||
var a = GetNumberBeforeComma(data.Group);
|
||||
Debug.Log("bbbb");
|
||||
//先用Grop分组
|
||||
|
||||
// 检查并初始化键
|
||||
if (!CSB1.ContainsKey(a))
|
||||
{
|
||||
CSB1.Add(a, data.ID);// 更新值
|
||||
CSB1[a] = new List<string>(); // 初始化键对应的列表
|
||||
}
|
||||
|
||||
// 添加值到键对应的列表
|
||||
CSB1[a].Add(data.ID);
|
||||
}
|
||||
}
|
||||
TwoFind(number);
|
||||
|
||||
// 执行后续对比逻辑
|
||||
CompareValues(number);
|
||||
}
|
||||
public void TwoFind(int number)
|
||||
/// <summary>
|
||||
/// 第二次筛选
|
||||
/// </summary>
|
||||
private void CompareValues(int number)
|
||||
{
|
||||
//再一次来判断
|
||||
if (isYou)
|
||||
{
|
||||
Debug.Log("进来了脸脸了了了了了了脸脸了脸脸了了了脸脸了了");
|
||||
Debug.Log(CSB1.Count);
|
||||
foreach (KeyValuePair<int, string> kvp in CSB1)
|
||||
{
|
||||
Debug.Log("进不来了");
|
||||
int key = kvp.Key;
|
||||
string value = kvp.Value;
|
||||
// 获取所有 Key
|
||||
List<int> allKeys = GetAllKeys(CSB1);
|
||||
Debug.Log("所有的 Key: " + string.Join(", ", allKeys));
|
||||
|
||||
// 将字符串拆分为 List<string>
|
||||
List<string> values = new List<string>(value.Split(','));
|
||||
// 获取所有 Value
|
||||
List<string> allValues = GetAllValues(CSB1);
|
||||
Debug.Log("所有的 Values: " + string.Join(", ", allValues));
|
||||
//foreach (var kvp in CSB1)
|
||||
//{
|
||||
// int key = kvp.Key;
|
||||
// string value = kvp.Value;
|
||||
|
||||
// // 分割 Value 字符串为多个部分
|
||||
// List<string> valueList = new List<string>(value.Split(','));
|
||||
|
||||
// Debug.Log($"Key {key} 包含的值:{string.Join(", ", valueList)}");
|
||||
|
||||
// // 遍历分割后的值并逐个传递
|
||||
// foreach (string item in valueList)
|
||||
// {
|
||||
// Debug.Log(key+"_"+item);
|
||||
// }
|
||||
//}
|
||||
|
||||
// 对值列表进行对比
|
||||
for (int i = 0; i < values.Count; i++)
|
||||
{
|
||||
Debug.Log("进不来了11111");
|
||||
for (int j = i + 1; j < values.Count; j++)
|
||||
{
|
||||
Debug.Log("进不来了22222");
|
||||
isYou = IsNumberInData(values[j], number);
|
||||
if (isYou)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isYou)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#region 测试
|
||||
/// <summary>
|
||||
/// 获取所有 Key
|
||||
/// </summary>
|
||||
private List<int> GetAllKeys(Dictionary<int, List<string>> dictionary)
|
||||
{
|
||||
return new List<int>(dictionary.Keys);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取所有 Value
|
||||
/// </summary>
|
||||
private List<string> GetAllValues(Dictionary<int, List<string>> dictionary)
|
||||
{
|
||||
List<string> allValues = new List<string>();
|
||||
|
||||
foreach (var values in dictionary.Values)
|
||||
{
|
||||
allValues.AddRange(values); // 合并所有值
|
||||
}
|
||||
|
||||
return allValues;
|
||||
}
|
||||
#endregion
|
||||
public bool IsNumberInData(string data, int number)
|
||||
{
|
||||
|
||||
@ -196,7 +220,6 @@ public class ZZZPlayer : MonoBehaviour
|
||||
/// <returns>逗号前的数字,如果解析失败返回 -1</returns>
|
||||
public int GetNumberBeforeComma(string data)
|
||||
{
|
||||
Debug.Log("aaaa");
|
||||
if (string.IsNullOrEmpty(data))
|
||||
{
|
||||
Debug.LogWarning("输入为空或 null!");
|
||||
|
Loading…
Reference in New Issue
Block a user