public BeeHiveManager(BeeWorldManager worldManager, BeeYard beeYard, BeeHive beeHive) { if (worldManager == null) throw new ArgumentNullException("beeWorldManager"); if (beeYard == null) throw new ArgumentNullException("beeYard"); if (beeHive == null) throw new ArgumentNullException("beeHive"); this.mPlayer = worldManager.PlayerManager.Player; this.mWorldManager = worldManager; this.mBeeYard = beeYard; this.mBeeHive = beeHive; }
public void CreateNew( int id, string name, PlayerAvatar avatar, IObjectRepository<BeeYard> beeYardRepository, IMetaObjectRepository<MetaSuper, Super> superRepository, IObjectRepository<LawnMower> lawnMowerRepository, IMetaObjectRepository<MetaQueenBee, QueenBee> queenRepository, IObjectRepository<Smoker> smokerRepository) { this.mPlayer = new Player(); this.mPlayer.Id = id; this.mPlayer.Name = name; this.mPlayer.Avatar = avatar; this.mPlayer.CreationTime = DateTime.Now; this.mPlayer.LastPlayed = DateTime.Now; this.mPlayer.TotalRealTimePlayed = TimeSpan.Zero; this.mPlayer.BeeTime = new BeeTime(); this.mPlayer.LawnMower = lawnMowerRepository.CreateObject(0); this.mPlayer.Smoker = smokerRepository.CreateObject(0); for (int lBeeYardId = 0; lBeeYardId < beeYardRepository.Count; lBeeYardId++) { var lBeeYard = beeYardRepository.CreateObject(lBeeYardId); this.mPlayer.BeeYards.Insert(lBeeYardId, lBeeYard); for (int lHiveIndex = 0; lHiveIndex <= lBeeYard.MaxHiveCount; lHiveIndex++) { var lBeeHive = new BeeHive(); lBeeHive.Id = lHiveIndex; lBeeYard.BeeHives.Insert(lHiveIndex, lBeeHive); } } var lFirstBeeYard = this.mPlayer.BeeYards[0]; lFirstBeeYard.IsUnlocked = true; // TEST: this.mPlayer.BeeYards[1].IsUnlocked = true; for (int lIndex = 0; lIndex < 20; lIndex++) this.mPlayer.Supers.Add(superRepository.CreateObject(0)); // -- End TEST var lFirstBeeHive = lFirstBeeYard.BeeHives[0]; lFirstBeeHive.Supers.Add(superRepository.CreateObject(0), SuperType.BroodChamber); lFirstBeeHive.QueenBee = queenRepository.CreateObject(0); this.mWorldManager.Time.Reset(this.mPlayer.BeeTime); this.mBeeYardManagers.Clear(); this.mBeeYardManagers.AddRange( this.mPlayer.BeeYards .Select(x => new BeeYardManager(this.mWorldManager, x))); this.mUpdatables.Clear(); this.mUpdatables.AddRange(this.mBeeYardManagers); }
public override void LoadContent() { base.LoadContent(); this.mPlayerManager = this.ScreenManager.BeeWorldManager.PlayerManager; this.mPlayer = this.mPlayerManager.Player; this.mBlankTexture = this.ContentManager.Load<Texture2D>("Sprites/Blank"); this.mConfirmationDialogComponent = new ConfirmationDialogComponent(this.ScreenSize); this.mConfirmationDialogComponent.LoadContent(this.ContentManager); this.mConfirmationDialogComponent.CancelText = "No"; this.mConfirmationDialogComponent.ConfirmText = "Yes"; this.mConfirmationDialogComponent.Confirm += this.ConfirmationDialogComponent_Confirm; this.mButtonMenuComponent = new ButtonMenuComponent(this.ScreenSize); this.mButtonMenuComponent.LoadContent(this.ContentManager); this.mButtonMenuComponent.MenuButtons.Add(this.mMenuButtonBuy); this.mButtonMenuComponent.MenuButtons.Add(this.mMenuButtonBack); }
public override void LoadContent() { base.LoadContent(); this.mPlayerManager = this.ScreenManager.BeeWorldManager.PlayerManager; this.mPlayer = this.mPlayerManager.Player; this.mBlankTexture = this.ContentManager.Load<Texture2D>("Sprites/Blank"); this.mQueenBeeRepository = new QueenBeeRepository(this.ContentManager); this.mHudComponent = new ShopScreenHudComponent(this.ScreenManager.BeeWorldManager, this.ScreenSize); this.mHudComponent.LoadContent(this.ContentManager); this.mConfirmationDialogComponent = new ConfirmationDialogComponent(this.ScreenSize); this.mConfirmationDialogComponent.LoadContent(this.ContentManager); this.mConfirmationDialogComponent.CancelText = "No"; this.mConfirmationDialogComponent.ConfirmText = "Yes"; this.mConfirmationDialogComponent.Cancel += this.ConfirmationDialogComponent_Cancel; this.mConfirmationDialogComponent.Confirm += this.ConfirmationDialogComponent_Confirm; this.mButtonMenuComponent = new ButtonMenuComponent(this.ScreenSize); this.mButtonMenuComponent.LoadContent(this.ContentManager); this.mButtonMenuComponent.MenuButtons.Add(this.mMenuButtonBuy); this.mButtonMenuComponent.MenuButtons.Add(this.mMenuButtonBack); this.mMiddleItemComponent.LoadContent(this.ContentManager); this.mMiddleItemComponent.IconTexture = this.mBlankTexture; this.mMiddleItemComponent.Size = this.mItemSize; this.mMiddleItemComponent.Position = new Vector2( (this.ScreenSize.X - this.mItemSize.X) / 2f, (this.ScreenSize.Y - this.mItemSize.Y - this.mHudComponent.Size.Y) / 2f); this.mMiddleItemComponent.Price = 2; this.mMiddleItemComponent.Click += this.SelectItemComponent; this.mTopItemComponent.LoadContent(this.ContentManager); this.mTopItemComponent.IconTexture = this.mBlankTexture; this.mTopItemComponent.Size = this.mItemSize; this.mTopItemComponent.Position = new Vector2( this.mMiddleItemComponent.Position.X, this.mMiddleItemComponent.Position.Y - sItemPadding - this.mItemSize.Y); this.mTopItemComponent.Price = 1; this.mTopItemComponent.Click += this.SelectItemComponent; this.mBottomItemComponent.LoadContent(this.ContentManager); this.mBottomItemComponent.IconTexture = this.mBlankTexture; this.mBottomItemComponent.Size = this.mItemSize; this.mBottomItemComponent.Position = this.mBottomItemComponent.Position = new Vector2( this.mMiddleItemComponent.Position.X, this.mMiddleItemComponent.Position.Y + this.mItemSize.Y + sItemPadding); this.mBottomItemComponent.Price = 3; this.mBottomItemComponent.Click += this.SelectItemComponent; }
public ShopScreenHudComponent(BeeWorldManager worldManager, Vector2 screenSize) : base(worldManager, screenSize) { this.mPlayer = worldManager.PlayerManager.Player; }
public override void LoadContent() { base.LoadContent(); this.mPlayerManager = this.ScreenManager.BeeWorldManager.PlayerManager; this.mPlayer = this.mPlayerManager.Player; this.mSuperPaintRepository = new SuperPaintRepository(this.ContentManager); this.mSuperRepository = new SuperRepository(this.ContentManager); this.mBlankTexture = this.ContentManager.Load<Texture2D>("Sprites/Blank"); this.mConfirmationDialogComponent = new ConfirmationDialogComponent(this.ScreenSize); this.mConfirmationDialogComponent.LoadContent(this.ContentManager); this.mConfirmationDialogComponent.CancelText = "No"; this.mConfirmationDialogComponent.ConfirmText = "Yes"; this.mConfirmationDialogComponent.Confirm += this.ConfirmationDialogComponent_Confirm; this.mConfirmationDialogComponent.Cancel += this.ConfirmationDialogComponent_Cancel; this.mButtonMenuComponent = new ButtonMenuComponent(this.ScreenSize); this.mButtonMenuComponent.LoadContent(this.ContentManager); this.mButtonMenuComponent.MenuButtons.Add(this.mMenuButtonBuy); this.mButtonMenuComponent.MenuButtons.Add(this.mMenuButtonBack); // // mHudComponent // this.mHudComponent = new ShopScreenHudComponent(this.ScreenManager.BeeWorldManager, this.ScreenSize); this.mHudComponent.LoadContent(this.ContentManager); // // mMiddleSuperItemComponent // this.mMiddleSuperItemComponent.LoadContent(this.ContentManager); this.mMiddleSuperItemComponent.IconTexture = this.mBlankTexture; this.mMiddleSuperItemComponent.Size = this.mSuperItemSize; this.mMiddleSuperItemComponent.Position = new Vector2( ((this.ScreenSize.X - this.mSuperItemSize.X - this.mSuperPaintItemSize.X)/2f), ((this.ScreenSize.Y - this.mSuperItemSize.Y - this.mHudComponent.Size.Y)/2f)); this.mMiddleSuperItemComponent.NameText = "Middle"; this.mMiddleSuperItemComponent.DescriptionText = "This is the middle item."; this.mMiddleSuperItemComponent.Price = 2; this.mMiddleSuperItemComponent.Click += this.SelectItemComponent; this.PopulateItemComponent( this.mMiddleSuperItemComponent, this.mSuperRepository.GetMetaObject(1)); this.mTopSuperItemComponent.LoadContent(this.ContentManager); this.mTopSuperItemComponent.IconTexture = this.mBlankTexture; this.mTopSuperItemComponent.Size = this.mSuperItemSize; this.mTopSuperItemComponent.Position = new Vector2( this.mMiddleSuperItemComponent.Position.X, this.mMiddleSuperItemComponent.Position.Y - sItemPadding - this.mSuperItemSize.Y); this.mTopSuperItemComponent.NameText = "Top"; this.mTopSuperItemComponent.DescriptionText = "This is the top item."; this.mTopSuperItemComponent.Price = 1; this.mTopSuperItemComponent.Click += this.SelectItemComponent; this.PopulateItemComponent( this.mTopSuperItemComponent, this.mSuperRepository.GetMetaObject(0)); this.mBottomSuperItemComponent.LoadContent(this.ContentManager); this.mBottomSuperItemComponent.IconTexture = this.mBlankTexture; this.mBottomSuperItemComponent.Size = this.mSuperItemSize; this.mBottomSuperItemComponent.Position = this.mBottomSuperItemComponent.Position = new Vector2( this.mMiddleSuperItemComponent.Position.X, this.mMiddleSuperItemComponent.Position.Y + this.mSuperItemSize.Y + sItemPadding); this.mBottomSuperItemComponent.NameText = "Right"; this.mBottomSuperItemComponent.DescriptionText = "This is the bottom item."; this.mBottomSuperItemComponent.Price = 3; this.mBottomSuperItemComponent.Click += this.SelectItemComponent; this.PopulateItemComponent( this.mBottomSuperItemComponent, this.mSuperRepository.GetMetaObject(2)); this.mTopSuperPaintItemComponent.LoadContent(this.ContentManager); this.mTopSuperPaintItemComponent.IconTexture = this.mBlankTexture; this.mTopSuperPaintItemComponent.Size = this.mSuperPaintItemSize; this.mTopSuperPaintItemComponent.Position = new Vector2( this.mTopSuperItemComponent.Position.X + this.mSuperItemSize.X + sItemPadding, this.mTopSuperItemComponent.Position.Y); this.mTopSuperPaintItemComponent.NameText = "Top"; this.mTopSuperPaintItemComponent.DescriptionText = "This is the top item."; this.mTopSuperPaintItemComponent.Price = 4; this.mTopSuperPaintItemComponent.Click += this.SelectItemComponent; this.mMiddleTopSuperPaintItemComponent.LoadContent(this.ContentManager); this.mMiddleTopSuperPaintItemComponent.IconTexture = this.mBlankTexture; this.mMiddleTopSuperPaintItemComponent.Size = this.mSuperPaintItemSize; this.mMiddleTopSuperPaintItemComponent.Position = new Vector2( this.mTopSuperPaintItemComponent.Position.X, this.mTopSuperPaintItemComponent.Position.Y + this.mSuperPaintItemSize.Y + sItemPadding); this.mMiddleTopSuperPaintItemComponent.NameText = "Middle Top"; this.mMiddleTopSuperPaintItemComponent.DescriptionText = "This is the middle-top item."; this.mMiddleTopSuperPaintItemComponent.Price = 5; this.mMiddleTopSuperPaintItemComponent.Click += this.SelectItemComponent; this.mMiddleBottomSuperPaintItemComponent.LoadContent(this.ContentManager); this.mMiddleBottomSuperPaintItemComponent.IconTexture = this.mBlankTexture; this.mMiddleBottomSuperPaintItemComponent.Size = this.mSuperPaintItemSize; this.mMiddleBottomSuperPaintItemComponent.Position = new Vector2( this.mTopSuperPaintItemComponent.Position.X, this.mMiddleTopSuperPaintItemComponent.Position.Y + this.mSuperPaintItemSize.Y + sItemPadding); this.mMiddleBottomSuperPaintItemComponent.NameText = "Middle Bottom"; this.mMiddleBottomSuperPaintItemComponent.DescriptionText = "This is the middle-bottom item."; this.mMiddleBottomSuperPaintItemComponent.Price = 6; this.mMiddleBottomSuperPaintItemComponent.Click += this.SelectItemComponent; this.mBottomSuperPaintItemComponent.LoadContent(this.ContentManager); this.mBottomSuperPaintItemComponent.IconTexture = this.mBlankTexture; this.mBottomSuperPaintItemComponent.Size = this.mSuperPaintItemSize; this.mBottomSuperPaintItemComponent.Position = new Vector2( this.mTopSuperPaintItemComponent.Position.X, this.mMiddleBottomSuperPaintItemComponent.Position.Y + this.mSuperPaintItemSize.Y + sItemPadding); this.mBottomSuperPaintItemComponent.NameText = "Bottom"; this.mBottomSuperPaintItemComponent.DescriptionText = "This is the bottom item."; this.mBottomSuperPaintItemComponent.Price = 7; this.mBottomSuperPaintItemComponent.Click += this.SelectItemComponent; }
public override void LoadContent() { base.LoadContent(); this.mBlankTexture = this.ContentManager.Load<Texture2D>("Sprites/Blank"); this.mMetaInfoFont = this.ContentManager.Load<SpriteFont>("Fonts/DefaultTiny"); this.mSuperRepository = new SuperRepository(this.ContentManager); this.mButtonBeeWorld.Click += this.ButtonBeeWorld_Click; this.mButtonBeeWorld.Font = this.ContentManager.Load<SpriteFont>("Fonts/DefaultSmall"); this.mButtonBeeWorld.Text = "World"; this.mButtonBeeWorld.TextColor = Color.White; this.mButtonBeeWorld.BackgroundRenderer = new SolidBackgroundRenderer(this.mBlankTexture, Color.Blue); this.mButtonBeeWorld.Size = new Vector2(75, 30); this.mButtonBeeWorld.Position = new Vector2(10, this.ScreenSize.Y - this.mButtonBeeWorld.Size.Y - 10); this.mButtonMowGrass.Click += this.ButtonMowGrass_Click; this.mButtonMowGrass.Font = this.ContentManager.Load<SpriteFont>("Fonts/DefaultSmall"); this.mButtonMowGrass.Text = "Mow Grass"; this.mButtonMowGrass.TextColor = Color.Black; this.mButtonMowGrass.BackgroundRenderer = new SolidBackgroundRenderer(this.mBlankTexture, Color.Yellow); this.mButtonMowGrass.Size = new Vector2(100, 35); this.mButtonMowGrass.Position = new Vector2(this.ScreenSize.X - this.mButtonMowGrass.Size.X - 10, 10); this.mPlayer = this.ScreenManager.Player; System.Diagnostics.Debug.Assert(this.mPlayer.CurrentBeeHive == null); System.Diagnostics.Debug.Assert(this.mPlayer.CurrentBeeYard != null); this.mBeeYard = this.mPlayer.CurrentBeeYard; this.mBeeYardManager = this.ScreenManager.BeeWorldManager.PlayerManager.BeeYardManagers[this.mBeeYard.Id]; var lAssetName = string.Concat("GraphicsData/BeeYard/HiveInformation_", this.mBeeYard.Id); var lHiveInfos = this.ContentManager.Load<BeeYardHiveInfo[]>(lAssetName); this.mHiveComponents = new BeeYardHiveComponent[lHiveInfos.Length]; var lGreenBackgroundRenderer = new SolidBackgroundRenderer(this.mBlankTexture, Color.Green); for (int lIndex = 0; lIndex < this.mHiveComponents.Length; lIndex++) { var lHiveComponent = new BeeYardHiveComponent( this.mBlankTexture, this.mBeeYard.BeeHives[lIndex], lHiveInfos[lIndex], this.mSuperRepository); lHiveComponent.TravelToHive += this.HiveComponent_TravelToHive; this.mHiveComponents[lIndex] = lHiveComponent; } this.mHudComponent = new BeeYardHubComponent(this.ScreenManager.BeeWorldManager, this.ScreenSize); this.mHudComponent.LoadContent(this.ContentManager); }
public override void LoadContent() { base.LoadContent(); var lPlayerManager = this.ScreenManager.BeeWorldManager.PlayerManager; this.mPlayer = lPlayerManager.Player; System.Diagnostics.Debug.Assert(this.mPlayer.Location == PlayerLocation.BeeHive); this.mBeeHive = this.mPlayer.CurrentBeeHive; var lBeeYardManager = lPlayerManager.BeeYardManagers[this.mPlayer.CurrentBeeYard.Id]; this.mBeeHiveManager = lBeeYardManager.BeeHiveManagers[this.mBeeHive.Id]; this.mBlankTexture = this.ContentManager.Load<Texture2D>("Sprites/Blank"); this.mMetaInfoFont = this.ContentManager.Load<SpriteFont>("Fonts/DefaultTiny"); this.mSuperRepository = new SuperRepository(this.ContentManager); this.mButtonMenuComponent = new ButtonMenuComponent(this.ScreenSize); this.mButtonMenuComponent.LoadContent(this.ContentManager); this.mButtonMenuComponent.MenuButtons.Add(this.mMenuButtonSupers); this.mButtonMenuComponent.MenuButtons.Add(this.mMenuButtonQueen); this.mButtonMenuComponent.MenuButtons.Add(this.mMenuButtonUseSmoker); this.mButtonMenuComponent.MenuButtons.Add(this.mMenuButtonToYard); this.mButtonMenuComponent.MenuButtons.Add(this.mMenuButtonToWorld); this.mButtonMenuComponent.MenuButtons.Add(this.mMenuButtonSelectionCommit); this.mButtonMenuComponent.MenuButtons.Add(this.mMenuButtonSelectionCancel); this.mHudComponent = new BeeHiveHudComponent(this.ScreenManager.BeeWorldManager, this.ScreenSize); this.mHudComponent.LoadContent(this.ContentManager); this.mVerticalScrollUpBounds = new Rectangle( (int)((this.ScreenSize.X - this.mSuperWidth) / 2f), 0, this.mSuperWidth, this.mScrollBoundsHeight); this.mVerticalScrollDownBounds = new Rectangle( this.mVerticalScrollUpBounds.X, (int)this.mHudComponent.Position.Y - this.mVerticalScrollUpBounds.Height, this.mVerticalScrollUpBounds.Width, this.mVerticalScrollUpBounds.Height + (int)this.mHudComponent.Size.Y); this.mInventorySelectorComponent = new InventoryItemSelectorComponent(this.ScreenSize); this.mInventorySelectorComponent.LoadContent(this.ContentManager); this.mSuperTexture = new Texture2D(this.ScreenManager.Game.GraphicsDevice, 128, 128); this.mSuperTexture.SetData(Enumerable.Repeat(Color.Pink, 128 * 128).ToArray()); this.mComponents.Add(this.mInventorySelectorComponent); this.mComponents.Add(this.mButtonMenuComponent); this.mComponents.Add(this.mHudComponent); }