Example #1
0
        /************************************************************************/
        /* 基本処理                                                             */
        /************************************************************************/

        /// <summary>
        /// トップポイントを生成する
        /// </summary>
        /// <returns>トップポイントチェッカー</returns>
        public static VersusPointChecker CreateTopPoint()
        {
            var checker = new VersusPointChecker();

            checker.mPath  = "Top";
            checker.mDepth = -1;
            return(checker);
        }
Example #2
0
        /************************************************************************/
        /* コールバック処理                                                     */
        /************************************************************************/

        /************************************************************************/
        /* 内部処理                                                             */
        /************************************************************************/

        //============================================================================
        //! ポイント作成
        private void _CreatePointChecker()
        {
            //深度計算
            var btl_Manager = BattleOperatorManager.GetInstance();
            int join_Val    = btl_Manager.IsTeamBattleFlg() ? btl_Manager.GetTeamVal() : btl_Manager.GetJoinMemberVal();
            int depth       = 0;

            while (true)
            {
                int val = (int)Math.Pow(2, (int)depth);
                if (val >= join_Val)
                {
                    break;
                }
                ++depth;
            }

            //ポイント作成
            var top          = VersusPointChecker.CreateTopPoint();
            var root         = top.CreateRootPoint();
            var checker_List = new List <VersusPointChecker>();

            checker_List.Add(root);
            foreach (int iIndex in System.Linq.Enumerable.Range(0, depth))
            {
                var create_Point_List = new List <VersusPointChecker>();
                foreach (var iPoint in checker_List)
                {
                    var new_Points = iPoint.CreateSourceConnectPoint();
                    create_Point_List.AddRange(new_Points);
                }
                checker_List = create_Point_List;
            }

            //足りないチーム数分だけ後ろからシードとする(片側か両側かで少し分ける?)
            var root_Val = checker_List.Count;

            foreach (var iIndex in System.Linq.Enumerable.Range(0, root_Val - join_Val))
            {
                var remove_Index = 0;
                if (iIndex % 2 == 0)
                {
                    remove_Index = root_Val - iIndex - 2;
                }
                else
                {
                    remove_Index = iIndex;
                }

                checker_List[remove_Index].DisConnect();
            }

            //設定
            MainControl.Initialize(top);
        }
Example #3
0
 /// <summary>
 /// このポイントに接続される新規シードを作成して返す
 /// </summary>
 /// <returns></returns>
 public VersusPointChecker[] CreateSourceConnectPoint()
 {
     mSrcConnectionPointList[0]        = new VersusPointChecker();
     mSrcConnectionPointList[0].mDepth = mDepth + 1;
     mSrcConnectionPointList[0].mPath  = mPath + "_Up";
     mSrcConnectionPointList[0].SetDestConnectionPoint(this);
     mSrcConnectionPointList[1]        = new VersusPointChecker();
     mSrcConnectionPointList[1].mDepth = mDepth + 1;
     mSrcConnectionPointList[1].mPath  = mPath + "_Down";
     mSrcConnectionPointList[1].SetDestConnectionPoint(this);
     return(GetSrcConnectPoint());
 }
Example #4
0
 /// <summary>
 /// 入力元シードに指定されたシードが存在する時リプレース依頼のシードに付け替える
 /// </summary>
 /// <param name="iCurrentPoint"></param>
 /// <param name="iReplacePoint"></param>
 public void ReplacePoint(VersusPointChecker iCurrentPoint, VersusPointChecker iReplacePoint)
 {
     if (mSrcConnectionPointList[0] == iCurrentPoint)
     {
         mSrcConnectionPointList[0].SetDestConnectionPoint(null);
         mSrcConnectionPointList[0] = iReplacePoint;
     }
     else if (mSrcConnectionPointList[1] == iCurrentPoint)
     {
         mSrcConnectionPointList[1].SetDestConnectionPoint(null);
         mSrcConnectionPointList[1] = iReplacePoint;
     }
 }
Example #5
0
        /// <summary>
        /// ルートポイントを生成する(トップポイントからしか生成不可能)
        /// </summary>
        /// <returns>ルートポイントチェッカー</returns>
        public VersusPointChecker CreateRootPoint()
        {
            //TOPチェッカーからのみ
            if (mDepth != -1 || mPath != "Top")
            {
                return(null);
            }

            var checker = new VersusPointChecker();

            checker.mPath  = "Root";
            checker.mDepth = 0;
            checker.mDestConnectionPoint = this;
            mSrcConnectionPointList[0]   = checker;
            return(checker);
        }
Example #6
0
        //============================================================================
        //! 内部ポイントの場合は加算して次へ渡す
        private void _GetCountingInnerPoint(ref int oCount, VersusPointChecker iPointChecker)
        {
            var src_Point = iPointChecker.GetSrcConnectPoint();

            //どちらとも繋がりが無ければリーフと見なす
            if (src_Point[0] != null || src_Point[1] != null)
            {
                if (src_Point[0] != null)
                {
                    _GetCountingInnerPoint(ref oCount, src_Point[0]);
                }
                if (src_Point[1] != null)
                {
                    _GetCountingInnerPoint(ref oCount, src_Point[1]);
                }
                ++oCount;
            }
        }
        /************************************************************************/
        /* アクセサ                                                             */
        /************************************************************************/

        /// <summary>
        /// トップポイントチェッカーを設定
        /// </summary>
        /// <param name="iTopPonitChecker"></param>
        public void SetTopPointChecker(VersusPointChecker iTopPonitChecker)
        {
            mTopPointChecker = iTopPonitChecker;

            //作成
            if (false)
            {
                //両側
            }
            else
            {
                //片側
                _CreateSingleLeaf();
                _CreateSinglePointPosition();
            }

            //ポイントチェッカーのライン作成
            iTopPonitChecker.CreateLine(mLineSize, MainGrid);
        }
Example #8
0
        //============================================================================
        //! 指定ポイントチェッカーがリーフの場合はリストに追加、それ以外は派生
        private void _GetLeafPoint(ref List <VersusPointChecker> oLeafList, VersusPointChecker iPointChecker)
        {
            var src_Point = iPointChecker.GetSrcConnectPoint();

            //どちらとも繋がりが無ければリーフと見なす
            if (src_Point[0] == null && src_Point[1] == null)
            {
                oLeafList.Add(iPointChecker);
            }
            else
            {
                if (src_Point[0] != null)
                {
                    _GetLeafPoint(ref oLeafList, src_Point[0]);
                }
                if (src_Point[1] != null)
                {
                    _GetLeafPoint(ref oLeafList, src_Point[1]);
                }
            }
        }
 /// <summary>
 /// 初期化
 /// </summary>
 /// <param name="iTopPonitChecker">トップポイントチェッカーを設定</param>
 public void Initialize(VersusPointChecker iTopPonitChecker)
 {
     MainControl.SetTopPointChecker(iTopPonitChecker);
 }
Example #10
0
        /************************************************************************/
        /* アクセサ                                                             */
        /************************************************************************/

        /// <summary>
        /// 出力先シードを設定
        /// </summary>
        /// <param name="iSrcPoint">出力先シード</param>
        public void SetDestConnectionPoint(VersusPointChecker iSrcPoint)
        {
            mDestConnectionPoint = iSrcPoint;
        }