Esempio n. 1
0
        private void CardPlace_MouseUp_1(object sender, MouseButtonEventArgs e)
        {
            var cp = sender as CardPlace;

            if (selectedCardPlace != null && selectedCardPlace != cp)
            {
                selectedCardPlace.selected = false;
            }
            selectedCardPlace = cp;
        }
        private void CardPlace_MouseUp(object sender, MouseButtonEventArgs e)
        {
            CardPlace cp = sender as CardPlace;

            if (selectedCardPlace != null && selectedCardPlace != cp)
            {
                selectedCardPlace.selected = false;
            }
            CardIndex         = cp.ThisCard.id;
            selectedCardPlace = cp;
        }
Esempio n. 3
0
        private void AllCardPlace_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            CardPlace cp = sender as CardPlace;

            foreach (CardPlace item in SlotGrid.Children)
            {
                if (item.ContainsCard) continue;

                int oslot = cp.ThisCard.slot;
                int nslot = Int32.Parse(item.Tag.ToString());

                bool isError = false;

                bool res = false;

                App.ProxyMutex.WaitOne();
                try
                {

                    res = ServiceProxy.Proxy.ChangeCardslot(App.UserName, oslot, nslot);
                }
                catch (CommunicationException exc)
                {
                    App.OnException();
                    isError = true;
                }

                App.ProxyMutex.ReleaseMutex();

                if (isError)
                {
                    App.OnConnectionError();
                    return;
                }


                if (res)
                {
                    cp.selected = false;
                    Thread fillMyCardGridThread = new Thread(GetAllCard) { IsBackground = true };
                    fillMyCardGridThread.Start();                   
                }

                return;

            }

            DialogWin dw = new DialogWin(this, "Все боевые слоты уже заняты\nЧтобы переместить туда эту карту необходимо освободить один...",
                MessageBoxButton.OK);
            App.WindowList.Add(dw.Name, dw);
            dw.ShowDialog();

        }
 private void CharacterCreateWnd_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     if (Visibility == Visibility.Hidden)
     {
         if (selectedCardPlace != null)
         {
             selectedCardPlace.selected = false;
         }
         selectedCardPlace         = null;
         characterNameTextBox.Text = "";
         CardIndex         = -1;
         errorText.Content = "Имя персонажа: Введите от 3 до 16 символов";
     }
 }
Esempio n. 5
0
        private void myCardPlace_MouseDown(object sender, MouseButtonEventArgs e)
        {
            var cp = sender as CardPlace;

            if (mySelectedCardPlace != null && cp != mySelectedCardPlace)
            {
                mySelectedCardPlace.selected = false;
            }

            mySelectedCardPlace = cp;

            foreach (var item in enemyCardPlases.Values)
            {
                if (item.ContainsCard && item.ThisCard.Enabled)
                {
                    item.IsEnabled = true;
                }
            }
        }
Esempio n. 6
0
        private void SlotCardPlace_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            CardPlace cp = sender as CardPlace;            

                int oslot = cp.ThisCard.slot;
                int nslot = -1;

                bool isError = false;

                bool res = false;

                App.ProxyMutex.WaitOne();
                try
                {
                    nslot = ServiceProxy.Proxy.GetFreeSlotNumberAllCards(App.UserName);
                    res = ServiceProxy.Proxy.ChangeCardslot(App.UserName, oslot, nslot);
                }
                catch (CommunicationException exc)
                {
                    App.OnException();
                    isError = true;
                }

                App.ProxyMutex.ReleaseMutex();

                if (isError)
                {
                    App.OnConnectionError();
                    return;
                }


                if (res)
                {
                    cp.selected = false;
                    Thread fillMyCardGridThread = new Thread(GetAllCard) { IsBackground = true };
                    fillMyCardGridThread.Start();
                }

                return;

        }
Esempio n. 7
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.CardPackWnd = ((CardGameClient.CardPackWindow)(target));

            #line 5 "..\..\..\CardPackWindow.xaml"
                this.CardPackWnd.ContentRendered += new System.EventHandler(this.Window_ContentRendered);

            #line default
            #line hidden
                return;

            case 2:
                this.CardNameLabel1 = ((System.Windows.Controls.Label)(target));
                return;

            case 3:
                this.NewCardPlace1 = ((CardGameClient.CardPlace)(target));
                return;

            case 4:
                this.CardNameLabel2 = ((System.Windows.Controls.Label)(target));
                return;

            case 5:
                this.NewCardPlace2 = ((CardGameClient.CardPlace)(target));
                return;

            case 6:
                this.CardNameLabel3 = ((System.Windows.Controls.Label)(target));
                return;

            case 7:
                this.NewCardPlace3 = ((CardGameClient.CardPlace)(target));
                return;
            }
            this._contentLoaded = true;
        }
Esempio n. 8
0
        private void MainWnd_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            /*if (Visibility == Visibility.Visible)
             * {
             *  if (myCardPlases.Count() != 0)
             *  {
             *      mySelectedCardPlace = null;
             *      enemySelectedCardPlace = null;
             *      game = null;
             *
             *      myCardPlases = new Dictionary<int, CardPlace>();
             *      enemyCardPlases = new Dictionary<int, CardPlace>();
             *     // Window_Loaded_1(this, null);
             *  }
             * }*/
            if (Visibility == Visibility.Hidden)
            {
                menuTop.btnText           = "";
                boardGrid.IsEnabled       = false;
                menuTop.firstUserNickname = "";
                menuTop.twoUserNickname   = "";
                mySelectedCardPlace       = null;
                enemySelectedCardPlace    = null;
                game = null;

                foreach (var item in myCardPlases.Values)
                {
                    item.inGame       = false;
                    item.ContainsCard = false;
                    item.ThisCard     = null;
                }

                foreach (var item in enemyCardPlases.Values)
                {
                    item.inGame       = false;
                    item.ContainsCard = false;
                    item.ThisCard     = null;
                }
            }
        }
Esempio n. 9
0
        private void Window_Loaded_1(object sender, RoutedEventArgs e)
        {
            try
            {
                foreach (UIElement item in boardGrid.Children)
                {
                    CardPlace cp = item as CardPlace;

                    if (cp != null)
                    {
                        if (cp.Name.Contains("MyPlace"))
                        {
                            myCardPlases.Add(Int32.Parse(cp.Tag.ToString()), cp);
                        }
                        else if (cp.Name.Contains("EnemyPlace"))
                        {
                            enemyCardPlases.Add(Int32.Parse(cp.Tag.ToString()), cp);
                        }
                    }
                }

                OnWindowShow();



                /* this.Dispatcher.Invoke(new Action(() =>
                 *       Owner.Hide()
                 *   ), DispatcherPriority.ContextIdle, null);*/
            }
            catch (Exception exc)
            {
                this.Dispatcher.Invoke(new Action(delegate
                {
                    MessageBox.Show(exc.Message, "Критическая ошибка!");
                    App.isConnected = false;
                    App.dumpException(exc);
                    Application.Current.Shutdown();
                }));
            }
        }
Esempio n. 10
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.LobbyWnd = ((CardGameClient.LobbyScreen)(target));

            #line 6 "..\..\..\LobbyScreen.xaml"
                this.LobbyWnd.Closing += new System.ComponentModel.CancelEventHandler(this.Window_Closing);

            #line default
            #line hidden

            #line 6 "..\..\..\LobbyScreen.xaml"
                this.LobbyWnd.Closed += new System.EventHandler(this.Window_Closed);

            #line default
            #line hidden

            #line 6 "..\..\..\LobbyScreen.xaml"
                this.LobbyWnd.Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded);

            #line default
            #line hidden

            #line 6 "..\..\..\LobbyScreen.xaml"
                this.LobbyWnd.ContentRendered += new System.EventHandler(this.Window_ContentRendered_1);

            #line default
            #line hidden

            #line 6 "..\..\..\LobbyScreen.xaml"
                this.LobbyWnd.IsVisibleChanged += new System.Windows.DependencyPropertyChangedEventHandler(this.LobbyWnd_IsVisibleChanged);

            #line default
            #line hidden
                return;

            case 2:
                this.MainLobbyGrid = ((System.Windows.Controls.Grid)(target));
                return;

            case 3:
                this.findBtn = ((CardGameClient.FindButton)(target));
                return;

            case 4:
                this.NickNameLevel = ((CardGameClient.StyledTextBox)(target));
                return;

            case 5:
                this.Wins = ((CardGameClient.StyledTextBox)(target));
                return;

            case 6:
                this.Games = ((CardGameClient.StyledTextBox)(target));
                return;

            case 7:
                this.Exp = ((CardGameClient.StyledTextBox)(target));
                return;

            case 8:
                this.Rating = ((CardGameClient.StyledTextBox)(target));
                return;

            case 9:
                this.MainLobbyBackBtn = ((CardGameClient.StyledBtn)(target));
                return;

            case 10:
                this.AllCardsBtn = ((CardGameClient.StyledBtn)(target));
                return;

            case 11:
                this.ratingGrid = ((System.Windows.Controls.Grid)(target));
                return;

            case 12:
                this.MyCardsGrid = ((System.Windows.Controls.Grid)(target));

            #line 60 "..\..\..\LobbyScreen.xaml"
                this.MyCardsGrid.IsVisibleChanged += new System.Windows.DependencyPropertyChangedEventHandler(this.MyCardsGrid_IsVisibleChanged);

            #line default
            #line hidden
                return;

            case 13:
                this.gridHeroes = ((System.Windows.Controls.Grid)(target));
                return;

            case 14:
                this.AllCardsGrid = ((System.Windows.Controls.Grid)(target));
                return;

            case 15:

            #line 142 "..\..\..\LobbyScreen.xaml"
                ((System.Windows.Controls.Image)(target)).MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.Image_MouseDown);

            #line default
            #line hidden
                return;

            case 16:
                this.currPageLabel = ((System.Windows.Controls.Label)(target));
                return;

            case 17:

            #line 144 "..\..\..\LobbyScreen.xaml"
                ((System.Windows.Controls.Image)(target)).MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.Image_MouseDown_1);

            #line default
            #line hidden
                return;

            case 18:
                this.SlotGrid = ((System.Windows.Controls.Grid)(target));
                return;

            case 19:
                this.Slot1Card = ((CardGameClient.CardPlace)(target));
                return;

            case 20:
                this.Slot2Card = ((CardGameClient.CardPlace)(target));
                return;

            case 21:
                this.Slot3Card = ((CardGameClient.CardPlace)(target));
                return;

            case 22:
                this.Slot4Card = ((CardGameClient.CardPlace)(target));
                return;

            case 23:
                this.Slot5Card = ((CardGameClient.CardPlace)(target));
                return;

            case 24:
                this.Slo6Card = ((CardGameClient.CardPlace)(target));
                return;

            case 25:
                this.Slot7Card = ((CardGameClient.CardPlace)(target));
                return;

            case 26:
                this.Slot8Card = ((CardGameClient.CardPlace)(target));
                return;

            case 27:
                this.CardsExitBtn = ((CardGameClient.StyledBtn)(target));
                return;

            case 28:
                this.CardsScore = ((CardGameClient.StyledTextBox)(target));
                return;

            case 29:
                this.CardsShopBtn = ((CardGameClient.StyledBtn)(target));
                return;

            case 30:
                this.ShopGrid = ((System.Windows.Controls.Grid)(target));
                return;

            case 31:

            #line 192 "..\..\..\LobbyScreen.xaml"
                ((System.Windows.Controls.Image)(target)).MouseUp += new System.Windows.Input.MouseButtonEventHandler(this.Image_MouseUp);

            #line default
            #line hidden
                return;

            case 32:
                this.nabor1Btn = ((CardGameClient.StyledBtn)(target));
                return;

            case 33:
                this.nabor2Btn = ((CardGameClient.StyledBtn)(target));
                return;

            case 34:
                this.nabor3Btn = ((CardGameClient.StyledBtn)(target));
                return;
            }
            this._contentLoaded = true;
        }
Esempio n. 11
0
        private void enemyCardPlace_MouseDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                var cp = sender as CardPlace;

                if (enemySelectedCardPlace != null && enemySelectedCardPlace != cp)
                {
                    enemySelectedCardPlace.selected = false;
                }

                enemySelectedCardPlace = cp;

                foreach (var item in enemyCardPlases.Values)
                {
                    item.IsEnabled = false;
                }

                foreach (var item in myCardPlases.Values)
                {
                    item.IsEnabled = false;
                }

                //attack
                var         isError = false;
                LastHitInfo lhi     = null;
                App.ProxyMutex.WaitOne();
                try
                {
                    lhi = ServiceProxy.Proxy.DoAttack(App.NickName, mySelectedCardPlace.ThisCard.slot,
                                                      enemySelectedCardPlace.ThisCard.slot);
                }
                catch
                {
                    App.OnException();
                    isError = true;
                }

                App.ProxyMutex.ReleaseMutex();

                if (isError)
                {
                    App.OnConnectionError();
                    return;
                }

                //if success
                if (lhi != null)
                {
                    enemySelectedCardPlace.AnimateDmgAdtnl(lhi);
                    mySelectedCardPlace.AnimateTurn();
                }

                enemySelectedCardPlace.selected = mySelectedCardPlace.selected = false;

                foreach (var item in myCardPlases.Values)
                {
                    if (item.ContainsCard && item.ThisCard.Enabled)
                    {
                        item.IsEnabled = true;
                    }
                }
            }
            catch (Exception exc)
            {
                Dispatcher.Invoke(new Action(delegate
                {
                    MessageBox.Show(exc.Message, "Критическая ошибка!");
                    App.isConnected = false;
                    App.dumpException(exc);
                    Application.Current.Shutdown();
                }));
            }
        }
Esempio n. 12
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.MainWnd = ((CardGameClient.MainWindow)(target));

            #line 5 "..\..\..\MainWindow.xaml"
                this.MainWnd.Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded_1);

            #line default
            #line hidden

            #line 5 "..\..\..\MainWindow.xaml"
                this.MainWnd.ContentRendered += new System.EventHandler(this.Window_ContentRendered);

            #line default
            #line hidden

            #line 5 "..\..\..\MainWindow.xaml"
                this.MainWnd.Closed += new System.EventHandler(this.Window_Closed);

            #line default
            #line hidden

            #line 5 "..\..\..\MainWindow.xaml"
                this.MainWnd.Closing += new System.ComponentModel.CancelEventHandler(this.Window_Closing);

            #line default
            #line hidden

            #line 5 "..\..\..\MainWindow.xaml"
                this.MainWnd.KeyDown += new System.Windows.Input.KeyEventHandler(this.Window_KeyDown);

            #line default
            #line hidden

            #line 5 "..\..\..\MainWindow.xaml"
                this.MainWnd.IsVisibleChanged += new System.Windows.DependencyPropertyChangedEventHandler(this.MainWnd_IsVisibleChanged);

            #line default
            #line hidden
                return;

            case 2:
                this.boardGrid = ((System.Windows.Controls.Grid)(target));
                return;

            case 3:
                this.menuTop = ((CardGameClient.inGameTopInfo)(target));
                return;

            case 4:
                this.MyPlace0 = ((CardGameClient.CardPlace)(target));
                return;

            case 5:
                this.MyPlace1 = ((CardGameClient.CardPlace)(target));
                return;

            case 6:
                this.MyPlace3 = ((CardGameClient.CardPlace)(target));
                return;

            case 7:
                this.MyPlace5 = ((CardGameClient.CardPlace)(target));
                return;

            case 8:
                this.MyPlace7 = ((CardGameClient.CardPlace)(target));
                return;

            case 9:
                this.MyPlace2 = ((CardGameClient.CardPlace)(target));
                return;

            case 10:
                this.MyPlace4 = ((CardGameClient.CardPlace)(target));
                return;

            case 11:
                this.MyPlace6 = ((CardGameClient.CardPlace)(target));
                return;

            case 12:
                this.MyPlace8 = ((CardGameClient.CardPlace)(target));
                return;

            case 13:
                this.EnemyPlace0 = ((CardGameClient.CardPlace)(target));
                return;

            case 14:
                this.EnemyPlace1 = ((CardGameClient.CardPlace)(target));
                return;

            case 15:
                this.EnemyPlace3 = ((CardGameClient.CardPlace)(target));
                return;

            case 16:
                this.EnemyPlace5 = ((CardGameClient.CardPlace)(target));
                return;

            case 17:
                this.EnemyPlace7 = ((CardGameClient.CardPlace)(target));
                return;

            case 18:
                this.EnemyPlace2 = ((CardGameClient.CardPlace)(target));
                return;

            case 19:
                this.EnemyPlace4 = ((CardGameClient.CardPlace)(target));
                return;

            case 20:
                this.EnemyPlace6 = ((CardGameClient.CardPlace)(target));
                return;

            case 21:
                this.EnemyPlace8 = ((CardGameClient.CardPlace)(target));
                return;

            case 22:
                this.Bottom = ((System.Windows.Controls.Grid)(target));
                return;
            }
            this._contentLoaded = true;
        }