public override void changePanel(LayoutContainer childContainer, float animDuration) { //If we were animating when a new request comes in clear the old animation first. if (animating) { if (this.childContainer != null) { this.childContainer.setAlpha(1.0f); this.childContainer.WorkingSize = newSize; this.childContainer.layout(); finishAnimation(); } else { //If we were transitioning to null, but now there is another container use the child that was being transitioned this.childContainer = oldChildContainer; unsubscribeFromUpdates(); } } currentTime = 0.0f; animationLength = animDuration; oldChildContainer = this.childContainer; if (oldChildContainer != null) { oldSize = oldChildContainer.DesiredSize; oldChildContainer.animatedResizeStarted(new IntSize2(oldSize.Width, WorkingSize.Height)); } else { oldSize = new IntSize2(0, 0); } this.childContainer = childContainer; if (childContainer != null) { childContainer._setParent(this); newSize = childContainer.DesiredSize; childContainer.animatedResizeStarted(new IntSize2(newSize.Width, WorkingSize.Height)); //Force the child container to fit in the current alloted space childContainer.Location = Location; childContainer.WorkingSize = new IntSize2(oldSize.Width, WorkingSize.Height); childContainer.layout(); } else { newSize = new IntSize2(0, 0); } sizeDelta = newSize - oldSize; if (oldSize.Width == 0) { currentEasing = EasingFunction.EaseOutQuadratic; } else if (newSize.Width == 0) { currentEasing = EasingFunction.EaseInQuadratic; } else { currentEasing = EasingFunction.EaseInOutQuadratic; } //Make sure we start with no alpha if blending if (childContainer != null && oldChildContainer != null) { childContainer.setAlpha(0.0f); } subscribeToUpdates(); }
/// <summary> /// Set the panel that will be displayed when this container is first shown /// </summary> /// <param name="childContainer"></param> public void setInitialPanel(LayoutContainer childContainer) { currentSize = childContainer.DesiredSize; this.childContainer = childContainer; invalidate(); }
/// <summary> /// Function to set the parent, should only be called by other ScreenLayoutContainers. /// </summary> /// <param name="parent"></param> public void _setParent(LayoutContainer parent) { this.parent = parent; }
public abstract void changePanel(LayoutContainer childContainer, float animDuration);