Beispiel #1
0
        public NowPlayingScreen(PokemonCardGame game)
        {
            currentGame  = game;
            content      = new ContentManager(currentGame.Services, "Content");
            intermediary = new ClientIntermediary(game);
            // HACK endpoint should be loaded in ini/xml
            serverEndpoint = new IPEndPoint(new IPAddress(GameConstants.SERVER_IP), GameConstants.SERVER_PORT);

            BackgroundAsset = "GameMat";
            ScreenTitle     = TITLE_GAMEPLAY;
            ScreenLevel     = 2;

            LayoutManager = new FluidLayoutContainer(new Rectangle(0, 0, GameConstants.SCREEN_WIDTH, GameConstants.SCREEN_HEIGHT),
                                                     Edge.Top, 50);
            TestButton = new Button(currentGame, position: new Rectangle(0, 0, 150, 75), colorOverlay: Color.Black, label: "Action", labelColor: Color.White);
        }
Beispiel #2
0
        public override void Initialize()
        {
            client = new ClientIntermediary(currentGame);
            if (ServerIP == null)                                      // if ServerIP wasn't set in the constructor
            {
                ServerIP = new IPAddress(new byte[] { 127, 0, 0, 1 }); // init to a default of localhost
            }
            #region Init SpriteBatches
            interfaceSpriteBatch = new SpriteBatch(currentGame.GraphicsDevice);
            finalSpriteBatch     = new SpriteBatch(currentGame.GraphicsDevice);
            #endregion

            #region Init UI elements
            JoinButton          = new Button("JoinButton", new Vector2(85, 745), true, currentGame);
            JoinButton.Disabled = true;

            SearchButton  = new Button("SearchButton", new Vector2(565, 405), true, currentGame);
            SearchBar     = new TextBoxSingle("Enter server IP", new Vector2(84, 405), currentGame);
            SearchInfobox = new TextBoxFloating(new string[] { "" },
                                                new Vector2(119, 465), "UIFont", new Color(248, 242, 144), currentGame);

            DeckSelectButtons = new Button[4];
            for (int i = 0; i < 4; i++)
            {
                DeckSelectButtons[i] = new Button("DeckSelectButton", new Vector2(85 + (i * 280), 45), true, currentGame);
            }
            DeckSelectButtons[0].Active = true; // default choice
            #endregion

            // Build the list of all elements being drawn to the screen
            OnScreenElements = new List <IClickable>();

            OnScreenElements.Add(JoinButton);
            OnScreenElements.Add(SearchButton);
            OnScreenElements.Add(SearchBar);
            OnScreenElements.Add(SearchInfobox);
            foreach (Button b in DeckSelectButtons)
            {
                OnScreenElements.Add(b);
            }


            currentInputEvent = InputEvent.None;
            keyboardHandler   = new KeyboardHandler(currentGame);
        }