Exemple #1
0
 public void removeAllDice()
 {
     if (dice1 != null)
     {
         dice1.setLocation(dice1.getStartLocation());
         dice1.disable();
         dice1.unLockIt();
         dice1.setPlace("Hand");
     }
     if (dice2 != null)
     {
         dice2.setLocation(dice2.getStartLocation());
         dice2.disable();
         dice2.unLockIt();
         dice2.setPlace("Hand");
     }
     if (dice3 != null)
     {
         dice3.setLocation(dice3.getStartLocation());
         dice3.disable();
         dice3.unLockIt();
         dice3.setPlace("Hand");
     }
     if (dice4 != null)
     {
         dice4.setLocation(dice4.getStartLocation());
         dice4.disable();
         dice4.unLockIt();
         dice4.setPlace("Hand");
     }
     if (dice5 != null)
     {
         dice5.setLocation(dice5.getStartLocation());
         dice5.disable();
         dice5.unLockIt();
         dice5.setPlace("Hand");
     }
     if (dice6 != null)
     {
         dice6.setLocation(dice6.getStartLocation());
         dice6.disable();
         dice6.unLockIt();
         dice6.setPlace("Hand");
     }
 }
Exemple #2
0
        public void removeDice(String pb)
        {
            if (pb != null)
            {
                // find the dice from the pbName and remove it.   move the rest of the die up one space
                if (dice1 != null && dice1.getPBName() == pb)
                {
                    dice1 = dice2;
                    if (dice1 != null)
                    {
                        dice1.setLocation(new Point(dice1.getLocation().X, dice1.getLocation().Y - DieWidth));
                    }
                    dice2 = dice3;
                    if (dice2 != null)
                    {
                        dice2.setLocation(new Point(dice2.getLocation().X, dice2.getLocation().Y - DieWidth));
                    }
                    dice3 = dice4;
                    if (dice3 != null)
                    {
                        dice3.setLocation(new Point(dice3.getLocation().X, dice3.getLocation().Y - DieWidth));
                    }
                    dice4 = dice5;
                    if (dice4 != null)
                    {
                        dice4.setLocation(new Point(dice4.getLocation().X, dice4.getLocation().Y - DieWidth));
                    }
                    dice5 = dice6;
                    if (dice5 != null)
                    {
                        dice5.setLocation(new Point(dice5.getLocation().X, dice5.getLocation().Y - DieWidth));
                    }
                    dice6 = null;
                }
                else if (dice2 != null && dice2.getPBName() == pb)
                {
                    dice2 = dice3;
                    if (dice2 != null)
                    {
                        dice2.setLocation(new Point(dice2.getLocation().X, dice2.getLocation().Y - DieWidth));
                    }
                    dice3 = dice4;
                    if (dice3 != null)
                    {
                        dice3.setLocation(new Point(dice3.getLocation().X, dice3.getLocation().Y - DieWidth));
                    }
                    dice4 = dice5;
                    if (dice4 != null)
                    {
                        dice4.setLocation(new Point(dice4.getLocation().X, dice4.getLocation().Y - DieWidth));
                    }
                    dice5 = dice6;
                    if (dice5 != null)
                    {
                        dice5.setLocation(new Point(dice5.getLocation().X, dice5.getLocation().Y - DieWidth));
                    }
                    dice6 = null;
                }
                else if (dice3 != null && dice3.getPBName() == pb)
                {
                    dice3 = dice4;
                    if (dice3 != null)
                    {
                        dice3.setLocation(new Point(dice3.getLocation().X, dice3.getLocation().Y - DieWidth));
                    }
                    dice4 = dice5;
                    if (dice4 != null)
                    {
                        dice4.setLocation(new Point(dice4.getLocation().X, dice4.getLocation().Y - DieWidth));
                    }
                    dice5 = dice6;
                    if (dice5 != null)
                    {
                        dice5.setLocation(new Point(dice5.getLocation().X, dice5.getLocation().Y - DieWidth));
                    }
                    dice6 = null;
                }
                else if (dice4 != null && dice4.getPBName() == pb)
                {
                    dice4 = dice5;
                    if (dice4 != null)
                    {
                        dice4.setLocation(new Point(dice4.getLocation().X, dice4.getLocation().Y - DieWidth));
                    }
                    dice5 = dice6;
                    if (dice5 != null)
                    {
                        dice5.setLocation(new Point(dice5.getLocation().X, dice5.getLocation().Y - DieWidth));
                    }
                    dice6 = null;
                }
                else if (dice5 != null && dice5.getPBName() == pb)
                {
                    dice5 = dice6;
                    if (dice5 != null)
                    {
                        dice5.setLocation(new Point(dice5.getLocation().X, dice5.getLocation().Y - DieWidth));
                    }
                    dice6 = null;
                }
                else if (dice6 != null && dice6.getPBName() == pb)
                {
                    dice6 = null;
                }

                numDice--;
            }
        }