示例#1
0
 private void runPlayTimer_Tick(object sender, EventArgs e)
 {
     runPlayTimer.Stop();
     Play.runPlay();
 }
示例#2
0
        //this method runs through an outcome of lists and returns their outcomes.
        public static void DoWorkSon(ProportionValue <string> propValue)
        {
            var newPropValueList = propValue.PropValueList;

            if (newPropValueList != null)
            {
                var newDescription = propValue.Value;
                playDescription += newDescription;

                var newChosenList = newPropValueList.ChooseByRandom();
                DoWorkSon(newChosenList);

                if (propValue.InsertValue != null)
                {
                    string switchInsertValue = propValue.InsertValue;

                    //receives the inserted values that will update scoreboard information and trigger methods
                    switch (switchInsertValue)
                    {
                    case "balls":
                        Play.recordBall();
                        break;

                    case "strikes":
                        Play.recordStrike();
                        break;

                    case "fouls":
                        Play.recordFoul();
                        break;

                    case "hits":
                        frmBaseballSimulator.startRunPlayTimer();
                        break;
                    }
                }
            }
            else
            {
                var newDescription = propValue.Value;
                playDescription += newDescription;

                Console.WriteLine(playDescription);

                if (propValue.InsertValue != null)
                {
                    string switchInsertValue = propValue.InsertValue;

                    //receives the inserted values that will update scoreboard information and trigger methods
                    switch (switchInsertValue)
                    {
                    case "balls":
                        Play.recordBall();
                        break;

                    case "strikes":
                        Play.recordStrike();
                        break;

                    case "fouls":
                        Play.recordFoul();
                        break;

                    case "hits":
                        frmBaseballSimulator.startRunPlayTimer();
                        break;
                    }
                }

                if (propValue.InsertValue != "hits")
                {
                    playDescription = string.Empty;
                }
            }
        }
示例#3
0
 public static void advanceHalfTimer_Tick(object sender, EventArgs e)
 {
     if (onBaseLabels.Count > 0)
     {
         if (!boolAdvanceHalf)
         {
             for (int i = 0; i < onBaseLabels.Count; i++)
             {
                 //if (basesCrossed < onBaseLabels.Count + (NumToAdvance -1))
                 if (basesCrossed < totalNumToAdvance)
                 {
                     //if (onBaseLabels.ElementAt(i).BaseLocation < onBaseLabels.ElementAt(i).StartingBaseLocation + NumToAdvance)
                     //{
                     advanceRunner(onBaseLabels.ElementAt(i));
                     //}
                 }
                 else
                 {
                     basesCrossed      = 0;
                     totalNumToAdvance = 0;
                     clearCount();
                     advanceHalfTimer.Stop();
                     Play.endPlay();
                 }
             }
         }
         else
         {
             for (int i = 0; i < onBaseLabels.Count; i++)
             {
                 //if (basesCrossed < onBaseLabels.Count + (NumToAdvance -1))
                 if (basesCrossed < totalNumToAdvance)
                 {
                     //if (onBaseLabels.ElementAt(i).BaseLocation < onBaseLabels.ElementAt(i).StartingBaseLocation + NumToAdvance)
                     //{
                     advanceRunner(onBaseLabels.ElementAt(i));
                     //}
                 }
                 else if (basesCrossed < totalNumToAdvance + onBaseLabels.Count)
                 {
                     advanceHalf();
                 }
                 else
                 {
                     basesCrossed      = 0;
                     totalNumToAdvance = 0;
                     clearCount();
                     advanceHalfTimer.Stop();
                     Play.endPlay();
                 }
             }
         }
     }
     else
     {
         basesCrossed      = 0;
         totalNumToAdvance = 0;
         clearCount();
         advanceHalfTimer.Stop();
         Play.endPlay();
     }
 }