private void updateSlides() { if (currentX == null || selectedIndex != lastSelected) { var start = (currentX != null) ? currentX.Value : 0; currentX = new dfAnimatedFloat(start, calculateTargetPosition(), time) { EasingType = dfEasingType.SineEaseOut }; lastSelected = selectedIndex; } var top = (container.Height - itemSize) * 0.5f; var itemPosition = new Vector3(currentX, top); var count = controls.Count; for (int i = 0; i < count; i++) { var control = controls[i]; control.Size = new Vector2(itemSize, itemSize); control.RelativePosition = itemPosition; control.Pivot = dfPivotPoint.MiddleCenter; if (Application.isPlaying) { var rot = Quaternion.Euler(0, calcHorzRotation(itemPosition.x), 0); control.transform.localRotation = rot; var scale = calcScale(itemPosition.x); control.transform.localScale = Vector3.one * scale; control.Opacity = calcItemOpacity(itemPosition.x); } else { control.transform.localScale = Vector3.one; control.transform.localRotation = Quaternion.identity; } itemPosition.x += itemSize + spacing; } if (Application.isPlaying) { var index = 0; for (int i = 0; i < selectedIndex; i++) { controls[i].ZOrder = index++; } for (int i = count - 1; i >= selectedIndex; i--) { controls[i].ZOrder = index++; } } }
public void OnMouseMove(dfControl control, dfMouseEventArgs args) { if (!(args is dfTouchEventArgs) && !isMouseDown) { return; } if (args.Used || !((args.Position - touchStartPosition).magnitude > 5)) { return; } currentX += args.MoveDelta.x; args.Use(); }
IEnumerator hideWindow( dfControl window ) { busy = true; isVisible = false; window.IsVisible = true; window.GetManager().BringToFront( window ); var opacity = new dfAnimatedFloat( 1f, 0f, 0.33f ); while( opacity > 0.05f ) { window.Opacity = opacity; yield return null; } window.Opacity = 0f; busy = false; }
private IEnumerator closeMenu() { isAnimating = true; var animate = animateOpacity || animateOpenAngle || animateRadius; if (animate) { var time = Mathf.Max(0.1f, animationLength); var animOpenAngle = new dfAnimatedFloat(openAngle, animateOpenAngle ? 0 : openAngle, time); var animRadius = new dfAnimatedFloat(radius, animateRadius ? 0 : radius, time); var animOpacity = new dfAnimatedFloat(1, this.animateOpacity ? 0 : 1, time); var endTime = Time.realtimeSinceStartup + time; while (Time.realtimeSinceStartup < endTime) { arrangeButtons(this.startAngle, animRadius, animOpenAngle, animOpacity); yield return(null); } } using (var list = getButtons()) { for (int i = 0; i < list.Count; i++) { list[i].IsVisible = false; } } isOpen = false; isAnimating = false; if (MenuClosed != null) { MenuClosed(this); } host.Signal("OnMenuOpened", this); }
IEnumerator showWindow( dfControl window ) { isVisible = true; busy = true; window.IsVisible = true; window.GetManager().BringToFront( window ); var opacity = new dfAnimatedFloat( 0f, 1f, 0.33f ); while( opacity < 0.95f ) { window.Opacity = opacity; yield return null; } window.Opacity = 1f; busy = false; isVisible = true; }
IEnumerator hideWindow(dfControl window) { busy = true; isVisible = false; window.IsVisible = true; window.GetManager().BringToFront(window); var opacity = new dfAnimatedFloat(1f, 0f, 0.33f); while (opacity > 0.05f) { window.Opacity = opacity; yield return(null); } window.Opacity = 0f; busy = false; }
private IEnumerator openMenu() { if (BeforeMenuOpened != null) { BeforeMenuOpened(this); } host.Signal("OnBeforeMenuOpened", this); isAnimating = true; var animate = animateOpacity || animateOpenAngle || animateRadius; if (animate) { var time = Mathf.Max(0.1f, animationLength); var animOpenAngle = new dfAnimatedFloat(animateOpenAngle ? 0 : openAngle, openAngle, time); var animRadius = new dfAnimatedFloat(animateRadius ? 0 : radius, radius, time); var animOpacity = new dfAnimatedFloat(this.animateOpacity ? 0 : 1, 1, time); var endTime = Time.realtimeSinceStartup + time; while (Time.realtimeSinceStartup < endTime) { arrangeButtons(this.startAngle, animRadius, animOpenAngle, animOpacity); yield return(null); } } arrangeButtons(); isOpen = true; isAnimating = false; if (MenuOpened != null) { MenuOpened(this); } host.Signal("OnMenuOpened", this); }
IEnumerator showWindow(dfControl window) { isVisible = true; busy = true; window.IsVisible = true; window.GetManager().BringToFront(window); var opacity = new dfAnimatedFloat(0f, 1f, 0.33f); while (opacity < 0.95f) { window.Opacity = opacity; yield return(null); } window.Opacity = 1f; busy = false; isVisible = true; }
private IEnumerator openMenu() { if( BeforeMenuOpened != null ) BeforeMenuOpened( this ); host.Signal( "OnBeforeMenuOpened", this ); isAnimating = true; var animate = animateOpacity || animateOpenAngle || animateRadius; if( animate ) { var time = Mathf.Max( 0.1f, animationLength ); var animOpenAngle = new dfAnimatedFloat( animateOpenAngle ? 0 : openAngle, openAngle, time ); var animRadius = new dfAnimatedFloat( animateRadius ? 0 : radius, radius, time ); var animOpacity = new dfAnimatedFloat( this.animateOpacity ? 0 : 1, 1, time ); var endTime = Time.realtimeSinceStartup + time; while( Time.realtimeSinceStartup < endTime ) { arrangeButtons( this.startAngle, animRadius, animOpenAngle, animOpacity ); yield return null; } } arrangeButtons(); isOpen = true; isAnimating = false; if( MenuOpened != null ) MenuOpened( this ); host.Signal( "OnMenuOpened", this ); }
private IEnumerator closeMenu() { isAnimating = true; var animate = animateOpacity || animateOpenAngle || animateRadius; if( animate ) { var time = Mathf.Max( 0.1f, animationLength ); var animOpenAngle = new dfAnimatedFloat( openAngle, animateOpenAngle ? 0 : openAngle, time ); var animRadius = new dfAnimatedFloat( radius, animateRadius ? 0 : radius, time ); var animOpacity = new dfAnimatedFloat( 1, this.animateOpacity ? 0 : 1, time ); var endTime = Time.realtimeSinceStartup + time; while( Time.realtimeSinceStartup < endTime ) { arrangeButtons( this.startAngle, animRadius, animOpenAngle, animOpacity ); yield return null; } } using( var list = getButtons() ) { for( int i = 0; i < list.Count; i++ ) { list[ i ].IsVisible = false; } } isOpen = false; isAnimating = false; if( MenuClosed != null ) MenuClosed( this ); host.Signal( "OnMenuOpened", this ); }
private void updateSlides() { if( currentX == null || selectedIndex != lastSelected ) { var start = ( currentX != null ) ? currentX.Value : 0; currentX = new dfAnimatedFloat( start, calculateTargetPosition(), time ) { EasingType = dfEasingType.SineEaseOut }; lastSelected = selectedIndex; } var top = ( container.Height - itemSize ) * 0.5f; var itemPosition = new Vector3( currentX, top ); var count = controls.Count; for( int i = 0; i < count; i++ ) { var control = controls[ i ]; control.Size = new Vector2( itemSize, itemSize ); control.RelativePosition = itemPosition; control.Pivot = dfPivotPoint.MiddleCenter; if( Application.isPlaying ) { var rot = Quaternion.Euler( 0, calcHorzRotation( itemPosition.x ), 0 ); control.transform.localRotation = rot; var scale = calcScale( itemPosition.x ); control.transform.localScale = Vector3.one * scale; control.Opacity = calcItemOpacity( itemPosition.x ); } else { control.transform.localScale = Vector3.one; control.transform.localRotation = Quaternion.identity; } itemPosition.x += itemSize + spacing; } if( Application.isPlaying ) { var index = 0; for( int i = 0; i < selectedIndex; i++ ) { controls[ i ].ZOrder = index++; } for( int i = count - 1; i >= selectedIndex; i-- ) { controls[ i ].ZOrder = index++; } } }
public void OnMouseMove( dfControl control, dfMouseEventArgs args ) { if( args is dfTouchEventArgs || isMouseDown ) { if( !args.Used && ( args.Position - touchStartPosition ).magnitude > 5 ) { currentX += args.MoveDelta.x; args.Use(); } } }
public void OnMouseMove( dfControl control, dfMouseEventArgs args ) { if( !( args is dfTouchEventArgs ) && !isMouseDown ) return; if( args.Used || !( ( args.Position - touchStartPosition ).magnitude > 5 ) ) return; currentX += args.MoveDelta.x; args.Use(); }