InfoArr.cs

(开头部分) 2KB

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

using System;
using System.Collections;
using System.Text;
using System.Drawing;
using System.Windows.Forms;

namespace Tetris
{
    class InfoArr
    {
        private ArrayList info = new ArrayList();//存放多个BlockInfo类的数组
        private int _length = 0; //存放ArrayList的长度
        public int Length
        {
            get 
            { 
                return _length; 
            }
        }
        public BlockInfo this[int index] //索引器,根据下标,返回一个BlockInfo
        {
            get
            {
                return (BlockInfo)info[index];
            }
        }
        public string this[string id]//索引器,根据一个字符串的id值下标,给相应的id的颜色赋值
        {
            set
            {
                if (value == "")
                {
                    return;
                }
                for(int i = 0;i < info.Count;i++)
                {
                    if (((BlockInfo)info[i]).GetIdStr() == id)
                    {
                        try
                        {
                            ((BlockInfo)info[i]).BColor = Color.FromArgb(Convert.ToInt32(value));
                        }
                        catch (System.FormatException)
                        {
                            MessageBox.Show("颜色信息错误!请删除BlockSet.xml文件,并重新启动程序","错误信息",MessageBoxButtons.OK,MessageBoxIcon.Error);
                        }
                    }
                }
            }
        }
        private BitArray StrToBit(string id) //把字符串转换为BitArray
        {
            if (id.Length != 25)
            {
                throw new System.FormatException("方块格式信息不合法!请删除BlockSet.xml文件,并重新启动程序");
            }
            BitArray ba = new BitArray(25);
            for (int i = 0; i < 25; i++)
            {
                ba[i] = (id[i] == '0') ? false : true;
后面还有 28 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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