2024-12-28 14:06:45 +08:00
using System ;
2024-12-27 12:01:08 +08:00
using System.Collections ;
using System.Collections.Generic ;
2024-12-28 14:06:45 +08:00
using System.Xml ;
2024-12-27 23:36:33 +08:00
using Unity.VisualScripting ;
2024-12-27 12:01:08 +08:00
using UnityEngine ;
2024-12-27 21:10:27 +08:00
public class ZZZPlayer : MonoBehaviour
2024-12-27 12:01:08 +08:00
{
2024-12-27 21:10:27 +08:00
public static ZZZPlayer CSZS ;
public JSONReader jSONReader ;
2024-12-28 14:06:45 +08:00
public Dictionary < int , List < string > > CSB1 = new Dictionary < int , List < string > > ( ) ; //Key<65> <79> <EFBFBD> ж<EFBFBD> <D0B6> Dz<EFBFBD> <C7B2> <EFBFBD> һ <EFBFBD> 飬string<6E> <67> ID tanchuang1<67> õ<EFBFBD>
2024-12-27 23:36:33 +08:00
public bool isYou = true ;
2024-12-27 21:10:27 +08:00
public void Start ( )
{
2024-12-27 23:36:33 +08:00
// SetPlayerID("11007");
FindPlayerTaskID ( 10810 , "tanchuang1" ) ;
2024-12-27 21:10:27 +08:00
////<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> ֵ<EFBFBD>
//foreach (KeyValuePair<string, List<string>> kvp in PlayerID)
//{
// Debug.Log($"ְҵ: {kvp.Key}");
// // <20> <> <EFBFBD> <EFBFBD> ֵ<EFBFBD> <D6B5> List<string><3E> <>
// foreach (string task in kvp.Value)
// {
// Debug.Log($"<22> <> <EFBFBD> <EFBFBD> : {task}");
// }
//}
}
2024-12-27 12:01:08 +08:00
public Dictionary < string , List < string > > PlayerID = new Dictionary < string , List < string > > ( )
{
2024-12-27 17:45:19 +08:00
{ "8000" , new List < string > ( ) } ,
{ "8001" , new List < string > ( ) } ,
{ "8002" , new List < string > ( ) } ,
{ "8003" , new List < string > ( ) } ,
{ "8004" , new List < string > ( ) } ,
{ "8005" , new List < string > ( ) } ,
{ "8006" , new List < string > ( ) } ,
{ "8007" , new List < string > ( ) } ,
{ "8008" , new List < string > ( ) } ,
{ "8009" , new List < string > ( ) } ,
{ "8010" , new List < string > ( ) } ,
{ "8011" , new List < string > ( ) }
2024-12-27 12:01:08 +08:00
} ;
private void Awake ( )
{
CSZS = this ;
}
/// <summary>
/// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ҽ <EFBFBD> <D2BD> ܵ<EFBFBD> <DCB5> <EFBFBD> <EFBFBD> <EFBFBD>
/// </summary>
2024-12-27 17:45:19 +08:00
public void SetPlayerID ( string TaskID )
2024-12-27 12:01:08 +08:00
{
2024-12-27 17:45:19 +08:00
var a = ParseString ( jSONReader . GetOcpID ( int . Parse ( TaskID ) ) ) ;
for ( int i = 0 ; i < a . Count ; i + + )
2024-12-27 12:01:08 +08:00
{
2024-12-27 17:45:19 +08:00
PlayerID [ a [ i ] ] . Add ( TaskID ) ;
2024-12-27 12:01:08 +08:00
}
}
/// <summary>
/// <20> <> <EFBFBD> <EFBFBD> һ <EFBFBD> <D2BB> ְҵ<D6B0> <D2B5> ȡ<EFBFBD> <C8A1> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
/// </summary>
public List < string > GetPlayerID ( string ID )
{
if ( PlayerID . TryGetValue ( ID , out List < string > value ) )
{
return value ; // <20> <> <EFBFBD> ض<EFBFBD> Ӧ<EFBFBD> <D3A6> List<string>
}
else
{
Debug . Log ( "<22> <> <EFBFBD> <EFBFBD> <EFBFBD> Ҳ<EFBFBD> <D2B2> <EFBFBD> " ) ;
return new List < string > ( ) ; // <20> <> <EFBFBD> ؿ<EFBFBD> <D8BF> б <EFBFBD>
}
}
2024-12-27 17:45:19 +08:00
/// <summary>
2024-12-27 23:36:33 +08:00
/// <20> ж<EFBFBD> <D0B6> <EFBFBD> Щ<EFBFBD> <D0A9> ɫ<EFBFBD> <C9AB> <EFBFBD> Խ<EFBFBD> ȡ<EFBFBD> <C8A1> <EFBFBD> <EFBFBD>
2024-12-27 17:45:19 +08:00
/// </summary>
/// <param name="input"><3E> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ַ<EFBFBD> <D6B7> <EFBFBD> </param>
/// <returns><3E> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> List<73> <74> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ϊ<EFBFBD> <CEAA> <EFBFBD> ؿ<F2B7B5BB> <D8BF> б <EFBFBD> </returns>
public static List < string > ParseString ( string input )
{
// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ϊ<EFBFBD> ջ<EFBFBD> null<6C> <6C> <EFBFBD> <EFBFBD> <EFBFBD> ؿ<EFBFBD> <D8BF> б <EFBFBD>
if ( string . IsNullOrEmpty ( input ) )
{
return new List < string > ( ) ;
}
// <20> <> "|" <20> ָ<EFBFBD> <D6B8> ַ<EFBFBD> <D6B7> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ؽ<EFBFBD> <D8BD> <EFBFBD> <EFBFBD> б <EFBFBD>
return new List < string > ( input . Split ( '|' ) ) ;
}
2024-12-27 21:10:27 +08:00
/// <summary>
2024-12-27 23:36:33 +08:00
/// <20> ж<EFBFBD> <D0B6> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ƿ<EFBFBD> <C7B7> <EFBFBD> ȡ<EFBFBD> <C8A1> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> (<28> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> bool)
2024-12-27 21:10:27 +08:00
/// </summary>
2024-12-27 23:36:33 +08:00
/// <param number="number">Ҫ<> <D2AA> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> </param>
/// <param Type="Type"><3E> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> </param>
2024-12-27 21:10:27 +08:00
/// <returns><3E> Ƿ<EFBFBD> <C7B7> <EFBFBD> <EFBFBD> <EFBFBD> </returns>
2024-12-27 23:36:33 +08:00
public void FindPlayerTaskID ( int number , string Type )
{
2024-12-28 14:06:45 +08:00
foreach ( var item in jSONReader . ZZSelectsDictionary )
2024-12-27 23:36:33 +08:00
{
Select data = item . Value ;
if ( data . AppliedUI = = "tanchuang1" )
{
var a = GetNumberBeforeComma ( data . Group ) ;
2024-12-28 14:06:45 +08:00
// <20> <> <EFBFBD> 鲢<EFBFBD> <E9B2A2> ʼ <EFBFBD> <CABC> <EFBFBD> <EFBFBD>
2024-12-27 23:36:33 +08:00
if ( ! CSB1 . ContainsKey ( a ) )
{
2024-12-28 14:06:45 +08:00
CSB1 [ a ] = new List < string > ( ) ; // <20> <> ʼ <EFBFBD> <CABC> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ӧ<EFBFBD> <D3A6> <EFBFBD> б <EFBFBD>
2024-12-27 23:36:33 +08:00
}
2024-12-28 14:06:45 +08:00
// <20> <> <EFBFBD> <EFBFBD> ֵ<EFBFBD> <D6B5> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ӧ<EFBFBD> <D3A6> <EFBFBD> б <EFBFBD>
CSB1 [ a ] . Add ( data . ID ) ;
2024-12-27 23:36:33 +08:00
}
}
2024-12-28 14:06:45 +08:00
// ִ<> к<EFBFBD> <D0BA> <EFBFBD> <EFBFBD> Ա<EFBFBD> <D4B1> <EFBFBD>
CompareValues ( number ) ;
2024-12-27 23:36:33 +08:00
}
2024-12-28 14:06:45 +08:00
/// <summary>
/// <20> ڶ<EFBFBD> <DAB6> <EFBFBD> ɸѡ
/// </summary>
private void CompareValues ( int number )
2024-12-27 23:36:33 +08:00
{
2024-12-28 14:06:45 +08:00
// <20> <> ȡ<EFBFBD> <C8A1> <EFBFBD> <EFBFBD> Key
List < int > allKeys = GetAllKeys ( CSB1 ) ;
Debug . Log ( "<22> <> <EFBFBD> е <EFBFBD> Key: " + string . Join ( ", " , allKeys ) ) ;
// <20> <> ȡ<EFBFBD> <C8A1> <EFBFBD> <EFBFBD> Value
List < string > allValues = GetAllValues ( CSB1 ) ;
Debug . Log ( "<22> <> <EFBFBD> е <EFBFBD> Values: " + string . Join ( ", " , allValues ) ) ;
//foreach (var kvp in CSB1)
//{
// int key = kvp.Key;
// string value = kvp.Value;
2024-12-27 23:36:33 +08:00
2024-12-28 14:06:45 +08:00
// // <20> ָ<EFBFBD> Value <20> ַ<EFBFBD> <D6B7> <EFBFBD> Ϊ<EFBFBD> <CEAA> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
// List<string> valueList = new List<string>(value.Split(','));
2024-12-27 23:36:33 +08:00
2024-12-28 14:06:45 +08:00
// Debug.Log($"Key {key} <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ֵ<EFBFBD> <D6B5> {string.Join(", ", valueList)}");
// // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ָ<EFBFBD> <D6B8> <EFBFBD> <EFBFBD> <EFBFBD> ֵ<EFBFBD> <D6B5> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
// foreach (string item in valueList)
// {
// Debug.Log(key+"_"+item);
// }
//}
}
#region <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
/// <summary>
/// <20> <> ȡ<EFBFBD> <C8A1> <EFBFBD> <EFBFBD> Key
/// </summary>
private List < int > GetAllKeys ( Dictionary < int , List < string > > dictionary )
{
return new List < int > ( dictionary . Keys ) ;
}
/// <summary>
/// <20> <> ȡ<EFBFBD> <C8A1> <EFBFBD> <EFBFBD> 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 ) ; // <20> ϲ <EFBFBD> <CFB2> <EFBFBD> <EFBFBD> <EFBFBD> ֵ
2024-12-27 23:36:33 +08:00
}
2024-12-28 14:06:45 +08:00
return allValues ;
2024-12-27 23:36:33 +08:00
}
2024-12-28 14:06:45 +08:00
#endregion
2024-12-27 21:10:27 +08:00
public bool IsNumberInData ( string data , int number )
2024-12-27 17:45:19 +08:00
{
2024-12-27 23:36:33 +08:00
2024-12-27 21:10:27 +08:00
// <20> <> # <20> ָ<EFBFBD> OR <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
string [ ] orGroups = data . Split ( '#' ) ;
2024-12-27 17:45:19 +08:00
2024-12-27 21:10:27 +08:00
// <20> <> <EFBFBD> <EFBFBD> ÿ<EFBFBD> <C3BF> OR <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
foreach ( string orGroup in orGroups )
{
// <20> <> | <20> ָ<EFBFBD> AND <20> <> <EFBFBD> <EFBFBD>
string [ ] andConditions = orGroup . Split ( '|' ) ;
// <20> <> <EFBFBD> <EFBFBD> ÿ<EFBFBD> <C3BF> AND <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ƿ<EFBFBD> <C7B7> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
foreach ( string condition in andConditions )
{
// <20> <> , <20> ָ<D6B8> <EEB5A5> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
string [ ] numbers = condition . Split ( ',' ) ;
2024-12-27 17:45:19 +08:00
2024-12-27 21:10:27 +08:00
// ȷ<> <C8B7> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
if ( numbers . Length = = 2 & & int . TryParse ( numbers [ 1 ] , out int parsedNumber ) )
{
if ( parsedNumber = = number )
{
return true ; // <20> <> <EFBFBD> <EFBFBD> ƥ<EFBFBD> 䣬<EFBFBD> <E4A3AC> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> true
}
}
}
}
return false ; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ƥ<EFBFBD> 䣬<EFBFBD> <E4A3AC> <EFBFBD> <EFBFBD> false
2024-12-27 17:45:19 +08:00
}
2024-12-27 23:36:33 +08:00
/// <summary>
/// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ȡ<EFBFBD> <C8A1> <EFBFBD> ţ<EFBFBD> <C5A3> <EFBFBD> <EFBFBD> <EFBFBD> ǰ<EFBFBD> <C7B0> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> (<28> жϷ<D0B6> <CFB7> <EFBFBD> )
/// </summary>
/// <param name="data"><3E> <> <EFBFBD> <EFBFBD> <EFBFBD> ַ<EFBFBD> <D6B7> <EFBFBD> </param>
/// <returns><3E> <> <EFBFBD> <EFBFBD> һ <EFBFBD> <D2BB> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ֵ<EFBFBD> <D6B5> б <EFBFBD> </returns>
/// <summary>
/// <20> <> ȡ<EFBFBD> <C8A1> <EFBFBD> ţ<EFBFBD> <C5A3> <EFBFBD> <EFBFBD> <EFBFBD> ,<2C> <> ǰ<EFBFBD> <C7B0> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
/// </summary>
/// <param name="data"><3E> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ַ<EFBFBD> <D6B7> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> "123<32> <33> 15"<22> <> </param>
/// <returns><3E> <> <EFBFBD> <EFBFBD> ǰ<EFBFBD> <C7B0> <EFBFBD> <EFBFBD> <EFBFBD> ֣<EFBFBD> <D6A3> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʧ<EFBFBD> ܷ<EFBFBD> <DCB7> <EFBFBD> -1</returns>
public int GetNumberBeforeComma ( string data )
{
if ( string . IsNullOrEmpty ( data ) )
{
Debug . LogWarning ( "<22> <> <EFBFBD> <EFBFBD> Ϊ<EFBFBD> ջ<EFBFBD> null<6C> <6C> " ) ;
return - 1 ;
}
// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ŷָ֧<EEA3A8> <D6A7> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> "<22> <> " <20> <> Ӣ<EFBFBD> <D3A2> ","<22> <>
string [ ] parts = data . Split ( new char [ ] { ' <EFBFBD> <EFBFBD> ' , ',' } ) ;
// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ָ<EFBFBD> <D6B8> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Խ<EFBFBD> <D4BD> <EFBFBD>
if ( parts . Length > 0 & & int . TryParse ( parts [ 0 ] , out int number ) )
{
return number ; // <20> <> <EFBFBD> ؽ<EFBFBD> <D8BD> <EFBFBD> <EFBFBD> ɹ<EFBFBD> <C9B9> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
}
Debug . LogWarning ( $"<22> <EFBFBD> <DEB7> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ǰ<EFBFBD> <C7B0> <EFBFBD> <EFBFBD> <EFBFBD> ֣<EFBFBD> {data}" ) ;
return - 1 ; // <20> <> <EFBFBD> <EFBFBD> ʧ<EFBFBD> ܷ<EFBFBD> <DCB7> <EFBFBD> -1
}
2024-12-27 21:10:27 +08:00
2024-12-27 12:01:08 +08:00
}