예제 #1
0
        public override Boolean GetModelExport(AxDrawModelMatchList drawModelModel)
        {
            drawModelModel.RemoveAll();

            if (m_oGroup.GetPlayerCnt() < 1)
            {
                return(false);
            }

            Int32 nRoundCnt = m_oGroup.GetRoundCount();

            for (Int32 nCycRound = 0; nCycRound < nRoundCnt; nCycRound++)
            {
                stRrRound pRound    = m_oGroup.GetRoundObj(nCycRound);
                Int32     nMatchCnt = pRound.GetMatchCount();
                for (Int32 nCycMatch = 0; nCycMatch < nMatchCnt; nCycMatch++)
                {
                    stRrMatch pMatch = pRound.GetMatchObj(nCycMatch);

                    AxDrawModelMatchRow MatchRow = new AxDrawModelMatchRow();
                    MatchRow.m_nLeftFromLineOrIndex  = pMatch.m_byPlayerL;
                    MatchRow.m_nRightFromLineOrIndex = pMatch.m_byPlayerR;
                    MatchRow.m_byteRoundOrder        = (Byte)(nCycRound + 1);
                    MatchRow.m_byteMatchOrder        = (Byte)(nCycMatch + 1);
                    MatchRow.m_emLayerCode           = EDrawModelLayerCode.emLayerRound_RoundRobin;

                    drawModelModel.m_aryMatchRow.Add(MatchRow);
                }
            }

            return(true);
        }
예제 #2
0
        //利用DrawInfo信息,创建一个结构

        protected static AxDrawModelMatchList _CreateModelSingle(AxDrawModelInfo DrawInfo)
        {
            AxDrawModelMatchList retModel = new AxDrawModelMatchList();

            if (DrawInfo.m_eType == EDrawModelType.emTypeManual)
            {
                return(retModel);
            }
            else if (DrawInfo.m_eType == EDrawModelType.emTypeRoundRobin)
            {
                AxModelRoundRobin roundRobin = new AxModelRoundRobin();
                if (!roundRobin.Create(DrawInfo.m_nSize, DrawInfo.m_bBogol))
                {
                    retModel.RemoveAll();
                    return(retModel);
                }

                if (!roundRobin.GetModelExport(retModel))
                {
                    retModel.RemoveAll();
                    return(retModel);
                }

                return(retModel);
            }
            else if (DrawInfo.m_eType == EDrawModelType.emTypeKonckOut)
            {
                AxModelKnockOut knockOut = new AxModelKnockOut();
                if (!knockOut.Create(DrawInfo.m_nSize, DrawInfo.m_nRank, false))
                {
                    retModel.RemoveAll();
                    return(retModel);
                }

                if (!knockOut.GetModelExport(retModel))
                {
                    retModel.RemoveAll();
                    return(retModel);
                }

                return(retModel);
            }
            else
            {
                return(retModel);
            }
        }
예제 #3
0
        public override Boolean GetModelExport(AxDrawModelMatchList drawModelModel)
        {
            drawModelModel.RemoveAll();
            Int32 nPyramidCnt = m_oEvent.GetPyramidCount();

            if (nPyramidCnt < 1)
            {
                return(false);
            }

            //填入源信息时底层的需要排序位置
            Int32 nPosIndex = 0;        //来自人员的顺序ID
            //AryKoStartPos aryPos;	//来自人员序列
            ArrayList aryPos = new ArrayList();

            GetStartPos(m_oEvent.GetLayerCount(), aryPos);

            //1. 先循环一次,把所有比赛加入队列, 这样我们内存的结构里,就有了Match的RowNumber
            for (Int32 nPyramid = 0; nPyramid < nPyramidCnt; nPyramid++)
            {
                stKoPyramid pPrramid  = m_oEvent.GetPyramidObj(nPyramid);
                Int32       nLayerCnt = pPrramid.GetLayerCount();

                for (Int32 nLayer = nLayerCnt - 1; nLayer >= 0; nLayer--)
                {
                    stKoLayer pLayer   = pPrramid.GetLayerObj(nLayer);
                    Int32     nNodeCnt = pLayer.GetNodeCount();

                    for (Int32 nNode = 0; nNode < nNodeCnt; nNode++)
                    {
                        stKoMatchNode pNode = pLayer.GetNodeObj(nNode);

                        AxDrawModelMatchRow matchInfo = new AxDrawModelMatchRow();
                        matchInfo.m_byteRoundOrder = (Byte)(nLayerCnt - nLayer + nPyramid * 10);
                        matchInfo.m_strMatchDesc   = String.Format("{0:D}-{1:D}-{2:D}", nPyramid + 1, nLayer + 1, nNode + 1);

                        //将此场比赛添加到列表后,会返还行号,正好填给内存中的塔
                        drawModelModel.m_aryMatchRow.Add(matchInfo);
                        Int32 nCurNodeRowInMatchList = drawModelModel.m_aryMatchRow.Count - 1;
                        pNode.m_nRowTemp = nCurNodeRowInMatchList;
                    }
                }
            }

            //2.再循环一次,把目标和源填入
            for (Int32 nPyramid = 0; nPyramid < nPyramidCnt; nPyramid++)
            {
                stKoPyramid pPyramid  = m_oEvent.GetPyramidObj(nPyramid);
                Int32       nLayerCnt = pPyramid.GetLayerCount();

                for (Int32 nLayer = 0; nLayer < nLayerCnt; nLayer++)
                {
                    stKoLayer pLayer   = pPyramid.GetLayerObj(nLayer);
                    Int32     nNodeCnt = pLayer.GetNodeCount();

                    for (Int32 nNode = 0; nNode < nNodeCnt; nNode++)
                    {
                        stKoMatchNode       pNode            = pLayer.GetNodeObj(nNode);
                        AxDrawModelMatchRow pMatchInfoInList = drawModelModel.m_aryMatchRow[pNode.m_nRowTemp];


                        //1.轮次信息
                        {
                            if (nPyramid == 0) //第一个塔里的结构就是从金牌赛往下顺
                            {
                                switch (nLayer)
                                {
                                case 8: pMatchInfoInList.m_emLayerCode = EDrawModelLayerCode.emLayerRound_512to256; break;

                                case 7: pMatchInfoInList.m_emLayerCode = EDrawModelLayerCode.emLayerRound_256to128; break;

                                case 6: pMatchInfoInList.m_emLayerCode = EDrawModelLayerCode.emLayerRound_128to64; break;

                                case 5: pMatchInfoInList.m_emLayerCode = EDrawModelLayerCode.emLayerRound_64to32; break;

                                case 4: pMatchInfoInList.m_emLayerCode = EDrawModelLayerCode.emLayerRound_32to16; break;

                                case 3: pMatchInfoInList.m_emLayerCode = EDrawModelLayerCode.emLayerRound_16to8; break;

                                case 2: pMatchInfoInList.m_emLayerCode = EDrawModelLayerCode.emLayerRound_8to4; break;

                                case 1: pMatchInfoInList.m_emLayerCode = EDrawModelLayerCode.emLayerRound_4to2; break;

                                case 0: pMatchInfoInList.m_emLayerCode = EDrawModelLayerCode.emLayerRound_2to1; break;

                                default: break;
                                }
                            }
                            else if (nPyramid == 1) //第二个塔里只能有铜牌赛
                            {
                                pMatchInfoInList.m_emLayerCode = EDrawModelLayerCode.emLayerRound_34to3;
                            }
                            else if (nPyramid == 2) //第三个塔是5-8名
                            {
                                if (nLayer == 0)
                                {
                                    pMatchInfoInList.m_emLayerCode = EDrawModelLayerCode.emLayerRound_56to5;
                                }
                                else
                                {
                                    pMatchInfoInList.m_emLayerCode = EDrawModelLayerCode.emLayerRound_58to56;
                                }
                            }
                            else if (nPyramid == 3) //第四个塔是7,8名
                            {
                                pMatchInfoInList.m_emLayerCode = EDrawModelLayerCode.emLayerRound_78to7;
                            }
                        }

                        //2. 跳跃信息
                        pMatchInfoInList.m_eWinGotoKind  = pNode.m_oJumpWin.m_byJumpKind;
                        pMatchInfoInList.m_eLostGotoKind = pNode.m_oJumpLost.m_byJumpKind;

                        if (pNode.m_oJumpWin.IsJumpPos()) //是跳跃到位置,那么在金字塔中找到那Node, Node里肯定有行号,把目标行号拿到即可
                        {
                            stKoMatchNode pNodeWinGoto = m_oEvent.GetMatchObj(pNode.m_oJumpWin);
                            pMatchInfoInList.m_byWinGotoLineOrRank = pNodeWinGoto.m_nRowTemp;
                        }
                        else // 不是跳到位置,那要么是Rank,或者是Out
                        {
                            pMatchInfoInList.m_byWinGotoLineOrRank = pNode.m_oJumpWin.m_byPyramindIndexOrRank;
                        }

                        if (pNode.m_oJumpLost.IsJumpPos())
                        {
                            stKoMatchNode pNodeLostGoto = m_oEvent.GetMatchObj(pNode.m_oJumpLost);
                            pMatchInfoInList.m_byLostGotoLineOrRank = pNodeLostGoto.m_nRowTemp;
                        }
                        else
                        {
                            pMatchInfoInList.m_byLostGotoLineOrRank = pNode.m_oJumpLost.m_byPyramindIndexOrRank;
                        }


                        //3. 来源信息
                        stKoJumpInfo JumpThisInfo = new stKoJumpInfo();
                        JumpThisInfo.SetJumpToPointer((Byte)nPyramid, (Byte)nLayer, (Byte)nNode, false); //本Node的Jump坐标
                        {
                            //左来源
                            stKoJumpInfo jumpFromLeft = m_oEvent.GetMatchPlayerFrom(JumpThisInfo, true);
                            if (jumpFromLeft.IsJumpAsPointer()) //从其他地方来的
                            {
                                stKoMatchNode pNodeLeftFrom = m_oEvent.GetMatchObj(jumpFromLeft);
                                pMatchInfoInList.m_eLeftFromKind        = jumpFromLeft.m_byIsWin ? EKnockOutFromKind.emKoFromWin : EKnockOutFromKind.emKoFromLost;
                                pMatchInfoInList.m_nLeftFromLineOrIndex = pNodeLeftFrom.m_nRowTemp;
                            }
                            else //最底层的
                            {
                                pMatchInfoInList.m_eLeftFromKind        = EKnockOutFromKind.emKoFromInit;
                                pMatchInfoInList.m_nLeftFromLineOrIndex = Convert.ToInt32(aryPos[nPosIndex++]);
                            }

                            //右来源
                            stKoJumpInfo jumpFromRight = m_oEvent.GetMatchPlayerFrom(JumpThisInfo, false);
                            if (jumpFromRight.IsJumpAsPointer())
                            {
                                stKoMatchNode pNodeRightFrom = m_oEvent.GetMatchObj(jumpFromRight);
                                pMatchInfoInList.m_eRightFromKind        = jumpFromRight.m_byIsWin ? EKnockOutFromKind.emKoFromWin : EKnockOutFromKind.emKoFromLost;
                                pMatchInfoInList.m_nRightFromLineOrIndex = pNodeRightFrom.m_nRowTemp;
                            }
                            else
                            {
                                pMatchInfoInList.m_eRightFromKind        = EKnockOutFromKind.emKoFromInit;
                                pMatchInfoInList.m_nRightFromLineOrIndex = Convert.ToInt32(aryPos[nPosIndex++]);
                            }
                        }
                    } //For Node
                }     //For layer
            }         //For Pyramid

            return(true);
        }