/// <summary> Apply check value on all assets. </summary>
 public static void SetFullCheck(bool value)
 {
     for (int i = 0; i < assets.Length; i++)
     {
         SetFullCheck(assets[i], value);
     }
     allCheck = value ? AllCheckState.Check : AllCheckState.Uncheck;
 }
 private static AllCheckState Blend(AllCheckState a, AllCheckState b)
 {
     if (a != b)
     {
         return(AllCheckState.Partial);
     }
     if (a == AllCheckState.Partial || b == AllCheckState.Partial)
     {
         return(AllCheckState.Partial);
     }
     if (a == AllCheckState.Check && b == AllCheckState.Check)
     {
         return(AllCheckState.Check);
     }
     return(AllCheckState.Uncheck);
 }
 /// <summary> Check if all assets are selected for the import. </summary>
 public static void RefreshAllCheck()
 {
     allCheck = IsFullCheck(assets[0]);
     if (allCheck == AllCheckState.Partial)
     {
         return;
     }
     for (int i = 1; i < assets.Length; i++)
     {
         allCheck = Blend(allCheck, IsFullCheck(assets[i]));
         if (allCheck == AllCheckState.Partial)
         {
             return;
         }
     }
 }
        /// <summary> Check if the asset and its childs are selected for the import. </summary>
        private static AllCheckState IsFullCheck(ImpAsset asset)
        {
            AllCheckState state = asset.import ? AllCheckState.Check : AllCheckState.Uncheck;

            if (state == AllCheckState.Partial)
            {
                return(AllCheckState.Partial);
            }
            if (asset.childs != null)
            {
                for (int j = 0; j < asset.childs.Length; j++)
                {
                    state = Blend(state, IsFullCheck(asset.childs[j]));
                    if (state == AllCheckState.Partial)
                    {
                        return(AllCheckState.Partial);
                    }
                }
            }
            return(state);
        }