public virtual void LoadUI(Dictionary <string, string> propertyList = null) { UIElementBase[] componentsInChildren = base.gameObject.GetComponentsInChildren <UIElementBase>(); UIElementBase[] array = componentsInChildren; foreach (UIElementBase uIElementBase in array) { uIElementBase.Controller = this; if (uIElementBase.name != "") { Elements[uIElementBase.name] = uIElementBase; } } array = componentsInChildren; foreach (UIElementBase uIElementBase in array) { uIElementBase.Init(propertyList); } IsLoaded = true; screenTransition = FindElement("TransitionInOut", warnIfMissing: false) as IScreenTransition; stackedTransition = FindElement("TransitionPushPop", warnIfMissing: false) as IScreenTransition; if (screenTransition != null) { IsInTransition = true; screenTransition.Play(); } if ((bool)UIManager.Instance) { UIManager.Instance.ControlLoaded(this); } else { Logger.LogFatal(this, "UIManager must exist in this scene"); } }
public override async Task LoadContent() { await base.LoadContent(); screenTransition = new ScreenTransition { OnTime = 10f, OffTime = 0f, }; var transition = new PathTransitionObject(new List <Vector2> { new Vector2(100, 100), new Vector2(500, 100), new Vector2(500, 400), new Vector2(100, 400) }, screenTransition); var label = new Label("TEST", Content, FontSize.Small) { Position = new Point(100, 100), TransitionObject = transition, Horizontal = HorizontalAlignment.Center, Vertical = VerticalAlignment.Center }; AddItem(label); }
public Vector2 Position(IScreenTransition screen, Vector2 pos) { switch (WipeType) { case TransitionWipeType.PopLeft: { return(PopLeftTransition(screen, pos)); } case TransitionWipeType.PopRight: { return(PopRightTransition(screen, pos)); } case TransitionWipeType.PopTop: { return(PopTopTransition(screen, pos)); } case TransitionWipeType.PopBottom: { return(PopBottomTransition(screen, pos)); } case TransitionWipeType.SlideLeft: { return(SlideLeftTransition(screen, pos)); } case TransitionWipeType.SlideRight: { return(SlideRightTransition(screen, pos)); } case TransitionWipeType.SlideTop: { return(SlideTopTransition(screen, pos)); } case TransitionWipeType.SlideBottom: { return(SlideBottomTransition(screen, pos)); } default: { //None transition type return(pos); } } }
private void OnTransitionInstantiated(AsyncOperationHandle <GameObject> obj) { if (obj.Status == AsyncOperationStatus.Succeeded) { _screenTransitionGameObject = obj.Result; _screenTransition = _screenTransitionGameObject.GetComponent <IScreenTransition>(); } }
/// <summary> /// Helper draws a translucent black sprite, used for fading specific areas /// </summary> public void DrawRect(Color color, Rectangle rect, IScreenTransition screen, ITransitionObject transition, Texture2D tex) { //set the transition location rect.Location = transition.Position(screen, rect); //draw the filled background DrawRect(screen.AlphaColor(color), rect, tex); }
public void DrawOutline(Color color, Rectangle rect, IScreenTransition screen, ITransitionObject transition, float lineWidth = 5f) { //set the transition location rect.Location = transition.Position(screen, rect); //draw the button outline DrawOutline(screen.AlphaColor(color), rect, lineWidth); }
/// <summary> /// Draw a /// </summary> public void DrawRect(Color color, Rectangle rect, IScreenTransition screen, ITransitionObject transition) { //get the color for the background & border color.A = (byte)(color.A * screen.Alpha); //set the transition location rect.Location = transition.Position(screen, rect); //draw the filled background DrawRect(screen.AlphaColor(color), rect); }
public void Prepare() { if (m_Instance == null) { m_Instance = InstantiateScreen(); m_ScreenTransition = m_Instance.GetComponent <IScreenTransition>(); m_CanNavigate = m_Instance.GetComponentsInChildren <ICanNavigate>(); m_Instance.transform.SetParent(transform, false); m_Instance.name = m_Id; m_Canvas.enabled = false; } }
public Vector2 Position(IScreenTransition screen, Vector2 pos) { if (screen.TransitionPosition != 0.0f) { //get the transition offset var transitionOffset = (float)Math.Pow(screen.TransitionPosition, 2.0); return(Vector2.Lerp(pos, StartPosition, transitionOffset)); } //just return the end position if no transition stuff. return(pos); }
public Vector2 Position(IScreenTransition screen, Vector2 pos) { //get the target point var target = GetTargetPosition(pos); if (screen.TransitionPosition != 0.0f) { //get the transition offset var transitionOffset = (float)Math.Pow(screen.TransitionPosition, 2.0); return(Vector2.Lerp(target, pos, transitionOffset)); } return(target); }
/// <summary> /// Slide in from the left, slide out the right /// </summary> /// <param name="pos"></param> /// <returns></returns> private Vector2 PopLeftTransition(IScreenTransition screen, Vector2 pos) { if (screen.TransitionPosition != 0.0f) { // Make the menu slide into place during transitions, using a // power curve to make things look more interesting (this makes // the movement slow down as it nears the end). var transitionOffset = (float)Math.Pow(screen.TransitionPosition, 2.0); if (screen.State == TransitionState.TransitionOn) { pos.X -= transitionOffset * 256; } else { pos.X -= transitionOffset * 512; } } return(pos); }
public Vector2 Position(IScreenTransition screen, Point pos) { return(Position(screen, pos.ToVector2())); }
public Point Position(IScreenTransition screen, Rectangle rect) { var pos = Position(screen, rect.Location.ToVector2()); return(pos.ToPoint()); }
private Vector2 PopBottomTransition(IScreenTransition screen, float x, float y) { return(PopBottomTransition(screen, new Vector2(x, y))); }
void Awake() { Instance = this; _transition = GetComponent <IScreenTransition>(); _stack = new ScreenStack(gameScreen); }