public GameRoomController(GUIPages.GUIGameRoom _parent, Communication _com, int GameRoomID_, int DeckID_, CardCollection CardCollection_)
        {
            parent         = _parent;
            com            = _com;
            GameRoomID     = GameRoomID_;
            DeckID         = DeckID_;
            CardCollection = CardCollection_;

            InitialHand         = new List <CardWithGameProperties>();
            loadedDataChecklist = new List <bool>()
            {
                false, false, false
            };
        }
Beispiel #2
0
        public CardGUIModel(Models.CardWithGameProperties Card_, GUIPages.GUIGameRoom parent_, Thickness margin, Visibility visibility)
        {
            logger = new Log.Logger();
            Card   = Card_;
            parent = parent_;

            // Border
            Border                     = new Border();
            Border.Width               = 73;
            Border.Height              = 100;
            Border.VerticalAlignment   = VerticalAlignment.Top;
            Border.HorizontalAlignment = HorizontalAlignment.Left;
            Border.Margin              = margin;
            Border.BorderThickness     = new Thickness(5);
            Border.BorderBrush         = Brushes.Transparent;
            Border.Visibility          = visibility;

            // Button
            Btn        = new Button();
            Btn.Style  = parent.FindResource("cardButtonStyle") as Style;
            Btn.Cursor = System.Windows.Input.Cursors.Hand;
            Btn.Click += cardButton_Click;

            Border.Child = Btn;

            // Image
            Image = new Image();
            try
            {
                if (Card == null)
                {
                    Image.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + "/Images/GUI/CardBack.png", UriKind.Absolute));
                }
                else
                {
                    Image.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + "/Images/Cards/" + Card.Name + ".png", UriKind.Absolute));
                }
            }
            catch (Exception ex)
            {
                logger.Log(ex.ToString());
            }

            Image.Stretch               = Stretch.UniformToFill;
            Image.MouseRightButtonUp   += parent.cardImage_MouseRightButtonUp;
            Image.MouseRightButtonDown += parent.cardImage_MouseRightButtonDown;

            Btn.Content = Image;
        }
Beispiel #3
0
        // GAME ROOM

        public void loadGameRoom(int GameRoomID, int DeckID, string OwnNickName, string OppNickName)
        {
            GUIgameRoom = new GUIPages.GUIGameRoom(this, com, GameRoomID, DeckID, OwnNickName, OppNickName, CardCollection);
            List <string> loadedDataChecklistTitles = new List <string>()
            {
                "Setting up initial conditions",
                "Fetching hand",
                "Waiting for opponent"
            };

            GUIloading        = new GUIPages.GUILoading(GUIgameRoom.BackgroundImageSource, loadedDataChecklistTitles, GUIgameRoom.getLoadedDataChecklist());
            MainFrame.Content = GUIloading;
            currentPageID     = 4;
            loadPage.Start();
        }
Beispiel #4
0
        public CardGUIModel(Models.CardWithGameProperties Card_, GUIPages.GUIGameRoom parent_, Thickness margin, Visibility visibility, int shieldNumber = -1)
        {
            logger       = new Log.Logger();
            Card         = Card_;
            parent       = parent_;
            ShieldNumber = shieldNumber;

            // Border
            Border        = new Border();
            Border.Width  = 75;
            Border.Height = 100;

            Border.VerticalAlignment   = VerticalAlignment.Top;
            Border.HorizontalAlignment = HorizontalAlignment.Left;
            Border.Margin          = margin;
            Border.BorderThickness = new Thickness(5);
            Border.BorderBrush     = Brushes.Transparent;
            Border.Visibility      = visibility;

            //Grid

            Grd = new Grid();

            // Button
            Btn        = new Button();
            Btn.Style  = parent.FindResource("cardButtonStyle") as Style;
            Btn.Cursor = System.Windows.Input.Cursors.Hand;
            Btn.Click += cardButton_Click;

            Border.Child = Grd;

            // Image
            Image = new Image();
            try
            {
                if (Card == null)
                {
                    Image.Source = new System.Windows.Media.Imaging.BitmapImage(
                        new Uri(
                            string.Format("{0}{1}",
                                          AppDomain.CurrentDomain.BaseDirectory,
                                          cardBackPath),
                            UriKind.Absolute));
                }
                else
                {
                    Image.Source = new System.Windows.Media.Imaging.BitmapImage(
                        new Uri(
                            string.Format("{0}{1}{2}/{3}.jpg",
                                          AppDomain.CurrentDomain.BaseDirectory,
                                          cardsPath,
                                          Card.Set,
                                          Card.Name),
                            UriKind.Absolute));
                }
            }
            catch (Exception ex)
            {
                logger.Log(ex.ToString());
            }

            Image.Stretch = Stretch.UniformToFill;

            Image.MouseRightButtonUp   += parent.cardImage_MouseRightButtonUp;
            Image.MouseRightButtonDown += parent.cardImage_MouseRightButtonDown;

            Btn.Content = Image;
            Grd.Children.Add(Btn);

            if (shieldNumber != -1)
            {
                // Textblock

                TxtBlock                     = new TextBlock();
                TxtBlock.Text                = shieldNumber.ToString();
                TxtBlock.FontSize            = 15;
                TxtBlock.Foreground          = Brushes.White;
                TxtBlock.FontWeight          = FontWeights.Bold;
                TxtBlock.HorizontalAlignment = HorizontalAlignment.Left;
                TxtBlock.VerticalAlignment   = VerticalAlignment.Top;
                TxtBlock.Margin              = new Thickness(10, 5, 0, 0);
                Grd.Children.Add(TxtBlock);
            }
        }