Ejemplo n.º 1
0
        private void StartNewGame_Click(object sender, RoutedEventArgs e)
        {
            MenuItemsNewGameGroup.IsEnabled = false;
            MenuItemReset.IsEnabled         = true;
            MenuItem clickedButton = (MenuItem)sender;

            switch (clickedButton.Name)
            {
            case "MenuItemNewGameOpp1":
                BonesRepository.StartNewGame(1);
                SetVisibilityForTextBlocks(Visibility.Visible, TextBlockUserName, TextBlockOppTopName);
                break;

            case "MenuItemNewGameOpp2":
                BonesRepository.StartNewGame(2);
                SetVisibilityForTextBlocks(Visibility.Visible, TextBlockUserName, TextBlockOppLeftName, TextBlockOppTopName);
                break;

            case "MenuItemNewGameOpp3":
                BonesRepository.StartNewGame(3);
                SetVisibilityForTextBlocks(Visibility.Visible, TextBlockUserName, TextBlockOppLeftName, TextBlockOppTopName, TextBlockOppRightName);
                break;

            case "MenuItemNewGameOpp2x2":
                BonesRepository.StartNewGame(0);
                SetVisibilityForTextBlocks(Visibility.Visible, TextBlockUserName, TextBlockOppLeftName, TextBlockOppTopName, TextBlockOppRightName);
                break;
            }
        }
Ejemplo n.º 2
0
 private void MyStoryboard_Completed(object sender, EventArgs e)
 {
     canvasForAnimation.Children.Remove(bone.BoneGrid);
     zoneTo.AddBone(bone, isToEnd);
     HasAlreadyMadeMove = false;
     if (isNeedToTransferMove)
     {
         BonesRepository.NextMove(Bones.Count > 0);
     }
 }
Ejemplo n.º 3
0
        private void MenuItemChangeNames_Click(object sender, RoutedEventArgs e)
        {
            WindowChangeNames windowChangeNames = new WindowChangeNames(BonesRepository.UserZone.Name, BonesRepository.OpponentLeftZone.Name, BonesRepository.OpponentTopZone.Name, BonesRepository.OpponentRightZone.Name)
            {
                Owner = this
            };

            if (windowChangeNames.ShowDialog() == true)
            {
                BonesRepository.UserZone.Name          = windowChangeNames.UserName;
                BonesRepository.OpponentLeftZone.Name  = windowChangeNames.OppLeftName;
                BonesRepository.OpponentTopZone.Name   = windowChangeNames.OppTopName;
                BonesRepository.OpponentRightZone.Name = windowChangeNames.OppRightName;
                BonesRepository.UpdateCurrentScore();
            }
        }
Ejemplo n.º 4
0
        private async void MakeMoveWithDelay()
        {
            await Task.Delay(DelayInMs);

            if (!TryMakeMove())
            {
                if (TryGetBoneFromRest())
                {
                    IsTurnToMove = true;
                }
                else
                {
                    BonesRepository.NextMove(Bones.Count > 0);
                }
            }
        }
Ejemplo n.º 5
0
 private void MenuItemReset_Click(object sender, RoutedEventArgs e)
 {
     BonesRepository.FullReset(true);
 }
Ejemplo n.º 6
0
 public MainWindow()
 {
     InitializeComponent();
     SetInitials();
     BonesRepository.SetBones();
 }
Ejemplo n.º 7
0
        private async void NextMoveWithDelay()
        {
            await Task.Delay(DelayInMs);

            BonesRepository.NextMove(Bones.Count > 0);
        }