Example #1
0
        public GUICollection(GUIWindows.GUI parent_, Communication com_, Models.CardCollection CardCollection_)
        {
            InitializeComponent();

            logger = new Log.Logger();

            // attach parent
            parent = parent_;

            // attach controller
            ctrl = new Controllers.CollectionController(this, com_, CardCollection_);

            // init uninitialized data

            listDecksGUI       = new List <Models.DeckGUIModel>();
            listDeckContentGUI = new List <Models.DeckItemGUIModel>();
            selectedDeckID     = -1;
            editModeON         = false;

            // create an invisibile image that will become the zoomed in image whenever auser right clicks a card from the collection
            zoomedImage                     = new Image();
            zoomedImage.Width               = 250;
            zoomedImage.Height              = 346;
            zoomedImage.VerticalAlignment   = VerticalAlignment.Top;
            zoomedImage.HorizontalAlignment = HorizontalAlignment.Left;
            zoomedImage.Visibility          = Visibility.Hidden;
            zoomedImage.Stretch             = Stretch.Fill;
            grdParent.Children.Add(zoomedImage);

            // add all card images and attached buttons to two lists for easy access
            listGuiImages = new List <Image>()
            {
                cardImage1, cardImage2, cardImage3, cardImage4, cardImage5, cardImage6, cardImage7, cardImage8, cardImage9, cardImage10
            };
            listGuiCardButtons = new List <Button>()
            {
                btnCard1, btnCard2, btnCard3, btnCard4, btnCard5, btnCard6, btnCard7, btnCard8, btnCard9, btnCard10
            };

            // load the first 10 cards in the collection to GUI
            loadCardsToGUI(ctrl.filteredCollection, ctrl.currentIndex);

            // init server response timer
            checkServerResponse.Interval = new TimeSpan(0, 0, 0, 0, 250);
            checkServerResponse.Tick    += checkServerResponse_Tick;

            // start loading page data and start listening
            ctrl.loadPageData();
            beginListening();
        }
        public GUIEndGame(GUIWindows.GUI parent, bool youHaveWon)
        {
            InitializeComponent();

            this.parent = parent;
            if (youHaveWon)
            {
                loadVictoryScreen();
            }
            else
            {
                loadDefeatScreen();
            }
        }
        public GUILogIn(GUIWindows.GUI parent_, Communication com_)
        {
            InitializeComponent();

            // attach controller
            ctrl = new Controllers.LogInController(this, com_);

            // attach Window that applied the Page
            parent = parent_;

            // attach Server communication class
            com = com_;

            // initailize timers
            statusTimer.Interval         = new TimeSpan(0, 0, 0, 0, 250);
            statusTimer.Tick            += status_Timer_Tick;
            checkServerResponse.Interval = new TimeSpan(0, 0, 0, 0, 250);
            checkServerResponse.Tick    += checkServerResponse_Tick;
        }
Example #4
0
        public GUIGameRoom(GUIWindows.GUI parent_, Communication com_, int GameRoomID_, int DeckID_, Models.CardCollection CardCollection_)
        {
            InitializeComponent();
            parent = parent_;
            ctrl   = new Controllers.GameRoomController(this, com_, GameRoomID_, DeckID_, CardCollection_);

            logger = new Log.Logger();

            grdOwnGrave.Children.Add(new Models.CardGUIModel(null, this, AnimationConstants.graveInitialPosition, Visibility.Hidden).Border);
            grdOppGrave.Children.Add(new Models.CardGUIModel(null, this, AnimationConstants.graveInitialPosition, Visibility.Hidden).Border);

            initButtons();
            initTimers();
            initLists();
            initZoomedInImage();

            ctrl.loadPageData();
            beginListening();
        }
        public GUIPreGameRoom(GUIWindows.GUI parent_, Communication com_, int GameRoomID_)
        {
            InitializeComponent();

            // attach parent, GameRoomID and controller
            parent     = parent_;
            GameRoomID = GameRoomID_;
            ctrl       = new Controllers.PreGameRoomController(this, com_);

            // initailize uninitialized adta
            DecksGUI       = new List <Models.PreGameDeckGUIModel>();
            selectedDeckID = -1;

            // initialize server response timer
            checkServerResponse.Interval = new TimeSpan(0, 0, 0, 0, 100);
            checkServerResponse.Tick    += checkServerResponse_Tick;

            // start loading page data and start listening
            ctrl.loadPageData();
            beginListening();
        }
        public GUILobbyRoom(GUIWindows.GUI parent_, Communication com_)
        {
            InitializeComponent();

            // attach parent and controller
            parent = parent_;
            ctrl   = new Controllers.LobbyRoomController(this, com_);

            // initialize unitialized data
            chatWindowEmpty  = true;
            listGameRoomsGUI = new List <Models.GameRoomGUIModel>();

            // initialize the timer responsible with checking for messages from the server
            checkServerResponse.Interval = new TimeSpan(0, 0, 0, 0, 100);
            checkServerResponse.Tick    += checkServerResponse_Tick;

            // start loading page data
            ctrl.loadPageData();

            // start listening
            beginListening();
        }
        public GUIGameRoom(GUIWindows.GUI parent, Communication com, int GameRoomID, int DeckID, string OwnNickName, string OppNickName, Models.CardCollection CardCollection)
        {
            InitializeComponent();

            this.parent = parent;
            ownNickName = OwnNickName;
            oppNickName = OppNickName;

            ctrl   = new Controllers.GameRoomController(this, com, GameRoomID, DeckID, CardCollection);
            logger = new Log.Logger();

            grdOwnGrave.Children.Add(new Models.CardGUIModel(null, this, AnimationAndEventsConstants.graveInitialPosition, Visibility.Hidden).Border);
            grdOppGrave.Children.Add(new Models.CardGUIModel(null, this, AnimationAndEventsConstants.graveInitialPosition, Visibility.Hidden).Border);

            initButtons();
            initTimers();
            initLists();
            initZoomedInImage();
            initOtherVariables();

            ctrl.loadPageData();
            beginListening();
        }