예제 #1
0
        public void UpdateCupCompetitionInfo(IntPtr ptrParam, int nPtrLen)
        {
            IntPtrVaArgParseHelper helper            = new IntPtrVaArgParseHelper(ptrParam, nPtrLen);
            long llegendCupId                        = helper.get <long>();
            cmd_legendcup_recv_competition_node node = helper.get <cmd_legendcup_recv_competition_node>();

            // 自己战队dida相关
            if (!(CheckIsSelfInCompetitionMember(node.nKin1ID) == false && CheckIsSelfInCompetitionMember(node.nKin2ID) == false))
            {
                bool bDida = (node.byCompetitionNodeState == (byte)ECompetitionNodeState.emNodeState_CanEnter);
                SetLegendCupDIDA(bDida, llegendCupId, node.nRoundID, node.nSearchID);
            }

            // 更新节点信息
            cmd_legendcup_recv_cuplist_node cupBaseData = LogicDataCenter.legendCupDataManager.GetSingleLegendCupNode(llegendCupId);

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

            if (!m_legendCupCompetitionDic.ContainsKey(llegendCupId))
            {
                return;
            }
            SingleCompetitionInfo competitionInfo = m_legendCupCompetitionDic[llegendCupId];

            if (competitionInfo == null || competitionInfo.nodeInfo == null)
            {
                return;
            }

            for (int i = 0; i < competitionInfo.nodeInfo.Count; i++)
            {
                if (competitionInfo.nodeInfo[i].nSearchID == node.nSearchID)
                {
                    competitionInfo.nodeInfo[i] = node;
                    break;
                }
            }

            // 通知相应界面
            LegendCupIDData uiData = new LegendCupIDData();

            uiData.nLegendCupID = competitionInfo.headInfo.nLegendCupID;
            if (competitionInfo.headInfo.byCompetitionType == (int)ERoundCompetitionType.emType_GroupCompetition)
            {
                UISystem.Instance.SendWndMessage(WndMsgID.WND_MSG_LEGENDCUP_GROUP_UPDATE, uiData);
            }
            else if (competitionInfo.headInfo.byCompetitionType == (int)ERoundCompetitionType.emType_KnockoutCompetition)
            {
                // 大淘汰赛、小淘汰赛界面合并
                UISystem.Instance.SendWndMessage(WndMsgID.WND_MSG_LEGENDCUP_SMALLKNOCKOUT_UPDATE, uiData);
            }
        }
예제 #2
0
        public void RecvCupCompetitionInfo(IntPtr ptrParam, int nPtrLen)
        {
            IntPtrVaArgParseHelper helper = new IntPtrVaArgParseHelper(ptrParam, nPtrLen);

            cmd_legendcup_recv_competition_head head = helper.get <cmd_legendcup_recv_competition_head>();
            long nLegendCupID = head.nLegendCupID;

            if (!m_legendCupCompetitionDic.ContainsKey(nLegendCupID))
            {
                SingleCompetitionInfo info = new SingleCompetitionInfo();
                m_legendCupCompetitionDic.Add(nLegendCupID, info);
            }

            m_legendCupCompetitionDic[nLegendCupID].headInfo = head;

            // 时间不从这里获取,改为单独下发RecvCupCompetitionAllRoundTime()
            //m_legendCupCompetition.roundInfo = new List<cmd_legendcup_recv_competition_roundinfo>();
            for (int i = 0; i < head.nRoundID; i++)
            {
                cmd_legendcup_recv_competition_roundinfo roundData = helper.get <cmd_legendcup_recv_competition_roundinfo>();
                //m_legendCupCompetition.roundInfo.Add(roundData);
            }
            m_legendCupCompetitionDic[nLegendCupID].nodeInfo = new List <cmd_legendcup_recv_competition_node>();
            for (int i = 0; i < head.nCompetitionNodeCount; ++i)
            {
                cmd_legendcup_recv_competition_node nodeData = helper.get <cmd_legendcup_recv_competition_node>();
                m_legendCupCompetitionDic[nLegendCupID].nodeInfo.Add(nodeData);
            }

            // 通知相应界面
            LegendCupIDData uiData = new LegendCupIDData();

            uiData.nLegendCupID = nLegendCupID;
            if (head.byCompetitionType == (int)ERoundCompetitionType.emType_GroupCompetition)
            {
                UISystem.Instance.SendWndMessage(WndMsgID.WND_MSG_LEGENDCUP_GROUP_SHOW, uiData);
            }
            else if (head.byCompetitionType == (int)ERoundCompetitionType.emType_KnockoutCompetition)
            {
                // 大淘汰赛、小淘汰赛界面合并
                UISystem.Instance.SendWndMessage(WndMsgID.WND_MSG_LEGENDCUP_SMALLKNOCKOUT_SHOW, uiData);
            }
        }
예제 #3
0
        public void SetData(long nCupID, cmd_legendcup_recv_competition_node nodeInfo, int nNodeType)
        {
            m_legendCupID = nCupID;
            m_roundID     = nodeInfo.nRoundID;
            m_searchID    = nodeInfo.nSearchID;
            m_nodeInfo    = nodeInfo;

            bInThisNode = LogicDataCenter.legendCupDataManager.CheckIsSelfInCompetitionMember(nodeInfo.nKin1ID) || LogicDataCenter.legendCupDataManager.CheckIsSelfInCompetitionMember(nodeInfo.nKin2ID);

            cmd_legendcup_recv_cuplist_node cupBaseData = LogicDataCenter.legendCupDataManager.GetSingleLegendCupNode(m_legendCupID);

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

            // 基本设置
            ViewItem.SetActive(true);
            BgIcon.raycastTarget = true;
            DateTime enterTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Unspecified).AddSeconds(nodeInfo.nEnterTime);

            enterTime = enterTime.ToLocalTime();
            DateTime beginTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Unspecified).AddSeconds(nodeInfo.nBeginTime);

            beginTime     = beginTime.ToLocalTime();
            Data.text     = enterTime.Month.ToString("D2") + strMonth + enterTime.Day.ToString("D2") + strDay;
            Time.text     = String.Format("{0:D2}:{1:D2} - {2:D2}:{3:D2}", enterTime.Hour, enterTime.Minute, beginTime.Hour, beginTime.Minute);
            Kin1Name.text = nodeInfo.szKin1Name;
            VSDes.text    = "VS";
            Kin2Name.text = nodeInfo.szKin2Name;
            //GotoBtnDes.text = strGotoBtn;

            // 考虑到排版,只改变透明度不隐藏,弃权的不显示比分
            bool bKin1Win = nodeInfo.nKin1ID == nodeInfo.nWinnerKinID && nodeInfo.nKin1Score > nodeInfo.nKin2Score;
            bool bKin2Win = nodeInfo.nKin2ID == nodeInfo.nWinnerKinID && nodeInfo.nKin2Score > nodeInfo.nKin1Score;

            Kin1WinIcon.color = bKin1Win ? new Color(1, 1, 1, 1) : new Color(1, 1, 1, 0);
            Kin2WinIcon.color = bKin2Win ? new Color(1, 1, 1, 1) : new Color(1, 1, 1, 0);

            // 设置GotoBtn
            //bool bCanJoin = bInThisNode && (nodeInfo.byCompetitionNodeState == (byte)ECompetitionNodeState.emNodeState_CanEnter);
            //Color clr = new Color();
            //if (bCanJoin)
            //{
            //    SetEnterBtnState(true);
            //    ColorUtility.TryParseHtmlString("#ffffff", out clr);
            //}
            //else
            //{
            //    SetEnterBtnState(false);
            //    ColorUtility.TryParseHtmlString("#bebebe", out clr);
            //}
            //GotoBtnDes.color = clr;

            // 设置NodeState
            NodeState.gameObject.SetActive(true);
            switch (nodeInfo.byCompetitionNodeState)
            {
            case (byte)ECompetitionNodeState.emNodeState_WaitStart:    // 等待开始
            case (byte)ECompetitionNodeState.emNodeState_CanEnter:     // 等待进入
            {
                NodeState.text = ULocalizationService.Instance.Get("UIView", "LegendCupGroup", "NoCompetition");
            }
            break;

            case (byte)ECompetitionNodeState.emNodeState_Competition:    // 进行中
            {
                NodeState.text = ULocalizationService.Instance.Get("UIView", "LegendCupGroup", "Competitioning");
            }
            break;

            case (byte)ECompetitionNodeState.emNodeState_WaitJudge:    // 等待裁定
            {
                NodeState.text = ULocalizationService.Instance.Get("UIView", "LegendCupGroup", "WaitJudge");
            }
            break;

            case (byte)ECompetitionNodeState.emNodeState_End:    // 比赛已结束
            {
                NodeState.text = ULocalizationService.Instance.Get("UIView", "LegendCupGroup", "CompetitionEnd");
            }
            break;

            default:
                break;
            }

            // 设置颜色
            Color clrState = UDefines.CommomColor(ECommonColor.ECC_White);

            if (bInThisNode && nodeInfo.nWinnerKinID <= 0)
            {
                clrState = UDefines.CommomColor(ECommonColor.ECC_Gold1);
            }
            Data.color     = clrState;
            Time.color     = clrState;
            Kin1Name.color = clrState;
            VSDes.color    = clrState;
            Kin2Name.color = clrState;
            // 完成态显示红色
            NodeState.color = nodeInfo.byCompetitionNodeState == (byte)ECompetitionNodeState.emNodeState_End ? UDefines.CommomColor(ECommonColor.ECC_Red1) : clrState;
        }