예제 #1
0
        //start button handler
        private void Start_Click(object sender, RoutedEventArgs e)
        {
            if (0 == Start.Content.ToString().CompareTo("Reset"))
            {
                ResetGame();
                Start.Content = "Start";
                return;
            }



            if (CGS1 != GameStates.ReadyToStart && CGS2 != GameStates.ReadyToStart && CGS3 != GameStates.ReadyToStart)
            {
                String s = "Game is not ready to Start!, Please Follow The Message Below";
                System.Windows.MessageBox.Show(s);
                return;
            }



            da = new DoubleAnimation(0, 600, TimeSpan.FromSeconds(rnd.Next(10, 15) % 15));
            da.AccelerationRatio = rnd.NextDouble();
            da.Completed        += da_Completed;
            da.Name = "DollerSmily";
            DollerSmily.BeginAnimation(Canvas.TopProperty, da);

            da = new DoubleAnimation(0, 600, TimeSpan.FromSeconds(rnd.Next(10, 15) % 15));
            da.AccelerationRatio = rnd.NextDouble();
            da.Completed        += da_Completed;
            da.Name = "HuggingSmily";
            HuggingSmily.BeginAnimation(Canvas.TopProperty, da);

            da = new DoubleAnimation(0, 600, TimeSpan.FromSeconds(rnd.Next(10, 15) % 15));
            da.AccelerationRatio = rnd.NextDouble();
            da.Completed        += da_Completed;
            da.Name = "AttitudeSmily";
            AttitudeSmily.BeginAnimation(Canvas.TopProperty, da);

            da = new DoubleAnimation(0, 600, TimeSpan.FromSeconds(rnd.Next(10, 15) % 15));
            da.AccelerationRatio = rnd.NextDouble();
            da.Completed        += da_Completed;
            da.Name = "KiddingSmily";
            KiddingSmily.BeginAnimation(Canvas.TopProperty, da);
        }
예제 #2
0
        private void ResetGame()
        {
            GMessage = new StringBuilder();
            sb.Children.Remove(da);
            DoubleAnimation da1 = new DoubleAnimation(600, 0, TimeSpan.FromSeconds(1));

            DollerSmily.BeginAnimation(Canvas.TopProperty, da1);
            HuggingSmily.BeginAnimation(Canvas.TopProperty, da1);
            AttitudeSmily.BeginAnimation(Canvas.TopProperty, da1);
            KiddingSmily.BeginAnimation(Canvas.TopProperty, da1);


            ICCount = 0;
            CGS1    = GameStates.SelectImage;
            CGS2    = GameStates.SelectImage;
            CGS3    = GameStates.SelectImage;
            DollerSmily.IsEnabled = HuggingSmily.IsEnabled = AttitudeSmily.IsEnabled = KiddingSmily.IsEnabled = true;
            WTimes      = new StringBuilder();
            winnerImage = null;
            GMessage.Append("Start again with new bets. \n and Proceed further.");
            WTimes.Clear();

            BFM = new Dictionary <string, int>();
            BFM.Add(DollerSmily.Name, rnd.Next(3, 6));
            BFM.Add(HuggingSmily.Name, rnd.Next(3, 6));
            BFM.Add(AttitudeSmily.Name, rnd.Next(3, 6));
            BFM.Add(KiddingSmily.Name, rnd.Next(3, 6));

            if (BE1 < Amount1)
            {
                Amount1 = BE1;
            }
            if (BE2 < Amount2)
            {
                Amount2 = BE2;
            }
            if (BE3 < Amount3)
            {
                Amount3 = BE3;
            }

            System.Windows.MessageBox.Show(GMessage.ToString());
        }