コード例 #1
0
        /// <summary>
        /// 第一步。。。。-1500到-300 1500到0
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void sb1_Completed(object sender, object e)
        {
            ///////////////////////////////////////////过关的话自动开始下一关//////////////////////////////////////
            //把跑到顶端的格子移到底端去。以重新生成下一关的UPLists;
            foreach (Block item in BlockUplists)
            {
                BlockRectangle b1 = allBlockRectangles.First(retangle => retangle.Tag == item.Tag);
                b1.StartFu1500To1500();
            }
            await Task.Delay(10);

            foreach (Block item in visBlocks)//将没显示的黑块再次变黑
            {
                item.IsVis = true;
            }
            foreach (Block item in allBlocks)
            {
                item.IsVisSmallMan = false;
            }

            //得到新一关的visBlocks。。。//将新一关的visBlocks设置为不可见。
            level++;
            Random r = new Random();

            if (level <= 3)
            {
                visBlocks = map.EasyBlock();
            }
            else if (level <= 8)
            {
                visBlocks = map.MediumBlock();
            }
            else if (level <= 33)
            {
                int i = r.Next(1, 11);
                if (i <= 2)
                {
                    visBlocks = map.EasyBlock();
                }
                else if (i <= 5)
                {
                    visBlocks = map.MediumBlock();
                }
                else
                {
                    visBlocks = map.HardBlock();
                }
            }
            else
            {
                int i = r.Next(1, 11);
                if (i <= 3)
                {
                    visBlocks = map.MediumBlock();
                }
                else
                {
                    visBlocks = map.HardBlock();
                }
            }

            foreach (Block item in visBlocks)
            {
                item.IsVis = false;
            }


            //获取随机要压下来的Blocks//然后从1500放到-1500准备下一步的操作
            BlockUplists = map.UpBlocks(visBlocks);
            foreach (Block itemBlock in BlockUplists)
            {
                BlockRectangle b1 = allBlockRectangles.First(retangle => retangle.Tag == itemBlock.Tag);
                b1.Start1500ToFu1500();
            }
            //获取allblocks减去要压下来的blocks。。。得到FuBlockUplists;
            foreach (Block item in BlockUplists)
            {
                FuBlockUplists = allBlocks;
                FuBlockUplists.Remove(item);
            }



            await Task.Delay(100);



            //小人可以移动到的12个小人数组初始化
            for (int i = 0; i < 9; i++)
            {
                smallMans[i] = map[i, map.smallManY[i]];
            }
            //小人初始化;//初始化前先写一个下落的动画;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
            smallMans[4].IsVisSmallMan = true;

            //将-1500处的uplists放下到300处//将1500处的FuBlockUplists放到0
            foreach (Block item in BlockUplists)
            {
                BlockRectangle b1 = allBlockRectangles.First(retangle => retangle.Tag == item.Tag);
                b1.StartFu1500ToFu300();
            }
            foreach (Block item in FuBlockUplists)
            {
                BlockRectangle b1 = allBlockRectangles.First(retangle => retangle.Tag == item.Tag);
                b1.Start1500To0();
            }

            //把Uplists加回到allBlocks;
            foreach (Block item in BlockUplists)
            {
                allBlocks.Add(item);
            }

            FromFu1500ToFu300.Begin();
            From1500To0.Begin();
        }
コード例 #2
0
        /// <summary>
        /// 最后一次改于20140608下午运行正常。。。未写小人下落登场动画
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void GameOverBtn_Click(object sender, RoutedEventArgs e)
        {
            GridJianBianDonHua.Visibility = Visibility.Visible;
            sbJianBianDonHua0.Begin();
            //中线显示出来;
            CenterRec.Visibility = Visibility.Visible;
            //关于8个小矮人的判断动画;
            if (firstMan != null)
            {
                firstMan.StartSmall();
                firstMan = null;                                 //开始游戏了,把firstman变小,并且变成null以免影响到下一次的判断;
            }
            lvTheme.Visibility           = Visibility.Collapsed; //开始游戏了。把左右彩条隐藏了;
            lvThemeBackGround.Visibility = Visibility.Collapsed;
            foreach (Block item in allBlocks)
            {
                item.IsVisSmallMan = false;
            }
            //这里写地图2里的小人被隐藏;
            foreach (Block item in allBlocks2)
            {
                item.IsVisSmallMan = false;
            }
            GameOverGrid.Visibility = Visibility.Collapsed;
            if (GameOverBtn.Label.ToString() == "开始学习")
            {
                GameOverBtn.Label = "再走一圈";
            }
            if (visBlocks != null)
            {
                foreach (Block item in visBlocks)//将没显示的黑块再次变黑
                {
                    item.IsVis = true;
                }
            }
            //这里写地图2里隐藏格格再次变黑;
            if (visBlocks2 != null)
            {
                foreach (Block item in visBlocks2)//将没显示的黑块再次变黑
                {
                    item.IsVis = true;
                }
            }
            level = 1;//关卡计数器;
            //sw.Start();//秒表开始计时功能现在先不用随后如果想用反注释一下;
            //把所有的格子放到底端去;
            foreach (BlockRectangle item in allBlockRectangles)
            {
                item.Start0To1500();
            }
            //这里写地图2里所有的格子放到底端去;
            foreach (BlockRectangle item in allBlockRectangles2)
            {
                item.Start0To1500();
            }

            //二:生成uplists放到顶端
            //2.1得到新一关的visBlocks。。。//将新一关的visBlocks设置为不可见。
            visBlocks = map.EasyBlock();
            await Task.Delay(1);//修复系统Bug;

            //这里写地图2获取到简单难度的隐藏格;
            visBlocks2 = map2.EasyBlock();

            foreach (Block item in visBlocks)
            {
                item.IsVis = false;
            }
            //这里写地图2的所有获取到的隐藏格隐藏遍历隐藏起来;
            foreach (Block item in visBlocks2)
            {
                item.IsVis = false;
            }
            //2.2获取随机要压下来的Blocks//然后从1500放到-1500准备下一步的操作
            BlockUplists = map.UpBlocks(visBlocks);
            foreach (Block itemBlock in BlockUplists)
            {
                BlockRectangle b1 = allBlockRectangles.First(retangle => retangle.Tag == itemBlock.Tag);
                b1.Start1500ToFu1500();
            }
            //这里写地图2里随机获取要压下来的Blocks然后从顶放到底准备下一步的操作;
            BlockUplists2 = map2.UpBlocks(visBlocks2);
            foreach (Block itemBlock in BlockUplists2)
            {
                BlockRectangle b1 = allBlockRectangles2.First(retangle => retangle.Tag == itemBlock.Tag);
                b1.Start1500ToFu1500();
            }

            //获取allblocks减去要压下来的blocks。。。得到FuBlockUplists;
            foreach (Block item in BlockUplists)
            {
                FuBlockUplists = allBlocks;
                FuBlockUplists.Remove(item);
            }

            //这里写地图2//获取allblocks2减去要压下来的blocks。。。得到FuBlockUplists2;
            foreach (Block item in BlockUplists2)
            {
                FuBlockUplists2 = allBlocks2;
                FuBlockUplists2.Remove(item);
            }
            await Task.Delay(100);

            //小人可以移动到的9个小人数组初始化
            for (int i = 0; i < 5; i++)
            {
                smallMans[i] = map[i, map.smallManY[i]];
            }
            //小人初始化;//初始化前先写一个下落的动画;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
            smallMans[2].IsVisSmallMan = true;

            //这里写地图2小人可以移动到的5个小人数组初始化
            for (int i = 0; i < 5; i++)
            {
                smallMans2[i] = map2[i, map2.smallManY[i]];
            }
            smallMans2[2].IsVisSmallMan = true;

            //将-1500处的uplists放下到300处//将1500处的FuBlockUplists放到0
            foreach (Block item in BlockUplists)
            {
                BlockRectangle b1 = allBlockRectangles.First(retangle => retangle.Tag == item.Tag);
                b1.StartFu1500ToFu300();
            }
            foreach (Block item in FuBlockUplists)
            {
                BlockRectangle b1 = allBlockRectangles.First(retangle => retangle.Tag == item.Tag);
                b1.Start1500To0();
            }
            //这里写地图2//将-1500处的uplists2放下到300处//将1500处的FuBlockUplists2放到0
            foreach (Block item in BlockUplists2)
            {
                BlockRectangle b1 = allBlockRectangles2.First(retangle => retangle.Tag == item.Tag);
                b1.StartFu1500ToFu300();
            }
            foreach (Block item in FuBlockUplists2)
            {
                BlockRectangle b1 = allBlockRectangles2.First(retangle => retangle.Tag == item.Tag);
                b1.Start1500To0();
            }
            //把Uplists加回到allBlocks;
            foreach (Block item in BlockUplists)
            {
                allBlocks.Add(item);
            }
            //这里地图2把Uplists2加回到allBlocks2;
            foreach (Block item in BlockUplists2)
            {
                allBlocks2.Add(item);
            }

            FromFu1500ToFu300.Begin();
            From1500To0.Begin();
        }
コード例 #3
0
        /// <summary>
        /// 最后一次改于20140608下午运行正常。。。未写小人下落登场动画;;;;;;;;;;;;;;;;;;;;;;;;;;
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void GameOverBtn_Click(object sender, RoutedEventArgs e)
        {
            if (firstMan != null)
            {
                firstMan.StartSmall();
                firstMan = null;                                 //开始游戏了,把firstman变小,并且变成null以免影响到下一次的判断;
            }
            lvTheme.Visibility           = Visibility.Collapsed; //开始游戏了。把左右彩条隐藏了;
            lvThemeBackGround.Visibility = Visibility.Collapsed;
            //GameOverScore.DataContext = sw;
            //txtbScore.DataContext = sw;
            //这里添加了所有小人被挂的语句··············································
            foreach (Block item in allBlocks)
            {
                item.IsVisSmallMan = false;
            }

            GameOverGrid.Visibility = Visibility.Collapsed;

            if (GameOverBtn.Label.ToString() == "开始学习")
            {
                GameOverBtn.Label = "再走一圈";
            }

            //所有黑块变黑。。。小人变没。。。
            if (visBlocks != null)
            {
                foreach (Block item in visBlocks)//将没显示的黑块再次变黑
                {
                    item.IsVis = true;
                }
            }

            level = 1;

            //秒表开始计时;
            sw.Start();
            //把所有的格子放到底端去;
            foreach (BlockRectangle item in allBlockRectangles)
            {
                item.Start0To1500();
            }

            //二:生成uplists放到顶端
            //2.1得到新一关的visBlocks。。。//将新一关的visBlocks设置为不可见。

            if (level <= 4)
            {
                visBlocks = map.EasyBlock();
            }
            else if (level <= 10)
            {
                visBlocks = map.MediumBlock();
            }
            else
            {
                visBlocks = map.HardBlock();
            }

            foreach (Block item in visBlocks)
            {
                item.IsVis = false;
            }
            //2.2获取随机要压下来的Blocks//然后从1500放到-1500准备下一步的操作
            BlockUplists = map.UpBlocks(visBlocks);
            foreach (Block itemBlock in BlockUplists)
            {
                BlockRectangle b1 = allBlockRectangles.First(retangle => retangle.Tag == itemBlock.Tag);
                b1.Start1500ToFu1500();
            }


            //获取allblocks减去要压下来的blocks。。。得到FuBlockUplists;
            foreach (Block item in BlockUplists)
            {
                FuBlockUplists = allBlocks;
                FuBlockUplists.Remove(item);
            }

            await Task.Delay(100);

            //小人可以移动到的12个小人数组初始化
            for (int i = 0; i < 9; i++)
            {
                smallMans[i] = map[i, map.smallManY[i]];
            }
            //小人初始化;//初始化前先写一个下落的动画;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
            smallMans[4].IsVisSmallMan = true;


            //将-1500处的uplists放下到300处//将1500处的FuBlockUplists放到0
            foreach (Block item in BlockUplists)
            {
                BlockRectangle b1 = allBlockRectangles.First(retangle => retangle.Tag == item.Tag);
                b1.StartFu1500ToFu300();
            }
            foreach (Block item in FuBlockUplists)
            {
                BlockRectangle b1 = allBlockRectangles.First(retangle => retangle.Tag == item.Tag);
                b1.Start1500To0();
            }
            //把Uplists加回到allBlocks;
            foreach (Block item in BlockUplists)
            {
                allBlocks.Add(item);
            }
            FromFu1500ToFu300.Begin();
            From1500To0.Begin();
        }
コード例 #4
0
 public void StartFu1500ToFu300()
 {
     FromFu1500ToFu300.Begin();
 }