Exemplo n.º 1
0
 public int CompareTo(Cheese a)
 {
     if (IconIndex == a.IconIndex && Color == a.Color)
     {
         return(0);
     }
     if (IconIndex == 12 || a.IconIndex == 12)
     {
         return(2);
     }
     if (IconIndex > a.IconIndex)
     {
         return(-1);
     }
     if (IconIndex < a.IconIndex)
     {
         return(1);
     }
     if (Color == 1)
     {
         return(1);
     }
     return(-1);
 }
Exemplo n.º 2
0
        public void StartDavinciCodeSinglePlay()
        {
            AllClear();

            DoubleAnimation _OpacityChange = new DoubleAnimation(0d, 1d, new Duration(TimeSpan.FromSeconds(1.2)));

            _OpacityChange.BeginTime = TimeSpan.FromSeconds(1.2);

            DoubleAnimation _OpacityChangeEight = new DoubleAnimation(0d, 0.8, new Duration(TimeSpan.FromSeconds(1.2)));

            _OpacityChange.BeginTime = TimeSpan.FromSeconds(1.2);

            _DavinciStep.Step    = 1;
            _DavinciStep.Whoplay = 1;
            _DavinciStep.Round   = 1;


            for (int i = 0; i < 13; i++)
            {
                Cheeses[i]      = new Cheese(i, 0);
                Cheeses[i + 13] = new Cheese(i, 1);
            }


            int k = 0;
            int c = ran.Next(200);

            while (gcd(c, 26) != 1)
            {
                c = ran.Next(200);
            }

            for (int i = 0; i < 26; i++)
            {
                k = (k + 11) % 26;
                Cheeses[k].Height         = 80;
                Cheeses[k].Width          = 80;
                Cheeses[k].Opacity        = 0;
                Cheeses[k].Opacity        = 0;
                Cheeses[k].KButton.Click += Cheeses[k].KButton_ClickInPlayBoard;
                Cheeses[k].BeginAnimation(OpacityProperty, _OpacityChange);
                Cheeses[k].Locked = true;
                CheeseSet.Children.Add(Cheeses[k]);
                Canvas.SetLeft(Cheeses[k], 250 + ran.Next(200));
                Canvas.SetTop(Cheeses[k], 150 + ran.Next(160));
                //_Cheeses[k].MouseUp += new MouseButtonEventHandler(Cheess_MouseUp);
            }

            cheesenum = 26;


            _PlayBoxFirst.Name = "_PlayBoxFirst";
            _PlayBoxFirst.AllClear();
            _PlayBoxFirst.hideSign();
            _PlayBoxFirst.Opacity = 0;
            _PlayBoxFirst.Locked  = true;

            PlayerOneBoxSet.Children.Add(_PlayBoxFirst);
            Canvas.SetLeft(_PlayBoxFirst, 0);
            Canvas.SetTop(_PlayBoxFirst, 472);



            _PlayBoxSecend.FlowDirection = System.Windows.FlowDirection.LeftToRight;
            _PlayBoxSecend.Name          = "_PlayBoxSecend";
            _PlayBoxSecend.AllClear();
            _PlayBoxSecend.Opacity   = 0;
            _PlayBoxSecend.Locked    = true;
            _PlayBoxSecend.Rightmode = true;

            PlayerTwoBoxSet.Children.Add(_PlayBoxSecend);
            Canvas.SetLeft(_PlayBoxSecend, 0);
            Canvas.SetTop(_PlayBoxSecend, -40);


            _PlayBoxFirst.BeginAnimation(OpacityProperty, _OpacityChangeEight);
            _PlayBoxSecend.BeginAnimation(OpacityProperty, _OpacityChangeEight);



            CheeseShowSecend.Opacity = 0;
            CheeseShowFirst.Opacity  = 0;

            CheeseSet.Children.Add(CheeseShowFirst);
            CheeseShowFirst.Name = "CheeseShowFirst";

            Canvas.SetLeft(CheeseShowFirst, 615);
            Canvas.SetTop(CheeseShowFirst, 420);
            CheeseSet.Children.Add(CheeseShowSecend);
            CheeseShowSecend.Name = "CheeseShowSecend";

            Canvas.SetLeft(CheeseShowSecend, 40);
            Canvas.SetTop(CheeseShowSecend, 30);
            CheeseShowFirst.BeginAnimation(OpacityProperty, _OpacityChange);
            CheeseShowSecend.BeginAnimation(OpacityProperty, _OpacityChange);

            StepControl();
        }