Example #1
0
        public TilePhysicsElement clone(TilePhysicsManager tilePhysicsManagerT)
        {
            TilePhysicsElement newInstance = new TilePhysicsElement(tilePhysicsManagerT);

            newInstance.flagInf = flagInf;
            newInstance.color   = color;
            return(newInstance);
        }
 public static TilePhysicsElement createElement(TilePhysicsManager managerT)
 {
     manager = managerT;
     element = new TilePhysicsElement(manager);
     SmallDialog_NewTile_Physics dialog = new SmallDialog_NewTile_Physics("新建物理单元");
     dialog.ShowDialog();
     return element;
 }
        public void combine(TilePhysicsManager src_Manager, ArrayList mapsID)
        {
            for (int i = 0; i < src_Manager.getElementCount(); i++)
            {
                TilePhysicsElement srcTile = src_Manager.getElement(i);
                //检查是否被源关卡所用到
                bool usingBySrc = false;
                for (int j = 0; j < mapsID.Count; j++)
                {
                    MapElement map = src_Manager.mapsManager.getElement((int)mapsID[j]);
                    if (map.getTileUsedTime(srcTile)>0)
                    {
                        usingBySrc = true;
                        break;
                    }
                }
                if (!usingBySrc)
                {
                    continue;
                }
                //进入合并
                TilePhysicsElement newTile = null;
                for (int j = 0; j < getElementCount(); j++)
                {
                    TilePhysicsElement localTile = getElement(j);
                    if (localTile.equlasTo(srcTile))
                    {
                        newTile = localTile;
                        break;
                    }
                }
                if (newTile == null)
                {
                    newTile = srcTile.clone(this);
                }
                if (!PhyTilesList.Contains(newTile))
                {
                    this.addElement(newTile);
                }
                //转移引用
                for (int k = 0; k < src_Manager.mapsManager.getElementCount(); k++)
                {
                    MapElement map = src_Manager.mapsManager.getElement(k);
                    for (int x = 0; x < map.getMapW(); x++)
                    {
                        for (int y = 0; y < map.getMapH(); y++)
                        {
                            MapTileElement mapTile = map.getTile(x, y);
                            if (mapTile.tile_physic != null && mapTile.tile_physic.Equals(srcTile))
                            {
                                mapTile.tile_physic = newTile;
                            }
                        }
                    }
                }
            }

        }
Example #4
0
        public static TilePhysicsElement createElement(TilePhysicsManager managerT)
        {
            manager = managerT;
            element = new TilePhysicsElement(manager);
            SmallDialog_NewTile_Physics dialog = new SmallDialog_NewTile_Physics("新建物理单元");

            dialog.ShowDialog();
            return(element);
        }
Example #5
0
 public void combine(TilePhysicsManager src_Manager, ArrayList mapsID)
 {
     for (int i = 0; i < src_Manager.getElementCount(); i++)
     {
         TilePhysicsElement srcTile = src_Manager.getElement(i);
         //检查是否被源关卡所用到
         bool usingBySrc = false;
         for (int j = 0; j < mapsID.Count; j++)
         {
             MapElement map = src_Manager.mapsManager.getElement((int)mapsID[j]);
             if (map.getTileUsedTime(srcTile) > 0)
             {
                 usingBySrc = true;
                 break;
             }
         }
         if (!usingBySrc)
         {
             continue;
         }
         //进入合并
         TilePhysicsElement newTile = null;
         for (int j = 0; j < getElementCount(); j++)
         {
             TilePhysicsElement localTile = getElement(j);
             if (localTile.equlasTo(srcTile))
             {
                 newTile = localTile;
                 break;
             }
         }
         if (newTile == null)
         {
             newTile = srcTile.clone(this);
         }
         if (!PhyTilesList.Contains(newTile))
         {
             this.addElement(newTile);
         }
         //转移引用
         for (int k = 0; k < src_Manager.mapsManager.getElementCount(); k++)
         {
             MapElement map = src_Manager.mapsManager.getElement(k);
             for (int x = 0; x < map.getMapW(); x++)
             {
                 for (int y = 0; y < map.getMapH(); y++)
                 {
                     MapTileElement mapTile = map.getTile(x, y);
                     if (mapTile.tile_physic != null && mapTile.tile_physic.Equals(srcTile))
                     {
                         mapTile.tile_physic = newTile;
                     }
                 }
             }
         }
     }
 }
 public TilePhysicsManager cloneForExport(MapsManager mapsManagerT)
 {
     TilePhysicsManager newInstance = new TilePhysicsManager(mapsManagerT);
     for (int i = 0; i < getElementCount(); i++)
     {
         TilePhysicsElement elementI = getElement(i);
         newInstance.addElement(elementI.clone(newInstance));
     }
     return newInstance;
 }
Example #7
0
        public TilePhysicsManager cloneForExport(MapsManager mapsManagerT)
        {
            TilePhysicsManager newInstance = new TilePhysicsManager(mapsManagerT);

            for (int i = 0; i < getElementCount(); i++)
            {
                TilePhysicsElement elementI = getElement(i);
                newInstance.addElement(elementI.clone(newInstance));
            }
            return(newInstance);
        }
 //设置地图单元
 public static void configElement(TilePhysicsElement elementT)
 {
     if (elementT == null)
     {
         Console.WriteLine("error in configElement");
         return;
     }
     manager = elementT.tilePhysicsManager;
     element = elementT;
     SmallDialog_NewTile_Physics dialog = new SmallDialog_NewTile_Physics("设置物理单元属性");
     dialog.numericUpDown_FlagInf.Value = element.getFlagInf();
     dialog.panel_MapColor.BackColor = GraphicsUtil.getColor(element.getColor());
     dialog.ShowDialog();
 }
Example #9
0
        //设置地图单元
        public static void configElement(TilePhysicsElement elementT)
        {
            if (elementT == null)
            {
                Console.WriteLine("error in configElement");
                return;
            }
            manager = elementT.tilePhysicsManager;
            element = elementT;
            SmallDialog_NewTile_Physics dialog = new SmallDialog_NewTile_Physics("设置物理单元属性");

            dialog.numericUpDown_FlagInf.Value = element.getFlagInf();
            dialog.panel_MapColor.BackColor    = GraphicsUtil.getColor(element.getColor());
            dialog.ShowDialog();
        }
Example #10
0
 public TilePhysicsElement(TilePhysicsManager tilePhysicsManagerT)
 {
     tilePhysicsManager = tilePhysicsManagerT;
 }
 public TilePhysicsElement clone(TilePhysicsManager tilePhysicsManagerT)
 {
     TilePhysicsElement newInstance = new TilePhysicsElement(tilePhysicsManagerT);
     newInstance.flagInf = flagInf;
     newInstance.color = color;
     return newInstance;
 }
 public TilePhysicsElement(TilePhysicsManager tilePhysicsManagerT)
 {
     tilePhysicsManager = tilePhysicsManagerT;
 }