Пример #1
0
 private void updateArea(int iStart, int jStart, int iEnd, int Jend)
 {
     if (G.operation == 1 && G.bAreaBrush)
     {
         for (int i = iStart; i <= iEnd; i++)
         {
             for (int j = jStart; j <= Jend; j++)
             {
                 G.currentMap.tiles[i, j] = G.currentTexture.getCurrentIndex();
             }
         }
     }
     else if (G.operation == 3)
     {
         for (int i = iStart; i <= iEnd; i++)
         {
             for (int j = jStart; j <= Jend; j++)
             {
                 EState eState = new EState(i, j, G.currentSection, G.currentBasePrice);
                 EStateControl ec = new EStateControl();
                 ec.data = eState;
                 MainPanel.Controls.Add(ec);
                 ec.Location = new Point(i * G.tileSize, j * G.tileSize);
                 G.currentMap.gamePlayes[i, j] = 3;
                 G.currentMap.eStates.Add(eState);
             }
         }
     }
 }
Пример #2
0
        private void Dlg_OpenMap_FileOk(object sender, CancelEventArgs e)
        {
            String fileName = Dlg_OpenMap.FileName;
            G.currentMap = new Map();
            G.currentMap.Load(fileName);
            G.currentTexture = new TexturePanel(G.currentMap.textureName, G.currentMap.imgList);
            this.splitContainer1.Panel1.Controls.Add(G.currentTexture);

            int gridCount = G.currentMap.grids.Count();
            for (int i = 0; i < gridCount; i++)
            {
                GridControl gc = new GridControl();
                MainPanel.Controls.Add(gc);
                gc.data = G.currentMap.grids[i];
                gc.Location = new Point(G.currentMap.grids[i].x * G.tileSize, G.currentMap.grids[i].y * G.tileSize);

                if (G.currentMap.grids[i].eState != null)
                {
                    EStateControl ec = new EStateControl();
                    MainPanel.Controls.Add(ec);
                    ec.data = G.currentMap.grids[i].eState;
                    ec.Location = new Point(G.currentMap.grids[i].eState.x * G.tileSize, G.currentMap.grids[i].eState.y * G.tileSize);
                }
            }

            G.bRepaintMainPanel = true;
        }