Exemple #1
0
 public MyMap(int w, int h, double wl, double hl)
 {
     width_num            = w;
     height_num           = h;
     blocks               = new MyBlock[h, w];
     MapBackground.Width  = wl;
     MapBackground.Height = hl;
     gridSiZe             = wl / w;
     //循环设置地图块
     for (int i = 0; i < h; i++)
     {
         for (int j = 0; j < w; j++)
         {
             blocks[i, j]            = new MyBlock();
             blocks[i, j].rect.Width = gridSiZe;
             freeBlocks.Add(i * w + j);
         }
     }
     for (int i = 0; i < h; i++)
     {
         for (int j = 0; j < w; j++)
         {
             if (blocks[i, j].isFree)
             {
                 freeBlocks.Add(i * w + j);
             }
         }
     }
 }
Exemple #2
0
        private void RefreshBlock(MyBlock blc_tmp)
        {
            blc_tmp.rect.Source = blc_tmp.imageSource;
            Canvas.SetZIndex(blc_tmp.rect, blc_tmp.Zindex);
            DoubleAnimation doubleAnimation = new DoubleAnimation(blc_tmp.rect.Opacity, blc_tmp.opc, new Duration(TimeSpan.FromMilliseconds(500)));

            blc_tmp.rect.BeginAnimation(Image.OpacityProperty, doubleAnimation);
        }
Exemple #3
0
        private void setMpDrug(int pid)
        {
            MyBlock block = testMap.blocks[pid / numX, pid % numX];

            block.isExistProp = true;
            block.MPrecover  += 100;
            block.Drug        = new Image
            {
                Source = source.mapsource.MpDrug,
                Width  = gridSize
            };
            this.Carrier.Children.Add(block.Drug);
            Canvas.SetLeft(block.Drug, pid % numX * gridSize);
            Canvas.SetTop(block.Drug, pid / numX * gridSize - gridSize * 0.3);
            PlayMapEffects(new System.Drawing.Point(pid % numX, pid / numX));
        }
Exemple #4
0
        private void TimerOfMpRecover_Tick(object sender, EventArgs e)
        {
            Random rad = new Random((int)DateTime.Now.Ticks);

            while (true)
            {
                int     pid   = testMap.freeBlocks[rad.Next(testMap.freeBlocks.Count)];
                MyBlock block = testMap.blocks[pid / numX, pid % numX];
                if (block.isExistProp == false)
                {
                    networkcontrol.AddGameCommand("drug;" + "m;" + pid);
                    setMpDrug(pid);
                    return;
                }
            }
        }
Exemple #5
0
 private void RefreshBlock( MyBlock blc_tmp )
 {
     blc_tmp.rect.Source = blc_tmp.imageSource;
     Canvas.SetZIndex( blc_tmp.rect, blc_tmp.Zindex );
     DoubleAnimation doubleAnimation = new DoubleAnimation( blc_tmp.rect.Opacity, blc_tmp.opc, new Duration( TimeSpan.FromMilliseconds( 500 ) ) );
     blc_tmp.rect.BeginAnimation( Image.OpacityProperty, doubleAnimation );
 }
Exemple #6
0
 public MyMap(int w, int h, double wl, double hl)
 {
     width_num = w;
     height_num = h;
     blocks = new MyBlock[h, w];
     MapBackground.Width = wl;
     MapBackground.Height = hl;
     gridSiZe = wl / w;
     //循环设置地图块
     for (int i = 0; i < h; i++)
         for (int j = 0; j < w; j++)
         {
             blocks[i, j] = new MyBlock();
             blocks[i, j].rect.Width = gridSiZe;
             freeBlocks.Add(i * w + j);
         }
     for (int i = 0; i < h; i++)
         for (int j = 0; j < w; j++)
         {
             if (blocks[i, j].isFree)
                 freeBlocks.Add(i * w + j);
         }
 }