private void RemoveSuper(BeeHiveSuperComponent superComponet) { var lIndex = (int)superComponet.Tag; var lSuper = this.mBeeHive.Supers[lIndex]; this.mButtonMenuComponent.IsVisible = false; this.mSuperComponentBeingRemoved = superComponet; this.mBeeHiveManager.RemoveSuper(lSuper, this.SuperRemovalComplete); }
public override void Update(GameTime gameTime) { base.Update(gameTime); for (int lIndex = this.mComponents.Count - 1; lIndex >= 0; lIndex--) { this.mComponents[lIndex].Update(gameTime); } while (this.mSuperComponents.Count > this.mBeeHive.Supers.Count) { var lLastIndex = this.mSuperComponents.Count - 1; var lSuperComponent = this.mSuperComponents[lLastIndex]; this.mSuperComponents.RemoveAt(lLastIndex); this.mComponents.Remove(lSuperComponent); } while (this.mSuperComponents.Count < this.mBeeHive.Supers.Count) { var lSuperComponent = new BeeHiveSuperComponent(); lSuperComponent.IsSelected = false; lSuperComponent.Tag = this.mSuperComponents.Count; lSuperComponent.BlankTexture = this.mBlankTexture; this.mSuperComponents.Add(lSuperComponent); this.mComponents.Add(lSuperComponent); } var lSuperBottomLeftLocation = new Vector2( (this.ScreenSize.X - mSuperWidth) / 2, this.mHudComponent.Position.Y - 10f + this.mVerticalScrollPosition); this.mVerticalScrollHeight = -(this.mHudComponent.Position.Y / 2f); for (int lIndex = 0; lIndex < this.mBeeHive.Supers.Count; lIndex++) { var lSuper = this.mBeeHive.Supers[lIndex]; var lSuperComponent = this.mSuperComponents[lIndex]; var lSuperComponentSize = new Vector2(mSuperWidth, mSuperHeightPerDepth * lSuper.Depth); var lSuperComponentPosition = new Vector2( lSuperBottomLeftLocation.X, lSuperBottomLeftLocation.Y - lSuperComponentSize.Y); lSuperComponent.Size = lSuperComponentSize; lSuperComponent.Position = lSuperComponentPosition; this.mVerticalScrollHeight += lSuperComponentSize.Y; lSuperBottomLeftLocation.Y = lSuperComponentPosition.Y - 1; } this.mVerticalScrollHeight = Math.Max(this.mVerticalScrollHeight, 0); }
public void EndSelectionMode() { if (this.mSelectedSuper != null) this.mSelectedSuper.IsSelected = false; this.mIsSelectionModeActive = false; this.mSuperSelectedCallback = null; this.mSelectedSuper = null; this.mMenuButtonSelectionCancel.IsVisible = false; this.mMenuButtonSelectionCommit.IsVisible = false; this.mMenuButtonSupers.IsVisible = true; this.mMenuButtonQueen.IsVisible = true; this.mMenuButtonUseSmoker.IsVisible = true; this.mMenuButtonToYard.IsVisible = true; this.mMenuButtonToWorld.IsVisible = true; }
public override void HandleInput(InputState inputState) { base.HandleInput(inputState); this.mInventorySelectorComponent.HandleInput(inputState); // Must handle input backwards to make the topmost component // the first to have a change to handle the input. for (int lIndex = this.mComponents.Count - 1; lIndex >= 0; lIndex--) { var lComponent = this.mComponents[lIndex]; lComponent.HandleInput(inputState); } if (this.mIsSelectionModeActive && inputState.MouseLeftClickUp()) { var lCurrentMouseState = inputState.CurrentMouseState; for (int lIndex = 0; lIndex < this.mSuperComponents.Count; lIndex++) { var lSuperComponent = this.mSuperComponents[lIndex]; if (VectorUtilities.HitTest(lSuperComponent.Position, lSuperComponent.Size, lCurrentMouseState.X, lCurrentMouseState.Y)) { lSuperComponent.IsSelected = true; if (this.mSelectedSuper != null) this.mSelectedSuper.IsSelected = false; this.mSelectedSuper = lSuperComponent; break; } } } if (!this.mInventorySelectorComponent.Visible) { var lCurrentMouseState = inputState.CurrentMouseState; if (this.mVerticalScrollUpBounds.Contains(lCurrentMouseState.X, lCurrentMouseState.Y)) { this.mVerticalScrollPosition = Math.Min( this.mVerticalScrollPosition + this.mVerticalScrollAmount, this.mVerticalScrollHeight); } else if (this.mVerticalScrollDownBounds.Contains(lCurrentMouseState.X, lCurrentMouseState.Y)) { this.mVerticalScrollPosition = Math.Max( this.mVerticalScrollPosition - this.mVerticalScrollAmount, 0); } } }
public void BeginSelectionMode(Action<BeeHiveSuperComponent> superSelectedCallback) { System.Diagnostics.Debug.Assert(superSelectedCallback != null); this.mIsSelectionModeActive = true; this.mSuperSelectedCallback = superSelectedCallback; this.mSelectedSuper = null; this.mMenuButtonSelectionCancel.IsVisible = true; this.mMenuButtonSelectionCommit.IsVisible = true; this.mMenuButtonSupers.IsVisible = false; this.mMenuButtonQueen.IsVisible = false; this.mMenuButtonUseSmoker.IsVisible = false; this.mMenuButtonToYard.IsVisible = false; this.mMenuButtonToWorld.IsVisible = false; }