Libs/CellsHolder.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Text;

namespace VS2048
{
    public struct GameSummaryInfo
    {
        public int TotalCellCount;
        public int CurrentCellCount;
        public int Score;
        public CellCoordinate NewCellLocation;
    }
    /// <summary>
    /// 当前cell的存储容器
    /// 相当于MVC里面的M
    /// </summary>
    internal class CellsHolder
    {
        private int _rowNum = 0;
        private int _colNum = 0;

        private ICell[,] _celltable = null;
        private ICellMergeStrategy _cms = null;

        public int RowNum
        {
            get { return _rowNum; }
            set { _rowNum = value; }
        }

        public int ColumnNum
        {
            get { return _colNum; }
            set { _colNum = value; }
        }

        internal ICellMergeStrategy CellMergeStrategy
        {
            get { return _cms; }
            set { _cms = value; }
        }
        /// <summary>
        /// Cell表,主要用于合并策略
        /// </summary>
        public ICell[,] Cells
        {
            get { return _celltable; }
        }

        public bool AddCell(CellCoordinate loc, ICell cell)
        {
            if (_celltable == null)
                _celltable = new ICell[_rowNum, _colNum];
            if (_celltable[loc.RowIndex, loc.ColIndex] == null)
                _celltable[loc.RowIndex, loc.ColIndex] = cell;
            return true;
        }
        /// <summary>
        /// 合并有效Cell,返回当前合并分值
后面还有 66 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。