public PlayerManager(
     IRandomNumberGenerator randomNumberGenerator,
     InputManager inputManager,
     CardManager cardManager,
     bool isHost)
 {
     this.randomNumberGenerator = randomNumberGenerator;
     this.inputManager = inputManager;
     this.cardManager = cardManager;
     this.isHost = isHost;
 }
Esempio n. 2
0
        internal Player(long id, Texture2D texture, InputManager inputmanager, CardManager cardManager)
        {
            this.Id = id;
            this.Texture = texture;
            this.inputManager = inputmanager;
            this.cardManager = cardManager;

            this.CardIndex = 0; // set to blank initially

            playerCardPosition = new Rectangle(10, 10, 190, 254);

            mouseClickPosition.X = 0;
            mouseClickPosition.Y = 0;
        }
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            this.networkManager.Connect();

            var randomNumberGenerator = new MersenneTwister();
            this.inputManager = new InputManager(this);

            this.cardManager = new CardManager(randomNumberGenerator);

            this.playerManager = new PlayerManager(randomNumberGenerator, this.inputManager, this.cardManager, this.isHost);
            this.playerManager.PlayerStateChanged +=
                (sender, e) => this.networkManager.SendMessage(new UpdatePlayerStateMessage(e.Player));

            // Commenting out .. cards being handled by Card manager above
            //this.cardList = new GameObject[IncludeConstant.NumberOfCards];
            //for (int i = 0; i < IncludeConstant.NumberOfCards; i++)
            //{
            //    // Inits id and Source Rectangle(from spritesheet) for cards
            //    //this.cardList[i] = new GameObject(i, IncludeConstant.FrameWidth * i , 0, IncludeConstant.FrameWidth, IncludeConstant.FrameHeight);
            //    this.cardList[i] = new GameObject(i, i * (IncludeConstant.FrameWidth + IncludeConstant.pixel), 0, IncludeConstant.FrameWidth, IncludeConstant.FrameHeight);

            //    Console.WriteLine("Card: {0} Rectangle coords: {1} {2} {3} {4}", this.cardList[i].Id, this.cardList[i].SourceRect.X, this.cardList[i].SourceRect.Y, this.cardList[i].SourceRect.Width, this.cardList[i].SourceRect.Height);
            //}

            this.Components.Add(this.inputManager);

            this.IsMouseVisible = true;

            base.Initialize();
        }