예제 #1
0
        private void B_Click(object sender, RoutedEventArgs e)
        {
            AchievementInfo.ClickTime++;
            var P = (sender as Button).Tag as Point;

            M3.Play();
            pr.IsActive = true;
            if (Marked[P.x, P.y])
            {
                return;
            }
            if (OpenedButton == 0)
            {
                SetMine((sender as Button).Tag as Point);
                watch.Start();
            }
            else
            {
            }

            try
            {
                Unload(P);
            }
            catch (Exception)
            {
            }

            try
            {
                Refresh();
            }
            catch (Exception)
            {
            }

            pr.IsActive = false;
        }
예제 #2
0
        private void JudgeWinLost(Point P)
        {
            if (MapNum[P.x, P.y] < 0)
            {
                watch.Stop();
                AchievementInfo.AllPlayTime = AchievementInfo.AllPlayTime.Add(watch.Elapsed);
                LostDialog lost = new LostDialog();

                AchievementInfo.GameoverTime++;
                roots.Children.Add(lost);
                try
                {
                    finished = true;


                    //M2.Play();

                    foreach (var item in ButtonCollection)
                    {
                        item.IsEnabled = false;
                        var p = (Point)item.Tag;
                        if (MapNum[p.x, p.y] < 0)
                        {
                            item.Content = "💣";
                        }
                    }
                }
                catch
                {
                }
            }
            if (OpenedButton > Widt * Heigh - AllNum && !finished)
            {
                finished = true;
                watch.Stop();
                var time = watch.Elapsed.TotalSeconds;
                AchievementInfo.AllPlayTime = AchievementInfo.AllPlayTime.Add(watch.Elapsed);
                // AchievementInfo.SinglePlayTime = AchievementInfo.SinglePlayTime watch.Elapsed;
                int source = (int)((AllNum * AllNum) * 1000 / (Widt * Heigh * time));
                AchievementInfo.MaxSocore  = Math.Max(AchievementInfo.MaxSocore, source);
                AchievementInfo.AllSocore += source;

                WinDialog win = new WinDialog()
                {
                    Source = source, Mode = String.Format("{3}({0},{1},{2})", Widt, Heigh, AllNum, Mode)
                };
                AchievementInfo.WinTime++;

                foreach (var item in ButtonCollection)
                {
                    try
                    {
                        item.IsEnabled = false;
                    }
                    catch { }
                }

                roots.Children.Add(win);
                M3.Play();
                EnterStoryboard.Begin();
            }
        }