Beispiel #1
0
        // 不太精确的杯赛剩余时间倒计时
        public override void Update()
        {
            base.Update();

            if (Time.unscaledTime - m_lastUpdateTime > 60.0f)
            {
                if (m_AllDataSource != null && m_AllDataSource.Count > 0)
                {
                    ObservableList <UListItemLegendCup> dataSource = new ObservableList <UListItemLegendCup>();
                    UListItemLegendCup[] temp = new UListItemLegendCup[m_AllDataSource.Count];
                    m_AllDataSource.CopyTo(temp);
                    foreach (UListItemLegendCup Item in temp)
                    {
                        UListItemLegendCup cupInfo = new UListItemLegendCup();
                        cupInfo = Item;
                        cupInfo.data.nRegistLeftTime -= 60;
                        dataSource.Add(cupInfo);
                    }

                    LegendCupList.DataSource.BeginUpdate();
                    LegendCupList.DataSource.Clear();
                    LegendCupList.DataSource = dataSource;
                    LegendCupList.DataSource.EndUpdate();
                }

                m_lastUpdateTime = Time.unscaledTime;
            }
        }
Beispiel #2
0
        public void OnRecvCupList()
        {
            // 有自身创建的杯赛才显示
            HasCreatedCupBtn.gameObject.SetActive(LogicDataCenter.legendCupDataManager.LegendCupSelfCreateNodeDic.Count > 0);
            // 有自身参加的杯赛才显示
            MyCupBtn.gameObject.SetActive(LogicDataCenter.legendCupDataManager.LegendCupSelfInNodeDic.Count > 0);

            int nSelfClanID = 0;
            int nSelfPDBID  = 0;

            if (EntityFactory.MainHeroView != null)
            {
                nSelfClanID = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_CLAN);
                nSelfPDBID  = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_ID);
            }
            bool bGMer = GameLogicAPI.bIsGM(nSelfPDBID);

            LegendCupList.OnSelect.RemoveListener(OnSelectCupItem);
            LegendCupList.onDoubleClick.RemoveListener(OnDoubleClickCupItem);
            LegendCupList.DataSource.Clear();
            List <cmd_legendcup_recv_cuplist_node> nodeList   = LogicDataCenter.legendCupDataManager.GetTotalLegendCup();
            ObservableList <UListItemLegendCup>    dataSource = new ObservableList <UListItemLegendCup>();
            int nIndex = 1;

            foreach (cmd_legendcup_recv_cuplist_node node in nodeList)
            {
                if (!bGMer && node.nClanID > 0)         // 非GM玩家排除其他联盟数据
                {
                    if (nSelfClanID <= 0 || (nSelfClanID > 0 && nSelfClanID != node.nClanID))
                    {
                        continue;
                    }
                }

                UListItemLegendCup item = new UListItemLegendCup();
                item.nIndex = nIndex;
                item.data   = node;
                dataSource.Add(item);
                nIndex++;
            }

            // 让m_AllDataSource和LegendCupList.DataSource是两份数据
            m_AllDataSource = new ObservableList <UListItemLegendCup>(dataSource);

            LegendCupList.DataSource = dataSource;
            LegendCupList.onDoubleClick.AddListener(OnDoubleClickCupItem);
            LegendCupList.OnSelect.AddListener(OnSelectCupItem);

            // 默认选中第一个,赋值前已保证列表有序
            if (LegendCupList.DataSource.Count > 0 && LegendCupList.DataSource[0].data.nLegendCupID > 0)
            {
                LegendCupList.Select(0);
            }

            // 更新刷新时间
            m_lastUpdateTime = Time.unscaledTime;
        }
Beispiel #3
0
        private void ClearSelectIcon()
        {
            if (m_CurSelectComponent != null)
            {
                m_CurSelectComponent.DefaultColoring();
            }

            m_CurSelectIndex     = -1;
            m_CurSelectItem      = null;
            m_CurSelectComponent = null;
        }
Beispiel #4
0
 public void OnSelectCupItem(int index, ListViewItem item)
 {
     m_CurSelectIndex     = index;
     m_CurSelectItem      = LegendCupList.DataSource[index];
     m_CurSelectComponent = item as UListComponentLegendCup;
 }