少年修仙传客户端代码仓库
client_Zxw
2018-08-20 04b3034c07f86aad4493f3be4bd26e2094c10d0c
System/MainInterfacePanel/HighSettingFadeInFadeOut.cs
@@ -1,766 +1,827 @@
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Wednesday, April 11, 2018
//--------------------------------------------------------
using System;
using System.Collections.Generic;
using UnityEngine;
using System.Text;
using Snxxz.UI;
using TableConfig;
using System.Globalization;
using System.Collections;
namespace Snxxz.UI
{
    public class SelectCaseRequest
    {
        public Transform Tran;
        public bool IsNagaaki;//是否常显
        public int Index;//下表
    }
    public class HighSettingFadeInFadeOut : MonoBehaviour
    {
        [Header("关于上层按钮组的特殊按钮")]
        public List<int> GroupTopIndexList = new List<int>();
        [Header("关于下层按钮组的特殊按钮")]
        public List<int> GroupLowIndexList = new List<int>();
        [Header("关于第三层按钮组的特殊按钮")]
        public List<int> GroupThreeIndexList = new List<int>();
        [SerializeField] Transform m_BoxContainerTranTop;//生成盒上层
        [SerializeField] Transform m_BoxContainerTranLow;//生成盒下层
        [SerializeField] Transform m_BoxContainerThree;//第三行生成盒
        [SerializeField] Transform m_GroupIndex;
        [SerializeField] Transform m_GroupIndex_Top;
        [SerializeField] Transform m_GroupIndex_Low;
        [SerializeField] Transform m_GroupIndex_Three;
        Dictionary<int, SelectCaseRequest> AnimationFadeOutDicTop = new Dictionary<int, SelectCaseRequest>();
        Dictionary<int, SelectCaseRequest> AnimationFadeOutDicLow = new Dictionary<int, SelectCaseRequest>();
        Dictionary<int, SelectCaseRequest> AnimationFadeOutDicThree = new Dictionary<int, SelectCaseRequest>();
        List<SelectCaseRequest> SelectCaseRequestListTop = new List<SelectCaseRequest>();
        List<SelectCaseRequest> SelectCaseRequestListLow = new List<SelectCaseRequest>();
        List<SelectCaseRequest> SelectCaseRequestListThree = new List<SelectCaseRequest>();
        List<float> LatencyTimeList = new List<float>();//关于延迟时间
        TreasureFindHostModel hostModel { get { return ModelCenter.Instance.GetModel<TreasureFindHostModel>(); } }
        OSGiftModel osGiftModel { get { return ModelCenter.Instance.GetModel<OSGiftModel>(); } }
        LimitedTimePackageItemClassModel limitedTimePackageItemModel { get { return ModelCenter.Instance.GetModel<LimitedTimePackageItemClassModel>(); } }
        public void Init()
        {
            if (LatencyTimeList.Count <= 0)
            {
                LatencyTimeList.Clear();
                string str = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("MaininterfaceAniTime").Numerical1;
                string[] StrList = ConfigParse.GetMultipleStr(str);//解析出数组
                for (int j = 0; j < StrList.Length; j++)
                {
                    float number;
                    if (float.TryParse(StrList[j], NumberStyles.Float, CultureInfo.InvariantCulture, out number))
                    {
                        LatencyTimeList.Add(number);
                    }
                }
            }
            m_GroupIndex.gameObject.SetActive(false);
            Classify();
            TimeUtility.OnServerOpenDayRefresh += OnStepServerDay;
            FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChange;
            hostModel.TreasureFindHostCompleteAct += TreasureFindHostCompleteAct;
            osGiftModel.OnOSGiftStateChange += OnOSGiftStateChange;
            RedpointCenter.Instance.redpointValueChangeEvent += UpdateRedpoint;
            OpenServerActivityCenter.Instance.openServerActivityStateChange += OpenServerActivityStateChange;
            OperationTimeHepler.Instance.operationStartEvent += operationStartEvent;
            OperationTimeHepler.Instance.operationEndEvent += operationEndEvent;
        }
        public void Unit()
        {
            StopIEnumerator();
            FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChange;
            hostModel.TreasureFindHostCompleteAct -= TreasureFindHostCompleteAct;
            osGiftModel.OnOSGiftStateChange -= OnOSGiftStateChange;
            TimeUtility.OnServerOpenDayRefresh -= OnStepServerDay;
            OpenServerActivityCenter.Instance.openServerActivityStateChange -= OpenServerActivityStateChange;
            RedpointCenter.Instance.redpointValueChangeEvent -= UpdateRedpoint;
            OperationTimeHepler.Instance.operationStartEvent -= operationStartEvent;
            OperationTimeHepler.Instance.operationEndEvent -= operationEndEvent;
        }
        private void operationEndEvent(Operation arg1, int arg2)
        {
            if (arg1 == Operation.GiftPackage || arg1 == Operation.FairyCeremony)
            {
                Classify();
            }
        }
        private void operationStartEvent(Operation arg1, int arg2)
        {
            if (arg1 == Operation.GiftPackage || arg1 == Operation.FairyCeremony)
            {
                Classify();
            }
        }
        private void UpdateRedpoint(int redPointID)
        {
            if (redPointID == 201 || redPointID == 210)
            {
                Classify();
            }
        }
        private void OpenServerActivityStateChange()
        {
            Classify();
        }
        private void OnStepServerDay()//开服活动
        {
            var _impactRankDays = ModelCenter.Instance.GetModel<ImpactRankModel>().openServerActivityDays;
            if (TimeUtility.OpenDay >= _impactRankDays)
            {
                Classify();
            }
        }
        private void TreasureFindHostCompleteAct()//仙宝寻主
        {
            Classify();
        }
        private void OnOSGiftStateChange()
        {
            Classify();
        }
        public void FadeOut()//淡出
        {
            if (this.gameObject.activeInHierarchy)
            {
                StartCoroutine("FadeOutTop");
                StartCoroutine("FadeOutLow");
                StartCoroutine("FadeOutThree");
            }
        }
        public void FadeIn()//淡入
        {
            if (this.gameObject.activeInHierarchy)
            {
                StartCoroutine("FadeInTop");
                StartCoroutine("FadeInLow");
                StartCoroutine("FadeInThree");
            }
        }
        private void StopIEnumerator()
        {
            StopCoroutine("FadeOutTop");
            StopCoroutine("FadeOutLow");
            StopCoroutine("FadeInTop");
            StopCoroutine("FadeInLow");
            StopCoroutine("FadeOutThree");
            StopCoroutine("FadeInThree");
        }
        IEnumerator FadeOutTop()
        {
            int type = 0;
            for (int i = 0; i < m_BoxContainerTranTop.childCount; i++)
            {
                if (i < SelectCaseRequestListTop.Count)
                {
                    TopAnimationPlay topAnimationPlay = m_BoxContainerTranTop.GetChild(i).GetComponent<TopAnimationPlay>();
                    if (!SelectCaseRequestListTop[i].IsNagaaki)
                    {
                        yield return new WaitForSeconds(LatencyTimeList[type]);
                        type += 1;
                    }
                    topAnimationPlay.FadeOut();
                }
            }
        }
        IEnumerator FadeOutLow()
        {
            int type = 0;
            for (int i = 0; i < m_BoxContainerTranLow.childCount; i++)
            {
                if (i < SelectCaseRequestListLow.Count)
                {
                    TopAnimationPlay topAnimationPlay = m_BoxContainerTranLow.GetChild(i).GetComponent<TopAnimationPlay>();
                    if (!SelectCaseRequestListLow[i].IsNagaaki)
                    {
                        yield return new WaitForSeconds(LatencyTimeList[type]);
                        type += 1;
                    }
                    topAnimationPlay.FadeOut();
                }
            }
        }
        IEnumerator FadeOutThree()
        {
            int type = 0;
            for (int i = 0; i < m_BoxContainerThree.childCount; i++)
            {
                if (i < SelectCaseRequestListThree.Count)
                {
                    TopAnimationPlay topAnimationPlay = m_BoxContainerThree.GetChild(i).GetComponent<TopAnimationPlay>();
                    if (!SelectCaseRequestListThree[i].IsNagaaki)
                    {
                        yield return new WaitForSeconds(LatencyTimeList[type]);
                        type += 1;
                    }
                    topAnimationPlay.FadeOut();
                }
            }
        }
        IEnumerator FadeInTop()
        {
            int type = 0;
            for (int i = 0; i < m_BoxContainerTranTop.childCount; i++)
            {
                if (i < SelectCaseRequestListTop.Count)
                {
                    TopAnimationPlay topAnimationPlay = m_BoxContainerTranTop.GetChild(i).GetComponent<TopAnimationPlay>();
                    if (!SelectCaseRequestListTop[i].IsNagaaki)
                    {
                        yield return new WaitForSeconds(LatencyTimeList[type]);
                        type += 1;
                    }
                    topAnimationPlay.FadeIn();
                }
            }
        }
        IEnumerator FadeInLow()
        {
            int type = 0;
            for (int i = 0; i < m_BoxContainerTranLow.childCount; i++)
            {
                if (i < SelectCaseRequestListLow.Count)
                {
                    TopAnimationPlay topAnimationPlay = m_BoxContainerTranLow.GetChild(i).GetComponent<TopAnimationPlay>();
                    if (!SelectCaseRequestListLow[i].IsNagaaki)
                    {
                        yield return new WaitForSeconds(LatencyTimeList[type]);
                        type += 1;
                    }
                    topAnimationPlay.FadeIn();
                }
            }
        }
        IEnumerator FadeInThree()
        {
            int type = 0;
            for (int i = 0; i < m_BoxContainerThree.childCount; i++)
            {
                if (i < SelectCaseRequestListThree.Count)
                {
                    TopAnimationPlay topAnimationPlay = m_BoxContainerThree.GetChild(i).GetComponent<TopAnimationPlay>();
                    if (!SelectCaseRequestListThree[i].IsNagaaki)
                    {
                        yield return new WaitForSeconds(LatencyTimeList[type]);
                        type += 1;
                    }
                    topAnimationPlay.FadeIn();
                }
            }
        }
        public void PositionNow()//立即出现
        {
            for (int i = 0; i < m_BoxContainerTranTop.childCount; i++)//1
            {
                TopAnimationPlay topAnimationPlay = m_BoxContainerTranTop.GetChild(i).GetComponent<TopAnimationPlay>();
                topAnimationPlay.PositionNow();
            }
            for (int i = 0; i < m_BoxContainerTranLow.childCount; i++)//2
            {
                TopAnimationPlay topAnimationPlay = m_BoxContainerTranLow.GetChild(i).GetComponent<TopAnimationPlay>();
                topAnimationPlay.PositionNow();
            }
            for (int i = 0; i < m_BoxContainerThree.childCount; i++)//3
            {
                TopAnimationPlay topAnimationPlay = m_BoxContainerThree.GetChild(i).GetComponent<TopAnimationPlay>();
                topAnimationPlay.PositionNow();
            }
        }
        public void PositionDel()//立即消失
        {
            for (int i = 0; i < m_BoxContainerTranTop.childCount; i++)//1
            {
                if (i < SelectCaseRequestListTop.Count)
                {
                    TopAnimationPlay topAnimationPlay = m_BoxContainerTranTop.GetChild(i).GetComponent<TopAnimationPlay>();
                    topAnimationPlay.ImmediatelyDisappear();
                }
            }
            for (int i = 0; i < m_BoxContainerTranLow.childCount; i++)//2
            {
                if (i < SelectCaseRequestListLow.Count)
                {
                    TopAnimationPlay topAnimationPlay = m_BoxContainerTranLow.GetChild(i).GetComponent<TopAnimationPlay>();
                    topAnimationPlay.ImmediatelyDisappear();
                }
            }
            for (int i = 0; i < m_BoxContainerThree.childCount; i++)//3
            {
                if (i < SelectCaseRequestListThree.Count)
                {
                    TopAnimationPlay topAnimationPlay = m_BoxContainerThree.GetChild(i).GetComponent<TopAnimationPlay>();
                    topAnimationPlay.ImmediatelyDisappear();
                }
            }
        }
        public bool GetIsFadeIn()//判断是否淡入
        {
            for (int i = 0; i < m_BoxContainerTranTop.childCount; i++)
            {
                if (i < SelectCaseRequestListTop.Count)
                {
                    TopAnimationPlay topAnimationPlay = m_BoxContainerTranTop.GetChild(i).GetComponent<TopAnimationPlay>();
                    if (!topAnimationPlay.IsplayAnimator)
                    {
                        continue;
                    }
                    if (topAnimationPlay.CanvasGroup.alpha > 0.3)
                    {
                        return true;
                    }
                }
            }
            for (int i = 0; i < m_BoxContainerTranLow.childCount; i++)
            {
                if (i < SelectCaseRequestListLow.Count)
                {
                    TopAnimationPlay topAnimationPlay = m_BoxContainerTranLow.GetChild(i).GetComponent<TopAnimationPlay>();
                    if (!topAnimationPlay.IsplayAnimator)
                    {
                        continue;
                    }
                    if (topAnimationPlay.CanvasGroup.alpha > 0.3)
                    {
                        return true;
                    }
                }
            }
            for (int i = 0; i < m_BoxContainerThree.childCount; i++)
            {
                if (i < SelectCaseRequestListThree.Count)
                {
                    TopAnimationPlay topAnimationPlay = m_BoxContainerThree.GetChild(i).GetComponent<TopAnimationPlay>();
                    if (!topAnimationPlay.IsplayAnimator)
                    {
                        continue;
                    }
                    if (topAnimationPlay.CanvasGroup.alpha > 0.3)
                    {
                        return true;
                    }
                }
            }
            return false;
        }
        private void Classify()
        {
            PositionNow();
            PositionReduction();
            SetGroupTop();
            SetGroupLow();
            //  SetGroupThree();
            SetfatherNodeTop();
            SetfatherNodeLow();
            SetfatherNodeThree();
        }
        private void SetGroupTop()//上层分组
        {
            AnimationFadeOutDicTop.Clear();
            for (int i = 0; i < m_GroupIndex_Top.childCount; i++)
            {
                HighBtnRecord highBtnRecord = m_GroupIndex_Top.GetChild(i).GetComponent<HighBtnRecord>();
                if (m_GroupIndex_Top.GetChild(i).GetComponent<UIFuncOpen>() != null)
                {
                    if (!FuncOpen.Instance.IsFuncOpen(m_GroupIndex_Top.GetChild(i).GetComponent<UIFuncOpen>().id))
                    {
                        if (highBtnRecord.IsBool && !AnimationFadeOutDicTop.ContainsKey(highBtnRecord.Index))
                        {
                            SelectCaseRequest selectCaseRequest = new SelectCaseRequest();
                            selectCaseRequest.Tran = m_GroupIndex_Top.GetChild(i);
                            selectCaseRequest.IsNagaaki = highBtnRecord.IsNagaaki;
                            selectCaseRequest.Index = highBtnRecord.Index;
                            AnimationFadeOutDicTop.Add(highBtnRecord.Index, selectCaseRequest);
                        }
                    }
                    else
                    {
                        if (!AnimationFadeOutDicTop.ContainsKey(highBtnRecord.Index))
                        {
                            SelectCaseRequest selectCaseRequest = new SelectCaseRequest();
                            selectCaseRequest.Tran = m_GroupIndex_Top.GetChild(i);
                            selectCaseRequest.IsNagaaki = highBtnRecord.IsNagaaki;
                            selectCaseRequest.Index = highBtnRecord.Index;
                            AnimationFadeOutDicTop.Add(highBtnRecord.Index, selectCaseRequest);
                        }
                    }
                }
                else
                {
                    if (GroupTopIndexList.Contains(highBtnRecord.Index))
                    {
                        if (ModelCenter.Instance.GetModel<OSGiftModel>().activate)//超值礼包
                        {
                            if (!AnimationFadeOutDicTop.ContainsKey(highBtnRecord.Index))
                            {
                                SelectCaseRequest selectCaseRequest = new SelectCaseRequest();
                                selectCaseRequest.Tran = m_GroupIndex_Top.GetChild(i);
                                selectCaseRequest.IsNagaaki = highBtnRecord.IsNagaaki;
                                AnimationFadeOutDicTop.Add(highBtnRecord.Index, selectCaseRequest);
                            }
                        }
                    }
                }
            }
        }
        private void SetGroupLow()//下层分组
        {
            AnimationFadeOutDicLow.Clear();
            AnimationFadeOutDicThree.Clear();
            for (int i = 0; i < m_GroupIndex_Low.childCount; i++)
            {
                HighBtnRecord highBtnRecord = m_GroupIndex_Low.GetChild(i).GetComponent<HighBtnRecord>();
                IsPlayerUIeffect isPlayerUIeffect = m_GroupIndex_Low.GetChild(i).GetComponent<IsPlayerUIeffect>();
                if (m_GroupIndex_Low.GetChild(i).GetComponent<UIFuncOpen>() != null)//有功能开启ID
                {
                    int openFucID = m_GroupIndex_Low.GetChild(i).GetComponent<UIFuncOpen>().id;
                    if (!FuncOpen.Instance.IsFuncOpen(openFucID))
                    {
                        if (highBtnRecord.IsBool && !AnimationFadeOutDicLow.ContainsKey(highBtnRecord.Index))
                        {
                            if (isPlayerUIeffect.RedPointId == 201 || isPlayerUIeffect.RedPointId == 210)
                            {
                                if (RedpointCenter.Instance.GetRedpointState(isPlayerUIeffect.RedPointId) == RedPointState.Simple)
                                {
                                    m_GroupIndex_Low.GetChild(i).GetComponent<HighBtnRecord>().IsNagaaki = true;
                                    highBtnRecord.IsNagaaki = true;
                                }
                                else
                                {
                                    m_GroupIndex_Low.GetChild(i).GetComponent<HighBtnRecord>().IsNagaaki = false;
                                    highBtnRecord.IsNagaaki = false;
                                }
                            }
                            if (AnimationFadeOutDicLow.Count < 6)//------第二层
                            {
                                SelectCaseRequest selectCaseRequest = new SelectCaseRequest();
                                selectCaseRequest.Tran = m_GroupIndex_Low.GetChild(i);
                                selectCaseRequest.IsNagaaki = highBtnRecord.IsNagaaki;
                                selectCaseRequest.Index = highBtnRecord.Index;
                                AnimationFadeOutDicLow.Add(highBtnRecord.Index, selectCaseRequest);
                            }
                            else//------第三层
                            {
                                SelectCaseRequest selectCaseRequest = new SelectCaseRequest();
                                selectCaseRequest.Tran = m_GroupIndex_Low.GetChild(i);
                                selectCaseRequest.IsNagaaki = highBtnRecord.IsNagaaki;
                                selectCaseRequest.Index = highBtnRecord.Index;
                                AnimationFadeOutDicThree.Add(highBtnRecord.Index, selectCaseRequest);
                            }
                        }
                    }
                    else
                    {
                        int OpenFuncID = m_GroupIndex_Low.GetChild(i).GetComponent<UIFuncOpen>().id;
                        if (OpenFuncID == 124 && FuncOpen.Instance.IsFuncOpen(124))//仙宝寻主
                        {
                            if (hostModel.CheckTreasureFindHostFinish())//仙宝寻主关闭
                            {
                                continue;
                            }
                        }
                        //if (OpenFuncID == 134 && FuncOpen.Instance.IsFuncOpen(134))//仙界盛典
                        //{
                        //    if (!OperationTimeHepler.Instance.InOperationTime(Operation.FairyCeremony))//仙界盛典
                        //    {
                        //        continue;
                        //    }
                        //}
                        if (!AnimationFadeOutDicLow.ContainsKey(highBtnRecord.Index))
                        {
                            if (isPlayerUIeffect.RedPointId == 201 || isPlayerUIeffect.RedPointId == 210)
                            {
                                if (RedpointCenter.Instance.GetRedpointState(isPlayerUIeffect.RedPointId) == RedPointState.Simple)
                                {
                                    m_GroupIndex_Low.GetChild(i).GetComponent<HighBtnRecord>().IsNagaaki = true;
                                    highBtnRecord.IsNagaaki = true;
                                }
                                else
                                {
                                    m_GroupIndex_Low.GetChild(i).GetComponent<HighBtnRecord>().IsNagaaki = false;
                                    highBtnRecord.IsNagaaki = false;
                                }
                            }
                            if (AnimationFadeOutDicLow.Count < 6)//------第二层
                            {
                                SelectCaseRequest selectCaseRequest = new SelectCaseRequest();
                                selectCaseRequest.Tran = m_GroupIndex_Low.GetChild(i);
                                selectCaseRequest.IsNagaaki = highBtnRecord.IsNagaaki;
                                selectCaseRequest.Index = highBtnRecord.Index;
                                AnimationFadeOutDicLow.Add(highBtnRecord.Index, selectCaseRequest);
                            }
                            else//------第三层
                            {
                                SelectCaseRequest selectCaseRequest = new SelectCaseRequest();
                                selectCaseRequest.Tran = m_GroupIndex_Low.GetChild(i);
                                selectCaseRequest.IsNagaaki = highBtnRecord.IsNagaaki;
                                selectCaseRequest.Index = highBtnRecord.Index;
                                AnimationFadeOutDicThree.Add(highBtnRecord.Index, selectCaseRequest);
                            }
                        }
                    }
                }
                else
                {
                    if (GroupLowIndexList.Contains(highBtnRecord.Index))
                    {
                        int IndexOf = GroupLowIndexList.IndexOf(highBtnRecord.Index);
                        if (IndexOf == 0)
                        {
                            if (!AnimationFadeOutDicLow.ContainsKey(highBtnRecord.Index) && limitedTimePackageItemModel.IsExpired())//限时礼包
                            {
                                if (AnimationFadeOutDicLow.Count < 6)//------第二层
                                {
                                    SelectCaseRequest selectCaseRequest = new SelectCaseRequest();
                                    selectCaseRequest.Tran = m_GroupIndex_Low.GetChild(i);
                                    selectCaseRequest.IsNagaaki = highBtnRecord.IsNagaaki;
                                    selectCaseRequest.Index = highBtnRecord.Index;
                                    AnimationFadeOutDicLow.Add(highBtnRecord.Index, selectCaseRequest);
                                }
                                else//------第三层
                                {
                                    SelectCaseRequest selectCaseRequest = new SelectCaseRequest();
                                    selectCaseRequest.Tran = m_GroupIndex_Low.GetChild(i);
                                    selectCaseRequest.IsNagaaki = highBtnRecord.IsNagaaki;
                                    selectCaseRequest.Index = highBtnRecord.Index;
                                    AnimationFadeOutDicThree.Add(highBtnRecord.Index, selectCaseRequest);
                                }
                            }
                        }
                        else if (IndexOf == 1)
                        {
                            var _funcOrder = 0;
                            if (OpenServerActivityCenter.Instance.IsAnyActivityOpen(out _funcOrder))//开服活动
                            {
                                if (!AnimationFadeOutDicLow.ContainsKey(highBtnRecord.Index))
                                {
                                    SelectCaseRequest selectCaseRequest = new SelectCaseRequest();
                                    selectCaseRequest.Tran = m_GroupIndex_Low.GetChild(i);
                                    selectCaseRequest.IsNagaaki = highBtnRecord.IsNagaaki;
                                    selectCaseRequest.Index = highBtnRecord.Index;
                                    AnimationFadeOutDicLow.Add(highBtnRecord.Index, selectCaseRequest);
                                }
                            }
                        }
                        else if (IndexOf == 2)
                        {
                            if (!AnimationFadeOutDicLow.ContainsKey(highBtnRecord.Index) && OperationTimeHepler.Instance.InOperationTime(Operation.FairyCeremony))
                            {
                                if (AnimationFadeOutDicLow.Count < 6)//------第二层
                                {
                                    SelectCaseRequest selectCaseRequest = new SelectCaseRequest();
                                    selectCaseRequest.Tran = m_GroupIndex_Low.GetChild(i);
                                    selectCaseRequest.IsNagaaki = highBtnRecord.IsNagaaki;
                                    selectCaseRequest.Index = highBtnRecord.Index;
                                    AnimationFadeOutDicLow.Add(highBtnRecord.Index, selectCaseRequest);
                                }
                                else//------第三层
                                {
                                    SelectCaseRequest selectCaseRequest = new SelectCaseRequest();
                                    selectCaseRequest.Tran = m_GroupIndex_Low.GetChild(i);
                                    selectCaseRequest.IsNagaaki = highBtnRecord.IsNagaaki;
                                    selectCaseRequest.Index = highBtnRecord.Index;
                                    AnimationFadeOutDicThree.Add(highBtnRecord.Index, selectCaseRequest);
                                }
                            }
                        }
                    }
                }
            }
        }
        private void PositionReduction()//还原位置(把盒子中的位置全部重新拉出来)
        {
            if (AnimationFadeOutDicTop.Count > 0)//上层
            {
                foreach (var key in AnimationFadeOutDicTop.Keys)
                {
                    AnimationFadeOutDicTop[key].Tran.SetParent(m_GroupIndex_Top);
                    AnimationFadeOutDicTop[key].Tran.SetSiblingIndex(key);
                }
            }
            if (AnimationFadeOutDicLow.Count > 0)//中间
            {
                foreach (var key in AnimationFadeOutDicLow.Keys)
                {
                    AnimationFadeOutDicLow[(AnimationFadeOutDicLow[key].Index)].Tran.SetParent(m_GroupIndex_Low);
                    AnimationFadeOutDicLow[(AnimationFadeOutDicLow[key].Index)].Tran.SetSiblingIndex((AnimationFadeOutDicLow[key].Index));
                }
            }
            if (AnimationFadeOutDicThree.Count > 0)//第三层(拉到第二层)
            {
                foreach (var key in AnimationFadeOutDicThree.Keys)
                {
                    AnimationFadeOutDicThree[(AnimationFadeOutDicThree[key].Index)].Tran.SetParent(m_GroupIndex_Low);
                    AnimationFadeOutDicThree[(AnimationFadeOutDicThree[key].Index)].Tran.SetSiblingIndex((AnimationFadeOutDicThree[key].Index));
                }
            }
        }
        private void SetfatherNodeTop()//设置父节点上层
        {
            SelectCaseRequestListTop.Clear();
            foreach (var key in AnimationFadeOutDicTop.Keys)
            {
                SelectCaseRequestListTop.Add(AnimationFadeOutDicTop[key]);
            }
            for (int i = 0; i < m_BoxContainerTranTop.childCount; i++)
            {
                int type = i;
                Transform tran = m_BoxContainerTranTop.GetChild(i);
                TopAnimationPlay topAnimationPlay = tran.GetComponent<TopAnimationPlay>();
                if (type < SelectCaseRequestListTop.Count)
                {
                    tran.gameObject.SetActive(true);
                    SelectCaseRequestListTop[type].Tran.SetParent(tran);
                    SelectCaseRequestListTop[type].Tran.localPosition = Vector3.zero;
                    topAnimationPlay.IsplayAnimator = !SelectCaseRequestListTop[type].IsNagaaki;
                }
                else
                {
                    tran.gameObject.SetActive(false);
                    topAnimationPlay.IsplayAnimator = false;
                }
            }
        }
        private void SetfatherNodeLow()//设置父节点下层
        {
            SelectCaseRequestListLow.Clear();
            foreach (var key in AnimationFadeOutDicLow.Keys)
            {
                SelectCaseRequestListLow.Add(AnimationFadeOutDicLow[key]);
            }
            SelectCaseRequestListLow.Sort(Compare);
            for (int i = 0; i < m_BoxContainerTranLow.childCount; i++)
            {
                int type = i;
                Transform tran = m_BoxContainerTranLow.GetChild(i);
                TopAnimationPlay topAnimationPlay = tran.GetComponent<TopAnimationPlay>();
                if (type < SelectCaseRequestListLow.Count)
                {
                    tran.gameObject.SetActive(true);
                    SelectCaseRequestListLow[type].Tran.SetParent(tran);
                    SelectCaseRequestListLow[type].Tran.localPosition = Vector3.zero;
                    topAnimationPlay.IsplayAnimator = !SelectCaseRequestListLow[type].IsNagaaki;
                }
                else
                {
                    tran.gameObject.SetActive(false);
                    topAnimationPlay.IsplayAnimator = false;
                }
            }
        }
        private void SetfatherNodeThree()//设置父节点第三层
        {
            SelectCaseRequestListThree.Clear();
            foreach (var key in AnimationFadeOutDicThree.Keys)
            {
                SelectCaseRequestListThree.Add(AnimationFadeOutDicThree[key]);
            }
            SelectCaseRequestListThree.Sort(Compare);
            for (int i = 0; i < m_BoxContainerThree.childCount; i++)
            {
                int type = i;
                Transform tran = m_BoxContainerThree.GetChild(i);
                TopAnimationPlay topAnimationPlay = tran.GetComponent<TopAnimationPlay>();
                if (type < SelectCaseRequestListThree.Count)
                {
                    tran.gameObject.SetActive(true);
                    SelectCaseRequestListThree[type].Tran.SetParent(tran);
                    SelectCaseRequestListThree[type].Tran.localPosition = Vector3.zero;
                    topAnimationPlay.IsplayAnimator = !SelectCaseRequestListThree[type].IsNagaaki;
                }
                else
                {
                    tran.gameObject.SetActive(false);
                    topAnimationPlay.IsplayAnimator = false;
                }
            }
        }
        int Compare(SelectCaseRequest x, SelectCaseRequest y)
        {
            bool havex = x.IsNagaaki;
            bool havey = y.IsNagaaki;
            if (havex.CompareTo(havey) != 0)
            {
                return -havex.CompareTo(havey);
            }
            if (x.Index.CompareTo(y.Index) != 0)
            {
                return x.Index.CompareTo(y.Index);
            }
            return 1;
        }
        private void OnFuncStateChange(int obj)
        {
            Classify();
        }
        public bool IsShowButton()//是否显示切换按钮
        {
            bool boolOpen = false;
            for (int i = 0; i < SelectCaseRequestListTop.Count; i++)
            {
                if (!SelectCaseRequestListTop[i].IsNagaaki)
                {
                    boolOpen = true;
                }
            }
            for (int i = 0; i < SelectCaseRequestListLow.Count; i++)
            {
                if (!SelectCaseRequestListLow[i].IsNagaaki)
                {
                    boolOpen = true;
                }
            }
            for (int i = 0; i < SelectCaseRequestListThree.Count; i++)
            {
                if (!SelectCaseRequestListThree[i].IsNagaaki)
                {
                    boolOpen = true;
                }
            }
            return boolOpen;
        }
    }
}
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Wednesday, April 11, 2018
//--------------------------------------------------------
using System;
using System.Collections.Generic;
using UnityEngine;
using System.Text;
using Snxxz.UI;
using TableConfig;
using System.Globalization;
using System.Collections;
namespace Snxxz.UI
{
    public class SelectCaseRequest
    {
        public Transform Tran;
        public bool IsNagaaki;//是否常显
        public int Index;//下表
    }
    public class HighSettingFadeInFadeOut : MonoBehaviour
    {
        [Header("关于上层按钮组的特殊按钮")]
        public List<int> GroupTopIndexList = new List<int>();
        [Header("关于下层按钮组的特殊按钮")]
        public List<int> GroupLowIndexList = new List<int>();
        [Header("关于第三层按钮组的特殊按钮")]
        public List<int> GroupThreeIndexList = new List<int>();
        [SerializeField] Transform m_BoxContainerTranTop;//生成盒上层
        [SerializeField] Transform m_BoxContainerTranLow;//生成盒下层
        [SerializeField] Transform m_BoxContainerThree;//第三行生成盒
        [SerializeField] Transform m_GroupIndex;
        [SerializeField] Transform m_GroupIndex_Top;
        [SerializeField] Transform m_GroupIndex_Low;
        [SerializeField] Transform m_GroupIndex_Three;
        Dictionary<int, SelectCaseRequest> AnimationFadeOutDicTop = new Dictionary<int, SelectCaseRequest>();
        Dictionary<int, SelectCaseRequest> AnimationFadeOutDicLow = new Dictionary<int, SelectCaseRequest>();
        Dictionary<int, SelectCaseRequest> AnimationFadeOutDicThree = new Dictionary<int, SelectCaseRequest>();
        List<SelectCaseRequest> SelectCaseRequestListTop = new List<SelectCaseRequest>();
        List<SelectCaseRequest> SelectCaseRequestListLow = new List<SelectCaseRequest>();
        List<SelectCaseRequest> SelectCaseRequestListThree = new List<SelectCaseRequest>();
        List<float> LatencyTimeList = new List<float>();//关于延迟时间
        TreasureFindHostModel hostModel { get { return ModelCenter.Instance.GetModel<TreasureFindHostModel>(); } }
        OSGiftModel osGiftModel { get { return ModelCenter.Instance.GetModel<OSGiftModel>(); } }
        LimitedTimePackageItemClassModel limitedTimePackageItemModel { get { return ModelCenter.Instance.GetModel<LimitedTimePackageItemClassModel>(); } }
        ImpactRankModel impactRankModel { get { return ModelCenter.Instance.GetModel<ImpactRankModel>(); } }
        public void Init()
        {
            if (LatencyTimeList.Count <= 0)
            {
                LatencyTimeList.Clear();
                string str = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("MaininterfaceAniTime").Numerical1;
                string[] StrList = ConfigParse.GetMultipleStr(str);//解析出数组
                for (int j = 0; j < StrList.Length; j++)
                {
                    float number;
                    if (float.TryParse(StrList[j], NumberStyles.Float, CultureInfo.InvariantCulture, out number))
                    {
                        LatencyTimeList.Add(number);
                    }
                }
            }
            m_GroupIndex.gameObject.SetActive(false);
            Classify();
            TimeUtility.OnServerOpenDayRefresh += OnStepServerDay;
            FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChange;
            hostModel.TreasureFindHostCompleteAct += TreasureFindHostCompleteAct;
            RedpointCenter.Instance.redpointValueChangeEvent += UpdateRedpoint;
            OpenServerActivityCenter.Instance.openServerActivityStateChange += OpenServerActivityStateChange;
            OperationTimeHepler.Instance.operationStartEvent += operationStartEvent;
            OperationTimeHepler.Instance.operationEndEvent += operationEndEvent;
            limitedTimePackageItemModel.UpdateLimitedTimePackageItem += UpdateLimitedTimePackageItem;
            impactRankModel.inImpactRankUpdate += InImpactRankUpdate;
        }
        public void Unit()
        {
            StopIEnumerator();
            FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChange;
            hostModel.TreasureFindHostCompleteAct -= TreasureFindHostCompleteAct;
            TimeUtility.OnServerOpenDayRefresh -= OnStepServerDay;
            OpenServerActivityCenter.Instance.openServerActivityStateChange -= OpenServerActivityStateChange;
            RedpointCenter.Instance.redpointValueChangeEvent -= UpdateRedpoint;
            OperationTimeHepler.Instance.operationStartEvent -= operationStartEvent;
            OperationTimeHepler.Instance.operationEndEvent -= operationEndEvent;
            limitedTimePackageItemModel.UpdateLimitedTimePackageItem -= UpdateLimitedTimePackageItem;
            impactRankModel.inImpactRankUpdate -= InImpactRankUpdate;
        }
        private void InImpactRankUpdate()
        {
            Classify();
        }
        private void UpdateLimitedTimePackageItem()
        {
            Classify();
        }
        private void operationEndEvent(Operation arg1, int arg2)
        {
            if (arg1 == Operation.FairyCeremony)
            {
                Classify();
            }
        }
        private void operationStartEvent(Operation arg1, int arg2)
        {
            if (arg1 == Operation.FairyCeremony)
            {
                Classify();
            }
        }
        private void UpdateRedpoint(int redPointID)
        {
            if (redPointID == 201 || redPointID == 210)
            {
                Classify();
            }
        }
        private void OpenServerActivityStateChange()
        {
            Classify();
        }
        private void OnStepServerDay()//开服活动
        {
            var _impactRankDays = ModelCenter.Instance.GetModel<ImpactRankModel>().openServerActivityDays;
            if (TimeUtility.OpenDay >= _impactRankDays)
            {
                Classify();
            }
        }
        private void TreasureFindHostCompleteAct()//仙宝寻主
        {
            Classify();
        }
        private void OnOSGiftStateChange()
        {
            Classify();
        }
        public void FadeOut()//淡出
        {
            if (this.gameObject.activeInHierarchy)
            {
                StartCoroutine("FadeOutTop");
                StartCoroutine("FadeOutLow");
                StartCoroutine("FadeOutThree");
            }
        }
        public void FadeIn()//淡入
        {
            if (this.gameObject.activeInHierarchy)
            {
                StartCoroutine("FadeInTop");
                StartCoroutine("FadeInLow");
                StartCoroutine("FadeInThree");
            }
        }
        private void StopIEnumerator()
        {
            StopCoroutine("FadeOutTop");
            StopCoroutine("FadeOutLow");
            StopCoroutine("FadeInTop");
            StopCoroutine("FadeInLow");
            StopCoroutine("FadeOutThree");
            StopCoroutine("FadeInThree");
        }
        IEnumerator FadeOutTop()
        {
            int type = 0;
            for (int i = 0; i < m_BoxContainerTranTop.childCount; i++)
            {
                if (i < SelectCaseRequestListTop.Count)
                {
                    TopAnimationPlay topAnimationPlay = m_BoxContainerTranTop.GetChild(i).GetComponent<TopAnimationPlay>();
                    if (!SelectCaseRequestListTop[i].IsNagaaki)
                    {
                        yield return new WaitForSeconds(LatencyTimeList[type]);
                        type += 1;
                    }
                    topAnimationPlay.FadeOut();
                }
            }
        }
        IEnumerator FadeOutLow()
        {
            int type = 0;
            for (int i = 0; i < m_BoxContainerTranLow.childCount; i++)
            {
                if (i < SelectCaseRequestListLow.Count)
                {
                    TopAnimationPlay topAnimationPlay = m_BoxContainerTranLow.GetChild(i).GetComponent<TopAnimationPlay>();
                    if (!SelectCaseRequestListLow[i].IsNagaaki)
                    {
                        yield return new WaitForSeconds(LatencyTimeList[type]);
                        type += 1;
                    }
                    topAnimationPlay.FadeOut();
                }
            }
        }
        IEnumerator FadeOutThree()
        {
            int type = 0;
            for (int i = 0; i < m_BoxContainerThree.childCount; i++)
            {
                if (i < SelectCaseRequestListThree.Count)
                {
                    TopAnimationPlay topAnimationPlay = m_BoxContainerThree.GetChild(i).GetComponent<TopAnimationPlay>();
                    if (!SelectCaseRequestListThree[i].IsNagaaki)
                    {
                        yield return new WaitForSeconds(LatencyTimeList[type]);
                        type += 1;
                    }
                    topAnimationPlay.FadeOut();
                }
            }
        }
        IEnumerator FadeInTop()
        {
            int type = 0;
            for (int i = 0; i < m_BoxContainerTranTop.childCount; i++)
            {
                if (i < SelectCaseRequestListTop.Count)
                {
                    TopAnimationPlay topAnimationPlay = m_BoxContainerTranTop.GetChild(i).GetComponent<TopAnimationPlay>();
                    if (!SelectCaseRequestListTop[i].IsNagaaki)
                    {
                        yield return new WaitForSeconds(LatencyTimeList[type]);
                        type += 1;
                    }
                    topAnimationPlay.FadeIn();
                }
            }
        }
        IEnumerator FadeInLow()
        {
            int type = 0;
            for (int i = 0; i < m_BoxContainerTranLow.childCount; i++)
            {
                if (i < SelectCaseRequestListLow.Count)
                {
                    TopAnimationPlay topAnimationPlay = m_BoxContainerTranLow.GetChild(i).GetComponent<TopAnimationPlay>();
                    if (!SelectCaseRequestListLow[i].IsNagaaki)
                    {
                        yield return new WaitForSeconds(LatencyTimeList[type]);
                        type += 1;
                    }
                    topAnimationPlay.FadeIn();
                }
            }
        }
        IEnumerator FadeInThree()
        {
            int type = 0;
            for (int i = 0; i < m_BoxContainerThree.childCount; i++)
            {
                if (i < SelectCaseRequestListThree.Count)
                {
                    TopAnimationPlay topAnimationPlay = m_BoxContainerThree.GetChild(i).GetComponent<TopAnimationPlay>();
                    if (!SelectCaseRequestListThree[i].IsNagaaki)
                    {
                        yield return new WaitForSeconds(LatencyTimeList[type]);
                        type += 1;
                    }
                    topAnimationPlay.FadeIn();
                }
            }
        }
        public void PositionNow()//立即出现
        {
            for (int i = 0; i < m_BoxContainerTranTop.childCount; i++)//1
            {
                TopAnimationPlay topAnimationPlay = m_BoxContainerTranTop.GetChild(i).GetComponent<TopAnimationPlay>();
                topAnimationPlay.PositionNow();
            }
            for (int i = 0; i < m_BoxContainerTranLow.childCount; i++)//2
            {
                TopAnimationPlay topAnimationPlay = m_BoxContainerTranLow.GetChild(i).GetComponent<TopAnimationPlay>();
                topAnimationPlay.PositionNow();
            }
            for (int i = 0; i < m_BoxContainerThree.childCount; i++)//3
            {
                TopAnimationPlay topAnimationPlay = m_BoxContainerThree.GetChild(i).GetComponent<TopAnimationPlay>();
                topAnimationPlay.PositionNow();
            }
        }
        public void PositionDel()//立即消失
        {
            for (int i = 0; i < m_BoxContainerTranTop.childCount; i++)//1
            {
                if (i < SelectCaseRequestListTop.Count)
                {
                    TopAnimationPlay topAnimationPlay = m_BoxContainerTranTop.GetChild(i).GetComponent<TopAnimationPlay>();
                    topAnimationPlay.ImmediatelyDisappear();
                }
            }
            for (int i = 0; i < m_BoxContainerTranLow.childCount; i++)//2
            {
                if (i < SelectCaseRequestListLow.Count)
                {
                    TopAnimationPlay topAnimationPlay = m_BoxContainerTranLow.GetChild(i).GetComponent<TopAnimationPlay>();
                    topAnimationPlay.ImmediatelyDisappear();
                }
            }
            for (int i = 0; i < m_BoxContainerThree.childCount; i++)//3
            {
                if (i < SelectCaseRequestListThree.Count)
                {
                    TopAnimationPlay topAnimationPlay = m_BoxContainerThree.GetChild(i).GetComponent<TopAnimationPlay>();
                    topAnimationPlay.ImmediatelyDisappear();
                }
            }
        }
        public bool GetIsFadeIn()//判断是否淡入
        {
            for (int i = 0; i < m_BoxContainerTranTop.childCount; i++)
            {
                if (i < SelectCaseRequestListTop.Count)
                {
                    TopAnimationPlay topAnimationPlay = m_BoxContainerTranTop.GetChild(i).GetComponent<TopAnimationPlay>();
                    if (!topAnimationPlay.IsplayAnimator)
                    {
                        continue;
                    }
                    if (topAnimationPlay.CanvasGroup.alpha > 0.3)
                    {
                        return true;
                    }
                }
            }
            for (int i = 0; i < m_BoxContainerTranLow.childCount; i++)
            {
                if (i < SelectCaseRequestListLow.Count)
                {
                    TopAnimationPlay topAnimationPlay = m_BoxContainerTranLow.GetChild(i).GetComponent<TopAnimationPlay>();
                    if (!topAnimationPlay.IsplayAnimator)
                    {
                        continue;
                    }
                    if (topAnimationPlay.CanvasGroup.alpha > 0.3)
                    {
                        return true;
                    }
                }
            }
            for (int i = 0; i < m_BoxContainerThree.childCount; i++)
            {
                if (i < SelectCaseRequestListThree.Count)
                {
                    TopAnimationPlay topAnimationPlay = m_BoxContainerThree.GetChild(i).GetComponent<TopAnimationPlay>();
                    if (!topAnimationPlay.IsplayAnimator)
                    {
                        continue;
                    }
                    if (topAnimationPlay.CanvasGroup.alpha > 0.3)
                    {
                        return true;
                    }
                }
            }
            return false;
        }
        private void Classify()
        {
            PositionNow();
            PositionReduction();
            SetGroupTop();
            SetGroupLow();
            SetfatherNodeTop();
            SetfatherNodeLow();
            SetfatherNodeThree();
        }
        private void SetGroupTop()//上层分组
        {
            AnimationFadeOutDicTop.Clear();
            for (int i = 0; i < m_GroupIndex_Top.childCount; i++)
            {
                HighBtnRecord highBtnRecord = m_GroupIndex_Top.GetChild(i).GetComponent<HighBtnRecord>();
                if (m_GroupIndex_Top.GetChild(i).GetComponent<UIFuncOpen>() != null)
                {
                    if (!FuncOpen.Instance.IsFuncOpen(m_GroupIndex_Top.GetChild(i).GetComponent<UIFuncOpen>().id))
                    {
                        if (highBtnRecord.IsBool && !AnimationFadeOutDicTop.ContainsKey(highBtnRecord.Index))
                        {
                            SelectCaseRequest selectCaseRequest = new SelectCaseRequest();
                            selectCaseRequest.Tran = m_GroupIndex_Top.GetChild(i);
                            selectCaseRequest.IsNagaaki = highBtnRecord.IsNagaaki;
                            selectCaseRequest.Index = highBtnRecord.Index;
                            AnimationFadeOutDicTop.Add(highBtnRecord.Index, selectCaseRequest);
                        }
                    }
                    else
                    {
                        if (!AnimationFadeOutDicTop.ContainsKey(highBtnRecord.Index))
                        {
                            SelectCaseRequest selectCaseRequest = new SelectCaseRequest();
                            selectCaseRequest.Tran = m_GroupIndex_Top.GetChild(i);
                            selectCaseRequest.IsNagaaki = highBtnRecord.IsNagaaki;
                            selectCaseRequest.Index = highBtnRecord.Index;
                            AnimationFadeOutDicTop.Add(highBtnRecord.Index, selectCaseRequest);
                        }
                    }
                }
                else
                {
                    //if (GroupTopIndexList.Contains(highBtnRecord.Index))
                    //{
                    //    if (ModelCenter.Instance.GetModel<OSGiftModel>().activate)//超值礼包
                    //    {
                    //        if (!AnimationFadeOutDicTop.ContainsKey(highBtnRecord.Index))
                    //        {
                    //            SelectCaseRequest selectCaseRequest = new SelectCaseRequest();
                    //            selectCaseRequest.Tran = m_GroupIndex_Top.GetChild(i);
                    //            selectCaseRequest.IsNagaaki = highBtnRecord.IsNagaaki;
                    //            AnimationFadeOutDicTop.Add(highBtnRecord.Index, selectCaseRequest);
                    //        }
                    //    }
                    //}
                }
            }
        }
        private void SetGroupLow()//下层分组
        {
            AnimationFadeOutDicLow.Clear();
            AnimationFadeOutDicThree.Clear();
            for (int i = 0; i < m_GroupIndex_Low.childCount; i++)
            {
                HighBtnRecord highBtnRecord = m_GroupIndex_Low.GetChild(i).GetComponent<HighBtnRecord>();
                IsPlayerUIeffect isPlayerUIeffect = m_GroupIndex_Low.GetChild(i).GetComponent<IsPlayerUIeffect>();
                if (m_GroupIndex_Low.GetChild(i).GetComponent<UIFuncOpen>() != null)//有功能开启ID
                {
                    int openFucID = m_GroupIndex_Low.GetChild(i).GetComponent<UIFuncOpen>().id;
                    if (!FuncOpen.Instance.IsFuncOpen(openFucID))
                    {
                        if (highBtnRecord.IsBool && !AnimationFadeOutDicLow.ContainsKey(highBtnRecord.Index))
                        {
                            if (isPlayerUIeffect.RedPointId == 201 || isPlayerUIeffect.RedPointId == 210)
                            {
                                if (RedpointCenter.Instance.GetRedpointState(isPlayerUIeffect.RedPointId) == RedPointState.GetReward)
                                {
                                    m_GroupIndex_Low.GetChild(i).GetComponent<HighBtnRecord>().IsNagaaki = true;
                                    highBtnRecord.IsNagaaki = true;
                                }
                                else
                                {
                                    m_GroupIndex_Low.GetChild(i).GetComponent<HighBtnRecord>().IsNagaaki = false;
                                    highBtnRecord.IsNagaaki = false;
                                }
                            }
                            if (AnimationFadeOutDicLow.Count < 6)//------第二层
                            {
                                SelectCaseRequest selectCaseRequest = new SelectCaseRequest();
                                selectCaseRequest.Tran = m_GroupIndex_Low.GetChild(i);
                                selectCaseRequest.IsNagaaki = highBtnRecord.IsNagaaki;
                                selectCaseRequest.Index = highBtnRecord.Index;
                                AnimationFadeOutDicLow.Add(highBtnRecord.Index, selectCaseRequest);
                            }
                            else//------第三层
                            {
                                SelectCaseRequest selectCaseRequest = new SelectCaseRequest();
                                selectCaseRequest.Tran = m_GroupIndex_Low.GetChild(i);
                                selectCaseRequest.IsNagaaki = highBtnRecord.IsNagaaki;
                                selectCaseRequest.Index = highBtnRecord.Index;
                                AnimationFadeOutDicThree.Add(highBtnRecord.Index, selectCaseRequest);
                            }
                        }
                    }
                    else
                    {
                        int OpenFuncID = m_GroupIndex_Low.GetChild(i).GetComponent<UIFuncOpen>().id;
                        if (OpenFuncID == 124 && FuncOpen.Instance.IsFuncOpen(124))//仙宝寻主
                        {
                            if (hostModel.CheckTreasureFindHostFinish())//仙宝寻主关闭
                            {
                                continue;
                            }
                        }
                        if (!AnimationFadeOutDicLow.ContainsKey(highBtnRecord.Index))
                        {
                            if (isPlayerUIeffect.RedPointId == 201 || isPlayerUIeffect.RedPointId == 210)
                            {
                                if (RedpointCenter.Instance.GetRedpointState(isPlayerUIeffect.RedPointId) == RedPointState.GetReward)
                                {
                                    m_GroupIndex_Low.GetChild(i).GetComponent<HighBtnRecord>().IsNagaaki = true;
                                    highBtnRecord.IsNagaaki = true;
                                }
                                else
                                {
                                    m_GroupIndex_Low.GetChild(i).GetComponent<HighBtnRecord>().IsNagaaki = false;
                                    highBtnRecord.IsNagaaki = false;
                                }
                            }
                            if (AnimationFadeOutDicLow.Count < 6)//------第二层
                            {
                                SelectCaseRequest selectCaseRequest = new SelectCaseRequest();
                                selectCaseRequest.Tran = m_GroupIndex_Low.GetChild(i);
                                selectCaseRequest.IsNagaaki = highBtnRecord.IsNagaaki;
                                selectCaseRequest.Index = highBtnRecord.Index;
                                AnimationFadeOutDicLow.Add(highBtnRecord.Index, selectCaseRequest);
                            }
                            else//------第三层
                            {
                                SelectCaseRequest selectCaseRequest = new SelectCaseRequest();
                                selectCaseRequest.Tran = m_GroupIndex_Low.GetChild(i);
                                selectCaseRequest.IsNagaaki = highBtnRecord.IsNagaaki;
                                selectCaseRequest.Index = highBtnRecord.Index;
                                AnimationFadeOutDicThree.Add(highBtnRecord.Index, selectCaseRequest);
                            }
                        }
                    }
                }
                else
                {
                    if (GroupLowIndexList.Contains(highBtnRecord.Index))
                    {
                        int IndexOf = GroupLowIndexList.IndexOf(highBtnRecord.Index);
                        if (IndexOf == 0)
                        {
                            if (!AnimationFadeOutDicLow.ContainsKey(highBtnRecord.Index) && limitedTimePackageItemModel.IsExpired())//限时礼包
                            {
                                if (AnimationFadeOutDicLow.Count < 6)//------第二层
                                {
                                    SelectCaseRequest selectCaseRequest = new SelectCaseRequest();
                                    selectCaseRequest.Tran = m_GroupIndex_Low.GetChild(i);
                                    selectCaseRequest.IsNagaaki = highBtnRecord.IsNagaaki;
                                    selectCaseRequest.Index = highBtnRecord.Index;
                                    AnimationFadeOutDicLow.Add(highBtnRecord.Index, selectCaseRequest);
                                }
                                else//------第三层
                                {
                                    SelectCaseRequest selectCaseRequest = new SelectCaseRequest();
                                    selectCaseRequest.Tran = m_GroupIndex_Low.GetChild(i);
                                    selectCaseRequest.IsNagaaki = highBtnRecord.IsNagaaki;
                                    selectCaseRequest.Index = highBtnRecord.Index;
                                    AnimationFadeOutDicThree.Add(highBtnRecord.Index, selectCaseRequest);
                                }
                            }
                        }
                        else if (IndexOf == 1)
                        {
                            var _funcOrder = 0;
                            if (OpenServerActivityCenter.Instance.IsAnyActivityOpen(out _funcOrder))//开服活动
                            {
                                if (!AnimationFadeOutDicLow.ContainsKey(highBtnRecord.Index))
                                {
                                    if (AnimationFadeOutDicLow.Count < 6)//------第二层
                                    {
                                        SelectCaseRequest selectCaseRequest = new SelectCaseRequest();
                                        selectCaseRequest.Tran = m_GroupIndex_Low.GetChild(i);
                                        selectCaseRequest.IsNagaaki = highBtnRecord.IsNagaaki;
                                        selectCaseRequest.Index = highBtnRecord.Index;
                                        AnimationFadeOutDicLow.Add(highBtnRecord.Index, selectCaseRequest);
                                    }
                                    else//------第三层
                                    {
                                        SelectCaseRequest selectCaseRequest = new SelectCaseRequest();
                                        selectCaseRequest.Tran = m_GroupIndex_Low.GetChild(i);
                                        selectCaseRequest.IsNagaaki = highBtnRecord.IsNagaaki;
                                        selectCaseRequest.Index = highBtnRecord.Index;
                                        AnimationFadeOutDicThree.Add(highBtnRecord.Index, selectCaseRequest);
                                    }
                                }
                            }
                        }
                        else if (IndexOf == 2)
                        {
                            bool Isopen = OpenServerActivityCenter.Instance.IsActivityOpen(4);
                            if (!AnimationFadeOutDicLow.ContainsKey(highBtnRecord.Index) && Isopen)//限时特惠
                            {
                                if (AnimationFadeOutDicLow.Count < 6)//------第二层
                                {
                                    SelectCaseRequest selectCaseRequest = new SelectCaseRequest();
                                    selectCaseRequest.Tran = m_GroupIndex_Low.GetChild(i);
                                    selectCaseRequest.IsNagaaki = highBtnRecord.IsNagaaki;
                                    selectCaseRequest.Index = highBtnRecord.Index;
                                    AnimationFadeOutDicLow.Add(highBtnRecord.Index, selectCaseRequest);
                                }
                                else//------第三层
                                {
                                    SelectCaseRequest selectCaseRequest = new SelectCaseRequest();
                                    selectCaseRequest.Tran = m_GroupIndex_Low.GetChild(i);
                                    selectCaseRequest.IsNagaaki = highBtnRecord.IsNagaaki;
                                    selectCaseRequest.Index = highBtnRecord.Index;
                                    AnimationFadeOutDicThree.Add(highBtnRecord.Index, selectCaseRequest);
                                }
                            }
                        }
                        else if (IndexOf == 3)
                        {
                            bool Isopen = impactRankModel.IsInImpactRank;
                            if (!AnimationFadeOutDicLow.ContainsKey(highBtnRecord.Index) && Isopen)//全民冲榜
                            {
                                if (AnimationFadeOutDicLow.Count < 6)//------第二层
                                {
                                    SelectCaseRequest selectCaseRequest = new SelectCaseRequest();
                                    selectCaseRequest.Tran = m_GroupIndex_Low.GetChild(i);
                                    selectCaseRequest.IsNagaaki = highBtnRecord.IsNagaaki;
                                    selectCaseRequest.Index = highBtnRecord.Index;
                                    AnimationFadeOutDicLow.Add(highBtnRecord.Index, selectCaseRequest);
                                }
                                else//------第三层
                                {
                                    SelectCaseRequest selectCaseRequest = new SelectCaseRequest();
                                    selectCaseRequest.Tran = m_GroupIndex_Low.GetChild(i);
                                    selectCaseRequest.IsNagaaki = highBtnRecord.IsNagaaki;
                                    selectCaseRequest.Index = highBtnRecord.Index;
                                    AnimationFadeOutDicThree.Add(highBtnRecord.Index, selectCaseRequest);
                                }
                            }
                        }
                        else if (IndexOf == 4)
                        {
                            if (!AnimationFadeOutDicLow.ContainsKey(highBtnRecord.Index) && OperationTimeHepler.Instance.InOperationTime(Operation.FairyCeremony))//精灵盛典
                            {
                                if (AnimationFadeOutDicLow.Count < 6)//------第二层
                                {
                                    SelectCaseRequest selectCaseRequest = new SelectCaseRequest();
                                    selectCaseRequest.Tran = m_GroupIndex_Low.GetChild(i);
                                    selectCaseRequest.IsNagaaki = highBtnRecord.IsNagaaki;
                                    selectCaseRequest.Index = highBtnRecord.Index;
                                    AnimationFadeOutDicLow.Add(highBtnRecord.Index, selectCaseRequest);
                                }
                                else//------第三层
                                {
                                    SelectCaseRequest selectCaseRequest = new SelectCaseRequest();
                                    selectCaseRequest.Tran = m_GroupIndex_Low.GetChild(i);
                                    selectCaseRequest.IsNagaaki = highBtnRecord.IsNagaaki;
                                    selectCaseRequest.Index = highBtnRecord.Index;
                                    AnimationFadeOutDicThree.Add(highBtnRecord.Index, selectCaseRequest);
                                }
                            }
                        }
                    }
                }
            }
        }
        private void PositionReduction()//还原位置(把盒子中的位置全部重新拉出来)
        {
            if (AnimationFadeOutDicTop.Count > 0)//上层
            {
                foreach (var key in AnimationFadeOutDicTop.Keys)
                {
                    AnimationFadeOutDicTop[key].Tran.SetParent(m_GroupIndex_Top);
                    AnimationFadeOutDicTop[key].Tran.SetSiblingIndex(key);
                }
            }
            if (AnimationFadeOutDicLow.Count > 0)//中间
            {
                foreach (var key in AnimationFadeOutDicLow.Keys)
                {
                    AnimationFadeOutDicLow[(AnimationFadeOutDicLow[key].Index)].Tran.SetParent(m_GroupIndex_Low);
                    AnimationFadeOutDicLow[(AnimationFadeOutDicLow[key].Index)].Tran.SetSiblingIndex((AnimationFadeOutDicLow[key].Index));
                }
            }
            if (AnimationFadeOutDicThree.Count > 0)//第三层(拉到第二层)
            {
                foreach (var key in AnimationFadeOutDicThree.Keys)
                {
                    AnimationFadeOutDicThree[(AnimationFadeOutDicThree[key].Index)].Tran.SetParent(m_GroupIndex_Low);
                    AnimationFadeOutDicThree[(AnimationFadeOutDicThree[key].Index)].Tran.SetSiblingIndex((AnimationFadeOutDicThree[key].Index));
                }
            }
        }
        private void SetfatherNodeTop()//设置父节点上层
        {
            SelectCaseRequestListTop.Clear();
            foreach (var key in AnimationFadeOutDicTop.Keys)
            {
                SelectCaseRequestListTop.Add(AnimationFadeOutDicTop[key]);
            }
            for (int i = 0; i < m_BoxContainerTranTop.childCount; i++)
            {
                int type = i;
                Transform tran = m_BoxContainerTranTop.GetChild(i);
                TopAnimationPlay topAnimationPlay = tran.GetComponent<TopAnimationPlay>();
                if (type < SelectCaseRequestListTop.Count)
                {
                    tran.gameObject.SetActive(true);
                    SelectCaseRequestListTop[type].Tran.SetParent(tran);
                    SelectCaseRequestListTop[type].Tran.localPosition = Vector3.zero;
                    topAnimationPlay.IsplayAnimator = !SelectCaseRequestListTop[type].IsNagaaki;
                }
                else
                {
                    tran.gameObject.SetActive(false);
                    topAnimationPlay.IsplayAnimator = false;
                }
            }
        }
        private void SetfatherNodeLow()//设置父节点下层
        {
            SelectCaseRequestListLow.Clear();
            foreach (var key in AnimationFadeOutDicLow.Keys)
            {
                SelectCaseRequestListLow.Add(AnimationFadeOutDicLow[key]);
            }
            SelectCaseRequestListLow.Sort(Compare);
            for (int i = 0; i < m_BoxContainerTranLow.childCount; i++)
            {
                int type = i;
                Transform tran = m_BoxContainerTranLow.GetChild(i);
                TopAnimationPlay topAnimationPlay = tran.GetComponent<TopAnimationPlay>();
                if (type < SelectCaseRequestListLow.Count)
                {
                    tran.gameObject.SetActive(true);
                    SelectCaseRequestListLow[type].Tran.SetParent(tran);
                    SelectCaseRequestListLow[type].Tran.localPosition = Vector3.zero;
                    topAnimationPlay.IsplayAnimator = !SelectCaseRequestListLow[type].IsNagaaki;
                }
                else
                {
                    tran.gameObject.SetActive(false);
                    topAnimationPlay.IsplayAnimator = false;
                }
            }
        }
        private void SetfatherNodeThree()//设置父节点第三层
        {
            SelectCaseRequestListThree.Clear();
            foreach (var key in AnimationFadeOutDicThree.Keys)
            {
                SelectCaseRequestListThree.Add(AnimationFadeOutDicThree[key]);
            }
            SelectCaseRequestListThree.Sort(Compare);
            for (int i = 0; i < m_BoxContainerThree.childCount; i++)
            {
                int type = i;
                Transform tran = m_BoxContainerThree.GetChild(i);
                TopAnimationPlay topAnimationPlay = tran.GetComponent<TopAnimationPlay>();
                if (type < SelectCaseRequestListThree.Count)
                {
                    tran.gameObject.SetActive(true);
                    SelectCaseRequestListThree[type].Tran.SetParent(tran);
                    SelectCaseRequestListThree[type].Tran.localPosition = Vector3.zero;
                    topAnimationPlay.IsplayAnimator = !SelectCaseRequestListThree[type].IsNagaaki;
                }
                else
                {
                    tran.gameObject.SetActive(false);
                    topAnimationPlay.IsplayAnimator = false;
                }
            }
        }
        int Compare(SelectCaseRequest x, SelectCaseRequest y)
        {
            bool havex = x.IsNagaaki;
            bool havey = y.IsNagaaki;
            if (havex.CompareTo(havey) != 0)
            {
                return -havex.CompareTo(havey);
            }
            if (x.Index.CompareTo(y.Index) != 0)
            {
                return x.Index.CompareTo(y.Index);
            }
            return 1;
        }
        private void OnFuncStateChange(int obj)
        {
            Classify();
        }
        public bool IsShowButton()//是否显示切换按钮
        {
            bool boolOpen = false;
            for (int i = 0; i < SelectCaseRequestListTop.Count; i++)
            {
                if (!SelectCaseRequestListTop[i].IsNagaaki)
                {
                    boolOpen = true;
                }
            }
            for (int i = 0; i < SelectCaseRequestListLow.Count; i++)
            {
                if (!SelectCaseRequestListLow[i].IsNagaaki)
                {
                    boolOpen = true;
                }
            }
            for (int i = 0; i < SelectCaseRequestListThree.Count; i++)
            {
                if (!SelectCaseRequestListThree[i].IsNagaaki)
                {
                    boolOpen = true;
                }
            }
            return boolOpen;
        }
    }
}