protected override void Update() { base.Update(); if (!initialStateCache.IsValid) { foreach (var cached in hitObjectInitialStateCache.Values) { cached.Invalidate(); } switch (direction.Value) { case ScrollingDirection.Up: case ScrollingDirection.Down: scrollLength = DrawSize.Y; break; default: scrollLength = DrawSize.X; break; } scrollingInfo.Algorithm.Reset(); foreach (var obj in Objects) { computeLifetimeStartRecursive(obj); computeInitialStateRecursive(obj); } initialStateCache.Validate(); } }
protected override void Update() { base.Update(); MiscGeometryLayoutValue.Validate(); DrawSizeLayoutValue.Validate(); }
private void computeScreenSpaceCharacters() { if (!parentScreenSpaceCache.IsValid) { localScreenSpaceCache.Invalidate(); parentScreenSpaceCache.Validate(); } if (localScreenSpaceCache.IsValid) { return; } screenSpaceCharactersBacking.Clear(); Vector2 inflationAmount = DrawInfo.MatrixInverse.ExtractScale().Xy; foreach (var character in Characters) { screenSpaceCharactersBacking.Add(new ScreenSpaceCharacterPart { DrawQuad = ToScreenSpace(character.DrawRectangle.Inflate(inflationAmount)), InflationPercentage = Vector2.Divide(inflationAmount, character.DrawRectangle.Size), Texture = character.Texture }); } localScreenSpaceCache.Validate(); }
protected override void Update() { base.Update(); if (!parentAdjustmentLayout.IsValid) { refreshAdjustments(); parentAdjustmentLayout.Validate(); } }
protected override void Update() { base.Update(); if (!flashlightProperties.IsValid) { FlashlightPosition = taikoPlayfield.HitTarget.ToSpaceOfOtherDrawable(taikoPlayfield.HitTarget.OriginPosition, this); flashlightProperties.Validate(); } }
protected override void Update() { base.Update(); if (!fromParentLayout.IsValid) { refreshLayoutFromParent(); fromParentLayout.Validate(); } }
protected override void Update() { base.Update(); if (confineHostCursor && !cursorRectCache.IsValid) { updateHostCursorConfineRect(); cursorRectCache.Validate(); } }
protected override void Update() { base.Update(); if (!subtractionCache.IsValid && DrawWidth > 0) { // TODO : maybe do something subtractionCache.Validate(); } }
protected override void Update() { base.Update(); if (!columnDefinitionCache.IsValid) { computeColumnDefinitions(); columnDefinitionCache.Validate(); } }
protected override void UpdateAfterChildren() { base.UpdateAfterChildren(); if (!rowDefinitionCache.IsValid) { computeRowDefinitions(); rowDefinitionCache.Validate(); } }
protected override void Update() { base.Update(); if (!layoutCache.IsValid) { toComputeLifetime.Clear(); foreach (var hitObject in Objects) { if (hitObject.HitObject != null) { toComputeLifetime.Add(hitObject); } } layoutComputed.Clear(); scrollingInfo.Algorithm.Reset(); switch (direction.Value) { case ScrollingDirection.Up: case ScrollingDirection.Down: scrollLength = DrawSize.Y; break; default: scrollLength = DrawSize.X; break; } layoutCache.Validate(); } foreach (var hitObject in toComputeLifetime) { hitObject.LifetimeStart = computeOriginAdjustedLifetimeStart(hitObject); } toComputeLifetime.Clear(); // only AliveObjects need to be considered for layout (reduces overhead in the case of scroll speed changes). foreach (var obj in AliveObjects) { if (layoutComputed.Contains(obj)) { continue; } updateLayoutRecursive(obj); layoutComputed.Add(obj); } }
protected override void Update() { base.Update(); if (!gridCache.IsValid) { ClearInternal(); CreateContent(); gridCache.Validate(); } }
protected override void Update() { base.Update(); if (!layoutCache.IsValid) { foreach (var state in hitObjectInitialStateCache.Values) { state.Cache.Invalidate(); } combinedObjCache.Invalidate(); scrollingInfo.Algorithm.Reset(); layoutCache.Validate(); } if (!combinedObjCache.IsValid) { switch (direction.Value) { case ScrollingDirection.Up: case ScrollingDirection.Down: scrollLength = DrawSize.Y; break; default: scrollLength = DrawSize.X; break; } foreach (var obj in Objects) { if (!hitObjectInitialStateCache.TryGetValue(obj, out var state)) { state = hitObjectInitialStateCache[obj] = new InitialState(new Cached()); } if (state.Cache.IsValid) { continue; } state.ScheduledComputation?.Cancel(); state.ScheduledComputation = computeInitialStateRecursive(obj); computeLifetimeStartRecursive(obj); state.Cache.Validate(); } combinedObjCache.Validate(); } }
protected override void Update() { base.Update(); if (!flashlightProperties.IsValid) { FlashlightSize = new Vector2(DrawWidth, FlashlightSize.Y); FlashlightPosition = DrawPosition + DrawSize / 2; flashlightProperties.Validate(); } }
protected override void Update() { base.Update(); if (!flashlightProperties.IsValid) { var flashlightPosition = rushPlayfield.OverPlayerEffectsContainer.ToSpaceOfOtherDrawable(rushPlayfield.OverPlayerEffectsContainer.OriginPosition, this); flashlightPosition.X += RushPlayfield.HIT_TARGET_OFFSET; FlashlightPosition = flashlightPosition; flashlightProperties.Validate(); } }
protected override void Update() { if (!layout.IsValid) { //adjust shadow alpha based on highest component intensity to avoid muddy display of darker text. //squared result for quadratic fall-off seems to give the best result. var avgColour = (Color4)DrawColourInfo.Colour.AverageColour; spriteShadow.Alpha = MathF.Pow(Math.Max(Math.Max(avgColour.R, avgColour.G), avgColour.B), 2); layout.Validate(); } }
protected override void Update() { base.Update(); if (flashlightProperties.IsValid) { return; } FlashlightSize = new Vector2(DrawSize.X * flashLightMultiple, DrawHeight); FlashlightPosition = new Vector2(DrawPosition.X, 0) + (scrollingDirection == KaraokeScrollingDirection.Right ? DrawSize : new Vector2()); flashlightProperties.Validate(); }
protected override void Update() { base.Update(); if (!flashlightProperties.IsValid) { FlashlightPosition = ToLocalSpace(taikoPlayfield.HitTarget.ScreenSpaceDrawQuad.Centre); ClearTransforms(targetMember: nameof(FlashlightSize)); FlashlightSize = getSizeFor(Combo.Value); flashlightProperties.Validate(); } }
protected override void Update() { base.Update(); if (!drawSizeLayout.IsValid) { Padding = new MarginPadding { Left = DrawHeight * SHEAR, Bottom = 10 }; drawSizeLayout.Validate(); } }
protected override void Update() { base.Update(); if (!subtractionCache.IsValid && DrawHeight > 0) { if (judgementLineBodySprite.Texture != null) { judgementLineBodySprite.Width = getWidth(judgementLineBodySprite); } subtractionCache.Validate(); } float getWidth(Sprite s) => s.Texture?.DisplayWidth ?? 0; }
protected override void Update() { base.Update(); // unable to get texture size on OnLoadComplete event, so use this way. if (!imageLoaded && InternalChild.Width != 0) { computeImageSize(); imageLoaded = true; } if (!widthSizeCache.IsValid) { computeImageSize(); widthSizeCache.Validate(); } }
protected override void Update() { base.Update(); if (!layoutCache.IsValid) { toComputeLifetime.Clear(); foreach (var hitObject in Objects) { if (hitObject.HitObject != null) { toComputeLifetime.Add(hitObject); } } layoutComputed.Clear(); scrollingInfo.Algorithm.Reset(); switch (direction.Value) { case ScrollingDirection.Up: case ScrollingDirection.Down: scrollLength = DrawSize.Y; break; default: scrollLength = DrawSize.X; break; } layoutCache.Validate(); } foreach (var hitObject in toComputeLifetime) { hitObject.LifetimeStart = computeOriginAdjustedLifetimeStart(hitObject); } toComputeLifetime.Clear(); }
protected override void Update() { base.Update(); if (!subtractionCache.IsValid) { subtractionLayer.Width = 5; subtractionLayer.Height = Math.Max(0, DrawHeight - DrawWidth); subtractionLayer.EdgeEffect = new EdgeEffectParameters { Colour = Color4.White, Type = EdgeEffectType.Glow, Radius = DrawWidth }; Foreground.ForceRedraw(); subtractionContainer.ForceRedraw(); subtractionCache.Validate(); } }
protected override void Update() { base.Update(); if (layoutCache.IsValid) { return; } layoutComputed.Clear(); // Reset lifetime to the conservative estimation. // If a drawable becomes alive by this lifetime, its lifetime will be updated to a more precise lifetime in the next update. foreach (var entry in Entries) { entry.SetInitialLifetime(); } scrollingInfo.Algorithm.Reset(); layoutCache.Validate(); }
/// <summary> /// Compute character textures and positions. /// </summary> private void computeCharacters() { // Note : this feature can only use in osu-framework // if (LoadState >= LoadState.Loaded) // ThreadSafety.EnsureUpdateThread(); if (store == null) { return; } if (charactersCache.IsValid) { return; } charactersBacking.Clear(); Debug.Assert(!isComputingCharacters, "Cyclic invocation of computeCharacters()!"); isComputingCharacters = true; TextBuilder textBuilder = null; try { if (string.IsNullOrEmpty(displayedText)) { return; } textBuilder = CreateTextBuilder(store); textBuilder.AddText(displayedText); if (rubies?.Any() ?? false) { var rubyTextBuilder = CreateRubyTextBuilder(store); rubies.ForEach(x => rubyTextBuilder.AddText(x)); } if (romajies?.Any() ?? false) { var romajiTextBuilder = CreateRomajiTextBuilder(store); romajies.ForEach(x => romajiTextBuilder.AddText(x)); } } finally { if (requiresAutoSizedWidth) { base.Width = (textBuilder?.Bounds.X ?? 0) + Padding.Right; } if (requiresAutoSizedHeight) { var romajiHeight = (ReserveRomajiHeight || (Romajies?.Any() ?? false)) ? RomajiFont.Size : 0; base.Height = (textBuilder?.Bounds.Y ?? 0) + romajiHeight + Padding.Bottom; } base.Width = Math.Min(base.Width, MaxWidth); isComputingCharacters = false; charactersCache.Validate(); } }