public MainWindow() { InitializeComponent(); SliderBall t = new SliderBall(); this.DataContext = t; t.t_Changed += t_Changed; }
void Start() { handle = this.gameObject; ballXForm = handle.transform.GetChild (0).GetChild (0); ball = ballXForm.gameObject.GetComponent ("SliderBall") as SliderBall; }
private void Load(TextureStore store) { Body = new SnakingSliderBody(this) { PathRadius = (1.0f - 0.7f * ((float)Beatmap.Difficulty.CircleSize - 5) / 5) / 2 * 64, AccentColour = Color4.Black }; // lets make it black for now, as almost every Legacy skin uses that. Body.SnakingIn.Value = false; Body.SnakingOut.Value = false; Origin = Anchor.TopLeft; Position = StackedPosition; Ball = new SliderBall { Scale = new Vector2(Body.PathRadius) }; SliderBeginCircle = new HitCircle(Beatmap, Body.PathOffset) { BeginTime = BeginTime }; InternalChildren = new Drawable[] { Body, Ball, SliderBeginCircle }; Body.UpdateProgress(0); Ball.Position = this.CurvePositionAt(0); Ball.Scale = new Vector2(Body.PathRadius / 64f); Logger.LogPrint($"B:{BeginTime} E:{EndTime}"); BindableProgress.ValueChanged += prog => { if (prog.NewValue * RepeatCount >= 1) { Hide(); } var progress = prog.NewValue / 2; Body.UpdateProgress(progress); var newPos = this.CurvePositionAt(progress); var diff = _lastPosition.HasValue ? _lastPosition.Value - newPos : newPos - this.CurvePositionAt(progress + 0.01f); if (diff == Vector2.Zero) { return; } Ball.Position = newPos; Ball.Rotation = -90 + (float)(-Math.Atan2(diff.X, diff.Y) * 180 / Math.PI); _lastPosition = newPos; }; }