Beispiel #1
0
        //复制一个备份,并且清除其中没有使用的单元
        public TileGfxContainer cloneClean()
        {
            TileGfxContainer newInstance = new TileGfxContainer((TileGfxManager)parent, name);

            for (int i = 0; i < Count(); i++)
            {
                TileGfxElement baseClip = (TileGfxElement)this[i];
                if (baseClip.getUsedTime() > 0)
                {
                    TileGfxElement newBaseClip = baseClip.Clone(newInstance);
                    newInstance.Add(newBaseClip);
                }
            }
            return(newInstance);
        }
Beispiel #2
0
        //返回使用情况信息
        public String getCondition()
        {
            String text = "";

            text += "----------------------数目统计----------------------\n";
            text += "当前容器中的图形元素数目:" + Count();
            if (Count() > byte.MaxValue)
            {
                text += " (已经超出最大限度[255])\n";
            }
            else
            {
                text += " (在最大限度[255]以内)\n";
            }
            int nbUnUsed = 0;

            for (int i = 0; i < Count(); i++)
            {
                TileGfxElement element = (TileGfxElement)this[i];
                if (element.getUsedTime() == 0)
                {
                    nbUnUsed++;
                }
            }
            text += "图形元素中未被使用到的元素数目:" + nbUnUsed + "\n";
            text += "----------------------重复检查----------------------\n";
            //检查重复的图形块
            int count = 0;

            for (int i = 0; i < Count(); i++)
            {
                TileGfxElement element     = (TileGfxElement)this[i];
                bool           finRepeated = false;
                for (int j = i + 1; j < Count(); j++)
                {
                    TileGfxElement elementT = (TileGfxElement)this[j];
                    if (elementT.equalsClip(element))
                    {
                        text       += "重复的图形元素:(" + i + "," + j + ")\n";
                        finRepeated = true;
                    }
                }
                if (finRepeated)
                {
                    count++;
                }
            }
            text += "共发现" + count + "个重复的图形元素\n";
            text += "----------------------翻转检查----------------------\n";
            count = 0;
            for (int i = 0; i < Count(); i++)
            {
                TileGfxElement element   = (TileGfxElement)this[i];
                byte           transFlag = element.getTansFlag();
                if (transFlag != Consts.TRANS_NONE)
                {
                    count++;
                }
            }
            text += "共发现" + count + "个翻转的元素\n";
            return(text);
        }