public void SetData(legendcup_kininfo kinInfo)
        {
            KinName.text  = kinInfo.szKinName;
            KinName.color = UDefines.CommomColor(ECommonColor.ECC_White);
            if (LogicDataCenter.legendCupDataManager.CheckIsSelfInCompetitionMember(kinInfo.nKinID))
            {
                KinName.color = UDefines.CommomColor(ECommonColor.ECC_Gold1);
            }

            // 添加右键弹窗
            KinName.gameObject.RemoveComponent <UPopupMenuHandle>();
            UPopupMenuHandle popupMenuHandle = KinName.gameObject.AddComponent <UPopupMenuHandle>();

            if (popupMenuHandle != null)
            {
                UPopupAction popupAction = new UPopupAction();
                popupAction.Add(UPopupItemDataKinView.GetDescString(), new UPopupItemDataKinView(kinInfo.nKinID));
                popupAction.Add(UPopupItemDataCompetitionKinMemberView.GetDescString(), new UPopupItemDataCompetitionKinMemberView(kinInfo.nKinID));

                popupMenuHandle.HandlePopupAction = popupAction;
            }
        }
Exemple #2
0
        public void OnShowGroupWnd(long nCupID)
        {
            m_LegendCupID = nCupID;
            SingleCompetitionInfo competitionInfo = LogicDataCenter.legendCupDataManager.GetSingleCompetitionInfo(m_LegendCupID);

            if (competitionInfo == null)
            {
                return;
            }
            cmd_legendcup_recv_cuplist_node cupBaseData = LogicDataCenter.legendCupDataManager.GetSingleLegendCupNode(m_LegendCupID);

            if (cupBaseData.nLegendCupID == 0)
            {
                return;
            }

            // 数据赋值部分
            SysTitleDes.text = cupBaseData.szCupName;
            CreaterDes.gameObject.SetActive(!String.IsNullOrEmpty(cupBaseData.szCreateActorName));
            CreaterDes.text       = string.Format("举办人:{0}", cupBaseData.szCreateActorName);
            CompetitionBonus.text = ULocalizationService.Instance.Get("UIView", "LegendCupGroup", "CompetitionBonus") + ":" + cupBaseData.nCompetitionBonus;
            m_RoundID             = competitionInfo.headInfo.nRoundID;
            TitleDes.text         = cupBaseData.szCupName;
            KinNum.text           = cupBaseData.nCurrentKinNum + "/" + cupBaseData.nMaxKinNum;
            itemList = new List <UListItemLegendCupGroup>(competitionInfo.headInfo.nGroupCount);
            for (int i = 0; i < competitionInfo.headInfo.nGroupCount; i++)
            {
                UListItemLegendCupGroup item = new UListItemLegendCupGroup();
                item.nLegendCupID = nCupID;
                if (i >= 0 && i < m_GroupIndex.Count)
                {
                    item.strGroupIndex = m_GroupIndex[i];
                }
                item.kinInfoList = new List <legendcup_kininfo>();
                for (int j = 0; j < competitionInfo.headInfo.nGroupMaxKin; j++)
                {
                    legendcup_kininfo info = new legendcup_kininfo();
                    info.nKinID    = competitionInfo.headInfo.kinInfos[i * competitionInfo.headInfo.nGroupMaxKin + j].nKinID;
                    info.szKinName = competitionInfo.headInfo.kinInfos[i * competitionInfo.headInfo.nGroupMaxKin + j].szKinName;
                    item.kinInfoList.Add(info);
                }
                item.competitionNodeList = new List <cmd_legendcup_recv_competition_node>();
                foreach (cmd_legendcup_recv_competition_node node in competitionInfo.nodeInfo)
                {
                    if (node.nRoundID == competitionInfo.headInfo.nRoundID && node.nGroupID == (i + 1))
                    {
                        item.competitionNodeList.Add(node);
                    }
                }
                itemList.Add(item);
            }

            LegendCupGroupList.onDoubleClick.RemoveListener(OnDoubleClickGroupItem);
            LegendCupGroupList.OnSelect.RemoveListener(OnSelectCupGroupItem);
            LegendCupGroupList.DataSource.Clear();
            ObservableList <UListItemLegendCupGroup> dataSource = new ObservableList <UListItemLegendCupGroup>();

            foreach (UListItemLegendCupGroup item in itemList)
            {
                dataSource.Add(item);
            }

            LegendCupGroupList.DataSource = dataSource;
            LegendCupGroupList.OnSelect.AddListener(OnSelectCupGroupItem);
            LegendCupGroupList.onDoubleClick.AddListener(OnDoubleClickGroupItem);

            // 状态
            string strMonth      = ULocalizationService.Instance.Get("UIView", "LegendCupSmallKnockout", "Month");
            string strDay        = ULocalizationService.Instance.Get("UIView", "LegendCupSmallKnockout", "Day");
            int    nRoundEndTime = 0;

            if (competitionInfo.roundInfo.Count > m_RoundID - 1)
            {
                nRoundEndTime = competitionInfo.roundInfo[m_RoundID - 1].nRoundEndTime;
            }
            DateTime roundEndTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Unspecified).AddSeconds(nRoundEndTime);

            roundEndTime       = roundEndTime.ToLocalTime();
            RoundTimeDesc.text = String.Format("{0}:{1}{2}{3}{4}{5:D2}:{6:D2}", ULocalizationService.Instance.Get("UIView", "LegendCupGroup", "GroupEndTime"), roundEndTime.Month, strMonth, roundEndTime.Day, strDay, roundEndTime.Hour, roundEndTime.Minute);

            foreach (var item1 in competitionInfo.nodeInfo)
            {
                if (LogicDataCenter.legendCupDataManager.CheckIsSelfInCompetitionMember(item1.nKin1ID) || LogicDataCenter.legendCupDataManager.CheckIsSelfInCompetitionMember(item1.nKin2ID))
                {
                    if (item1.byCompetitionNodeState <= (int)ECompetitionNodeState.emNodeState_Competition)//进行中
                    {
                        DateTime enterTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Unspecified).AddSeconds(item1.nEnterTime);
                        enterTime = enterTime.ToLocalTime();
                        DateTime beginTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Unspecified).AddSeconds(item1.nBeginTime);
                        beginTime          = beginTime.ToLocalTime();
                        RoundTimeDesc.text = ULocalizationService.Instance.Get("UIView", "LegendCupSmallKnockout", "YourNextCup") +
                                             enterTime.Month + strMonth + enterTime.Day + strDay +
                                             String.Format("{0:D2}:{1:D2} - {2:D2}:{3:D2}", enterTime.Hour, enterTime.Minute, beginTime.Hour, beginTime.Minute);
                        break;
                    }
                }
            }

            // 按钮
            GotoBtn.interactable = false;
            GotoBtnDes.color     = UDefines.CommomColor(ECommonColor.ECC_Gray);

            CatchBtnEffect.color = Color.clear;
            if (CatchBtnEffectSequence != null)
            {
                CatchBtnEffectSequence.Kill(true);
            }

            foreach (var item2 in competitionInfo.nodeInfo)
            {
                if (LogicDataCenter.legendCupDataManager.CheckIsSelfInCompetitionMember(item2.nKin1ID) || LogicDataCenter.legendCupDataManager.CheckIsSelfInCompetitionMember(item2.nKin2ID))
                {
                    if (item2.byCompetitionNodeState == (byte)ECompetitionNodeState.emNodeState_CanEnter)
                    {
                        GotoBtn.interactable = true;
                        GotoBtnDes.color     = UDefines.CommomColor(ECommonColor.ECC_White);
                        m_GotoSearchID       = item2.nSearchID;

                        Color baseColor = Color.white;
                        baseColor.a            = 0f;
                        CatchBtnEffect.color   = baseColor;
                        CatchBtnEffectSequence = DOTween.Sequence();
                        CatchBtnEffectSequence.Append(DOTween.ToAlpha(() => CatchBtnEffect.color, x => CatchBtnEffect.color = x, 1f, 0.5f));
                        CatchBtnEffectSequence.Append(DOTween.ToAlpha(() => CatchBtnEffect.color, x => CatchBtnEffect.color = x, 0f, 0.5f).SetDelay(0.2f));
                        CatchBtnEffectSequence.SetLoops(-1, LoopType.Restart);
                        CatchBtnEffectSequence.OnKill(() => CatchBtnEffectSequence = null);

                        DateTime beginTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Unspecified).AddSeconds(item2.nBeginTime);
                        beginTime          = beginTime.ToLocalTime();
                        RoundTimeDesc.text = String.Format(ULocalizationService.Instance.Get("UIView", "LegendCupSmallKnockout", "NodeCanEnter"), beginTime.Hour, beginTime.Minute);

                        break;
                    }
                }
            }
        }