Exemple #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;
            }
        }
 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);
     }
 }
Exemple #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();
            }
        }
Exemple #4
0
        private async void MakeMoveWithDelay()
        {
            await Task.Delay(DelayInMs);

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

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