73 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			73 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			C#
		
	
	
	
using System.Collections;
 | 
						|
using System.Collections.Generic;
 | 
						|
using UnityEngine;
 | 
						|
using UnityEngine.UI;
 | 
						|
 | 
						|
public class FractionInput : Fraction
 | 
						|
{
 | 
						|
    [SerializeField] InputField input;
 | 
						|
    Dictionary<string, bool> keyValuePairs = new Dictionary<string, bool>();
 | 
						|
    // Start is called before the first frame update
 | 
						|
    void Start()
 | 
						|
    {
 | 
						|
        input.onValueChanged.AddListener((x) =>
 | 
						|
        {
 | 
						|
            if (!string.IsNullOrEmpty(x))
 | 
						|
            {
 | 
						|
                //handle(x);
 | 
						|
                if (x.Length>0)
 | 
						|
                {
 | 
						|
                    CompletedorNot = true;
 | 
						|
                }
 | 
						|
            }
 | 
						|
            if (CompletedorNot)
 | 
						|
            {
 | 
						|
                if (FractionManager.Instance)
 | 
						|
                {
 | 
						|
                    FractionManager.Instance.overAsync(id, scorercontinuer, orderName);
 | 
						|
                }
 | 
						|
            }
 | 
						|
        });
 | 
						|
    }
 | 
						|
    /// <summary>
 | 
						|
    /// ¶Ô±È
 | 
						|
    /// </summary>
 | 
						|
    void handle(string data)
 | 
						|
    {
 | 
						|
        for (int i = 0; i < UIManager.Instance.jobCardController.userIDs.Length; i++)
 | 
						|
        {
 | 
						|
            if (UIManager.Instance.jobCardController.userIDs[i].text.Equals(data))
 | 
						|
            {
 | 
						|
                if (keyValuePairs.ContainsKey(data))
 | 
						|
                {
 | 
						|
                    keyValuePairs[data] = true;
 | 
						|
                }
 | 
						|
                else
 | 
						|
                {
 | 
						|
                    keyValuePairs.Add(data, false);
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
        if (keyValuePairs.Count>=scorercontinuer)
 | 
						|
        {
 | 
						|
            int sum = 0;
 | 
						|
            foreach (var item in keyValuePairs)
 | 
						|
            {
 | 
						|
                if (item.Value)
 | 
						|
                {
 | 
						|
                    sum++;
 | 
						|
                }
 | 
						|
            }
 | 
						|
            if (sum>=scorercontinuer)
 | 
						|
            {
 | 
						|
                CompletedorNot = true;
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                CompletedorNot = false;
 | 
						|
            }
 | 
						|
        }
 | 
						|
        
 | 
						|
    }
 | 
						|
}
 |