private IEnumerator animatePanel( UIAbstractContainer obj ) { var objectHeight = ((UIHorizontalLayout)obj).height; while( true ) { // flip our orientation to show on the fly layout changes obj.beginUpdates(); // more efficient way to change multiple properties wrapping the begin/endUpdates obj.layoutType = UIAbstractContainer.UILayoutType.Horizontal; obj.edgeInsets = new UIEdgeInsets( 0 ); obj.endUpdates(); yield return new WaitForSeconds( 2 ); var ani = obj.positionTo( 0.7f, new Vector3( obj.position.x, -Screen.height + objectHeight, obj.position.z ), Easing.Quartic.easeIn ); ani.autoreverse = true; yield return ani.chain(); // flip our orientation to show on the fly layout changes obj.beginUpdates(); obj.layoutType = UIAbstractContainer.UILayoutType.Vertical; obj.edgeInsets = new UIEdgeInsets( 20 ); obj.endUpdates(); yield return new WaitForSeconds( 2 ); } }
private IEnumerator animatePanel(UIAbstractContainer obj) { var objectHeight = ((UIHorizontalLayout)obj).height; while (true) { // flip our orientation to show on the fly layout changes obj.beginUpdates(); // more efficient way to change multiple properties wrapping the begin/endUpdates obj.layoutType = UIAbstractContainer.UILayoutType.Horizontal; obj.edgeInsets = new UIEdgeInsets(0); obj.endUpdates(); yield return(new WaitForSeconds(2)); var ani = obj.positionTo(0.7f, new Vector3(obj.position.x, -Screen.height + objectHeight, obj.position.z), Easing.Quartic.easeIn); ani.autoreverse = true; yield return(ani.chain()); // flip our orientation to show on the fly layout changes obj.beginUpdates(); obj.layoutType = UIAbstractContainer.UILayoutType.Vertical; obj.edgeInsets = new UIEdgeInsets(20); obj.endUpdates(); yield return(new WaitForSeconds(2)); } }
public static void parentToContainer(UIAbstractContainer container, params UISprite[] sprites) { foreach (var sprite in sprites) { sprite.parentUIObject = container; } container.addUIChild(sprites); }
void UIItemSlot.SlotInteractor.StopHover(UIItemSlot hovering, UIAbstractContainer overContainer, UIItemSlot over) { // TODO: If not compatible, do something other than un-highlighting if (over) { over.Highlighted = false; } else { overContainer.Highlighted = false; } }
void UIItemSlot.SlotInteractor.StartHover(UIItemSlot hovering, UIAbstractContainer overContainer, UIItemSlot over) { // TODO: Check if compatible, if not, do something other than highlighting. if (over) { over.Highlighted = true; } else { overContainer.Highlighted = true; } }
/** * Finds either the slot and container, or just container, or nothing, at the given point. */ public static UISlotRef FindSlotAtPointer(PointerEventData eventData) { // Check if hovering List <RaycastResult> results = new List <RaycastResult>(); EventSystem.current.RaycastAll(eventData, results); // Find what we might be hovering over UIAbstractContainer foundContainer = null; UIItemSlot foundSlot = null; foreach (var result in results) { var container = result.gameObject.GetComponent <UIAbstractContainer>(); if (container != null) { foundContainer = container; } var slot = result.gameObject.GetComponent <UIItemSlot>(); if (slot != null) { foundSlot = slot; } } // TODO: This is a hack that will be removed soon if (foundSlot && !foundContainer) { Transform obj = foundSlot.transform.parent; while (obj) { if (obj.GetComponent <UIAbstractContainer>()) { foundContainer = obj.GetComponent <UIAbstractContainer>(); break; } obj = obj.parent; } } UISlotRef slotRef; slotRef.container = foundContainer; slotRef.slot = foundSlot; return(slotRef); }
public static UISprite createTextWrapper(UIToolkit uiTools, UITextInstance text, UIAbstractContainer layout) { // Get the right wrapping for the text setTextLayoutWrap(layout, text); // Create the wrapper and scale it // TODO: Check if empty.png exists if not then throw a clear error. UISprite textWrapper = uiTools.addSprite("empty.png", 0, 0); textWrapperScale(layout, textWrapper, text); // Make the text a child of the wrapper text.parentUIObject = textWrapper; textWrapper.userData = text; textPositionInWrapper(text); // Return the wrapper return(textWrapper); }
public UISlotRef(UIAbstractContainer container, UIItemSlot slot) { this.container = container; this.slot = slot; }
public void MoveItem(Container from, int fromSlot, UIAbstractContainer to) { // TODO: throw new NotImplementedException(); }
public bool CanMoveItem(Container from, int fromSlot, UIAbstractContainer to) { return(false); // TODO }
public static void textWrapperScale(UIAbstractContainer layout, UISprite textWrapper, UITextInstance text) { Vector2 textDimensions = text._parentText.sizeForText(text.text); textWrapper.scale = (new Vector3(layout.width / 5, textDimensions.y / 5, 1)); }
public static void setTextLayoutWrap(UIAbstractContainer layout, UITextInstance text) { setTextWrap(text, layout.width - layout.edgeInsets.right); }
public static void textWrapperScale( UIAbstractContainer layout, UISprite textWrapper, UITextInstance text ) { Vector2 textDimensions = text._parentText.sizeForText( text.text ); textWrapper.scale = (new Vector3(layout.width / 5, textDimensions.y / 5, 1)); }
public static void setTextLayoutWrap( UIAbstractContainer layout, UITextInstance text ) { setTextWrap( text, layout.width - layout.edgeInsets.right ); }
public static void parentToContainer( UIAbstractContainer container, params UISprite[] sprites ) { foreach( var sprite in sprites ) { sprite.parentUIObject = container; } container.addUIChild( sprites ); }
public static UISprite createTextWrapper( UIToolkit uiTools, UITextInstance text, UIAbstractContainer layout ) { // Get the right wrapping for the text setTextLayoutWrap( layout, text ); // Create the wrapper and scale it // TODO: Check if empty.png exists if not then throw a clear error. UISprite textWrapper = uiTools.addSprite( "empty.png", 0, 0 ); textWrapperScale( layout, textWrapper, text ); // Make the text a child of the wrapper text.parentUIObject = textWrapper; textWrapper.userData = text; textPositionInWrapper( text ); // Return the wrapper return textWrapper; }