1. 程式人生 > >紅點提示,樹形結構

紅點提示,樹形結構

 

       //活動中心的紅點系統 初始化
       Globals.MNoticeManager.InitActiveCenter();
       GameObject redDot = _spui.BT_ActivityList.transform.Find("NEW").gameObject;
       Globals.MNoticeManager.SetFactionUI(NoticeManager.NoticeFaction.AC_All,redDot);

 勢力部分的紅點

 活動中心的紅點

 public void InitActiveCenter()
        {
            Node AC_ALl = new Node(NoticeFaction.AC_All, AllNode);
            Node AC_FirstBt = new Node(NoticeFaction.AC_FirstBt, AllNode);
            Node AC_FirstBtSubBt1 = new Node(NoticeFaction.AC_FirstBtSubBt1, AllNode);
            Node AC_FirstBtSubBt2 = new Node(NoticeFaction.AC_FirstBtSubBt2, AllNode);
            Node AC_FirstBtSubBt3 = new Node(NoticeFaction.AC_FirstBtSubBt3, AllNode);
            Node AC_OneYuan = new Node(NoticeFaction.AC_OneYuan, AllNode);
            Node AC_OnlineGift = new Node(NoticeFaction.AC_OnLineGift, AllNode);
            Node AC_Recharge = new Node(NoticeFaction.AC_Recharge, AllNode);
            Node AC_ContinueCharge = new Node(NoticeFaction.AC_ContinueCharge, AllNode);
            Node AC_BulletAcquire = new Node(NoticeFaction.AC_BulletAcquire, AllNode);
            Node AC_AccumulatedExpend = new Node(NoticeFaction.AC_AccumulatedExpend, AllNode);
            Node AC_ExchangeMarket = new Node(NoticeFaction.AC_ExchangeMarket, AllNode);
            AC_ALl.AddChild(AC_FirstBt);
            AC_FirstBt.AddChild(AC_FirstBtSubBt1);
            AC_FirstBt.AddChild(AC_FirstBtSubBt2);
            AC_FirstBt.AddChild(AC_FirstBtSubBt3);
            AC_ALl.AddChild(AC_OneYuan);
            AC_ALl.AddChild(AC_OnlineGift);
            AC_ALl.AddChild(AC_Recharge);
            AC_ALl.AddChild(AC_ContinueCharge);
            AC_ALl.AddChild(AC_BulletAcquire);
            AC_ALl.AddChild(AC_AccumulatedExpend);
            AC_ALl.AddChild(AC_ExchangeMarket);
        }

 

        public void CheckActivityCenterAll()
        {
            CheckTaskOne();
            CheckTaskTwo();
            CheckTaskThree();
            CheckOneYuan();
            CheckReCharge();
            CheckOnlineGift();
            CheckContinueCharge();
            CheckBulletAcquire();
            CheckAccumulatedExpend();
            CheckExchangeMarket();
        }
        //線上時間禮包的紅點
        public void CheckOnlineGift()
        {
            long time = (Globals.MTimeManager.ServerLongTimeNow() - PlayerData.Instance.OnlineGiftData.ServerTime) +
                        PlayerData.Instance.OnlineGiftData.Seconds;

            bool val = false;
            var vals = PlayerData.Instance.OnlineGiftData.AllTask.Values;
            foreach (var it in vals)
            {
                if (it.BtState != 1 && it.TimeLimit <= time)
                {
                    val = true;
                    break;
                }
            }
            SetFactionNoticeValue(NoticeFaction.AC_OnLineGift, val);
        }
        public void SetFactionNoticeValue(NoticeFaction key, bool value)
        {
            AllNode[key].SetVaule(value);
        }
            public void SetVaule(bool value)
            {
                localValue = value;
                Update();
            }
            public void Update()
            {
                thisNodeValue = localValue;
                if (localValue == false)
                {
                    foreach (var i in NextNode.Values)
                    {
                        if (i.thisNodeValue)
                        {
                            thisNodeValue = true;
                            break;
                        }
                    }
                }
                UpdateUI();
                if (this.Parent != null)
                {
                    this.Parent.Update();
                }
            }