Back to Casual UI Toolkit

Casual UI Toolkit

Documentation

Overview

Casual UI Toolkit is a set of casual-game UI prefabs (buttons, windows, labels, cards, switches, checkboxes, a progress bar, screen backgrounds) whose colours come from one project-level style asset, together with a set of motion components for them. Each widget carries a recolour component that reads the active style and paints its own graphics. The Editor part is one window, Setup UI, in which you pick or create a style, assign palette swatches, and edit the motion profiles. A sample (three scenes, fourteen views) shows the pieces wired together through EasyViewService.

Assemblies:

Assembly Contents
Ostryzhnyi.CasualUIToolkit Runtime: styles, palette, recolour, gradient image, motion.
Ostryzhnyi.CasualUIToolkit.Pack.Editor Editor only: the Setup UI window, drawers, inspectors, apply pass, gradient baker.
Ostryzhnyi.CasualUIToolkit.Sample Sample views and flow. Safe to delete.

Quick Start

  1. Import the package. Open the demo scene Sample/Scenes/CasualUIToolkitSample.unity.
  2. Open Tools > Ostryzhnyi > CasualUIToolkit > Setup UI.
  3. In the style bar, click Create Active Style Pointer. This creates Assets/CasualUIToolkitGenerated/Resources/Ostryzhnyi/CasualUIToolkit/ActiveStyle.asset.
  4. In the Style dropdown pick one of the shipped styles (ReferenceStyle, ArcadeGreen, NeonPurple, SolarYellow), or click + and enter a name in the Create style window to create a copy of ReferenceStyle.
  5. Every recolour widget in open scenes and in Play Mode repaints at once. Prefab files on disk keep the colours stored in them; the change is live only while widgets are enabled (see Apply pass).
  6. Open the Motion tab to tune the animation profiles. The asset is created on first open.

Switching the style and driving the motion components from code:

using Ostryzhnyi.CasualUIToolkit;
using UnityEngine;

public class Example : MonoBehaviour
{
    [SerializeField] private AppStyle _style;
    [SerializeField] private CasualProgressBar _progress;
    [SerializeField] private CasualSwitch _switch;
    [SerializeField] private CasualBurst _burst;
    [SerializeField] private CasualCounter _counter;
    [SerializeField] private CasualPopup _popup;

    private void Start()
    {
        ActiveStyle.Instance.Style = _style;      // every live RecolourWidget repaints

        _progress.ReachedFull += () => Debug.Log("done");
        _progress.SetValue(0.75f);                // animates to 75%
        _switch.SetValue(true, animate: true, notify: false);
        _burst.Play(Vector2.zero, count: 12);     // stars from a point in the burst rect
        _counter.AddAnimated(50, arrivals: 10);   // rolls in ten steps as arrivals are reported
        StartCoroutine(_popup.Show());
    }
}

ActiveStyle.Instance is null until the pointer asset exists under a Resources folder (step 3).

Runtime API

Namespace Ostryzhnyi.CasualUIToolkit. Protected virtual lifecycle methods (Awake, OnEnable, Update, ...) are overridable but not listed. Every motion component resolves its profile as: own ProfileOverride, else the project MotionSettings profile, else a built-in default.

Styles

ActiveStyle

Responsible for: pointing the project at its current AppStyle. ScriptableObject, menu Ostryzhnyi/Casual UI Toolkit/Active Style.

Member Type Description
ResourcesPath const string "Ostryzhnyi/CasualUIToolkit/ActiveStyle".
Instance ActiveStyle (static) Loaded once from Resources; null when the asset does not exist.
Current AppStyle (static) The active style or null.
Style AppStyle Get/set; setting a different value raises Changed.
Changed event Action Raised when Style changes and on OnValidate.

StyleResolver

Responsible for: choosing between a widget's assigned style and the active style.

Method Description
Resolve(bool useOverride, AppStyle assignedStyle) The assigned style when overriding and it is not null, otherwise ActiveStyle.Current.
Resolve(bool useOverride, AppStyle assignedStyle, AppStyle activeStyle) Same with an explicit fallback.

AppStyle

Responsible for: one complete theme, one ElementStyle per element type. ScriptableObject, menu Ostryzhnyi/Casual UI Toolkit/App Style. Missing sub-styles are created in memory on enable/validate. Button.Text is always linked to the style's Text.

Member Type Description
Button, Window, Icon, Label, Text, Card, Control, Background, Dim, Glow, Particles, Title ButtonStyle, WindowStyle, IconStyle, LabelStyle, TextStyle, CardStyle, ControlStyle, BackgroundStyle, DimStyle, GlowStyle, ParticlesStyle, TitleStyle The element styles.
Changed event Action Raised by NotifyChanged().
Method Description
NotifyChanged() Raises Changed.
EnumerateOwnedStyles() Distinct element styles this style owns.
SyncSubStyleNames() Renames each element style to <style name> <type>; does nothing while the style has no name.
Copy() Deep copy of the style and every element style (baked gradient references are not copied).

ElementStyle

Responsible for: base of every per-type style; abstract ScriptableObject.

Member Type Description
Changed event Action Raised by NotifyChanged() and on OnValidate.
Method Description
TryGetColor(StyleSlot slot, out StyleColor color) Abstract. True only for slots the type declares; false (and default) otherwise.
NotifyChanged() Raises Changed.

Element style types

All derive from ElementStyle, are ScriptableObjects and have a create menu entry Ostryzhnyi/Casual UI Toolkit/Element Styles/<Name> Style. Each property is a StyleColor unless noted. Flat-only slots always return flat mode. Slots marked "declared only" report true from TryGetColor only when a swatch name is set or alpha is above zero (so styles saved before the slot existed are left untouched).

Type Properties (slot)
ButtonStyle Base, Texture, Shadow, ColoredShadow, Outline, Icon; Text (TextStyle, not a slot).
WindowStyle Main, Shadow, ColoredShadow, Text (flat, declared only), BodyText (flat, declared only).
IconStyle Color, Shadow.
LabelStyle Main, ColoredShadow, Shadow, Background, BackgroundShadow, DarkElements.
CardStyle Base, Texture, Shadow, Outline, Text (flat, declared only).
ControlStyle Shadow, Outline, OutlineIn, Background, Fill.
BackgroundStyle Base, Pattern.
DimStyle Main (flat; palette assignment keeps its alpha).
GlowStyle Main.
ParticlesStyle Main (declared only); Sprites (List<Sprite>).
TextStyle Color, Shadow, Outline (all flat); MaterialPresets (IReadOnlyList<TextMaterialPreset>). Methods TryGetMaterialPreset(TMP_FontAsset, out Material) and SetMaterialPreset(TMP_FontAsset, Material) (null material removes the entry; throws ArgumentNullException for a null font).
TitleStyle : TextStyle Adds SourceMaterial and Material (Material); the Editor bakes Material from SourceMaterial with only the colours changed.

StyleSlot

Enum, values in order (only ever appended, serialized as integers): Base, Texture, Shadow, Outline, Main, Color, Icon, ColoredShadow, Background, BackgroundShadow, DarkElements, OutlineIn, Fill, Pattern, Text, BodyText.

StyleColor

Responsible for: one slot value, either a flat colour or a gradient. [Serializable] struct.

Member Type Description
Mode StyleColorMode Flat or Gradient.
Color Color Flat colour.
Gradient Gradient Gradient (created on first read).
GradientDirection GradientDirection Horizontal or Vertical.
SwatchName string Name of the palette swatch the value was copied from.
RampTexture, Material Texture2D, Material Baked by the Editor; null for flat slots or before a bake.
Method Description
StyleColor(StyleColorMode mode, Color color, Gradient gradient = null, string swatchName = null, GradientDirection gradientDirection = Horizontal) Constructor.
Evaluate(float time) Gradient colour at time (clamped to 0-1), or the flat colour.
Copy() Deep copy without the baked references.

Enums: StyleColorMode (Flat, Gradient), GradientDirection (Horizontal, Vertical).

Attributes

  • FlatColorOnlyAttribute - the StyleColor field has no gradient mode.
  • PreserveAlphaAttribute - assigning a swatch keeps the slot's alpha.
  • OptionalOverrideAttribute - draws an object field behind an Override toggle.

Palette

  • Palette (ScriptableObject, menu Ostryzhnyi/Casual UI Toolkit/Palette): Groups (List<PaletteGroup>); TryFindSwatch(string swatchName, out PaletteSwatch swatch) returns false for an empty or unknown name.
  • PaletteGroup (serializable): Name, Swatches (List<PaletteSwatch>); constructor PaletteGroup(string name).
  • PaletteSwatch (serializable): Name, Value (StyleColor); constructor PaletteSwatch(string name, StyleColor value); ToSlotValue() returns a deep copy carrying the swatch name.
  • TextMaterialPreset (serializable): Font (TMP_FontAsset), Material; constructors () and (TMP_FontAsset, Material).

Recolouring

RecolourWidget

Responsible for: painting the graphics listed in Layers from the element style its StyleKind selects. MonoBehaviour, [ExecuteAlways], one per object. Repaints on enable, on ActiveStyle change and when the resolved style changes.

Member Type Description
StyleKind RecolourStyleKind Element type this widget paints from.
UseOverride bool Paint from AssignedStyle instead of the active style.
AssignedStyle ElementStyle Used only when UseOverride is on and its type matches StyleKind; a mismatched style is ignored.
Layers List<RecolourLayer> Graphic and slot pairs.
AllowedSlots IReadOnlyList<StyleSlot> Slots valid for StyleKind.
Method Description
Paint() Paints each layer. With no resolved style, a layer that has an applied colour paints that; other layers are untouched. A slot the style does not declare is skipped.
TryResolveLayerColor(RecolourLayer layer, out StyleColor color) The colour Paint() would use; false with no style, no graphic or an undeclared slot.
StyleTypeFor(RecolourStyleKind kind) (static) The ElementStyle type for a kind.
ApplyColor(Graphic, StyleColor) (protected virtual) TMP text: writes Graphic.color. GradientImage with a baked material: uses the material and white renderer colour. Others: writes the CanvasRenderer colour (gradient mid-tone when no baked material).
ResolveElementStyle() (protected virtual) The style to paint from.

RecolourStyleKind: Button, Window, Icon, Label, Card, Control, Background, Dim, Glow (append-only).

AllowedSlots by kind: Button - Base, Texture, Shadow, Outline, Icon, ColoredShadow; Window - Main, Shadow, ColoredShadow, Text, BodyText; Icon - Color, Shadow; Label - Main, ColoredShadow, Shadow, Background, BackgroundShadow, DarkElements; Card - Base, Texture, Shadow, Outline, Text; Control - Shadow, Outline, OutlineIn, Background, Fill; Background - Base, Pattern; Dim and Glow - Main.

RecolourLayer

[Serializable] class pairing one graphic with one slot. Constructors () and (Graphic graphic, StyleSlot slot).

Member Type Description
Graphic Graphic The painted graphic (an Image, GradientImage or TMP text).
Slot StyleSlot The slot it reads.
HasAppliedColor bool True once the apply pass stored a colour.
AppliedColor Color The stored colour; meaningful only when HasAppliedColor.

SetAppliedColor(Color) stores a colour and sets HasAppliedColor. The colour lives on the layer rather than on the graphic because live painting tints through the renderer, which multiplies with the graphic's own colour.

RecolourText

Responsible for: painting a TMP text from the global Text or Title style. MonoBehaviour, [ExecuteAlways], one per object.

Member Type Description
Text TMP_Text Defaults to the component on the same object.
Role RecolourTextRole Text or Title.
UseOverride bool Use AssignedStyle.
AssignedStyle TextStyle Override style.

Paint() (virtual) sets the text colour and, for a TitleStyle, its baked material when it matches the font's atlas; for other styles the material preset for the text's font, else the font's material.

GradientImage

Image subclass (Add Component > UI > Ostryzhnyi > Casual UI Toolkit > Gradient Image) that writes rect-normalised coordinates to uv1 so one ramp spans a sliced or atlas-packed graphic. It adds TexCoord1 to the parent canvas's additional shader channels (a canvas-wide setting).

Member Type Description
RampMaterial Material Baked gradient material used instead of the graphic's own; null to use the graphic's material.

GradientRamp

Static. Sample(Gradient gradient, int resolution) returns resolution colours from time 0 to 1 inclusive; throws ArgumentNullException for a null gradient and ArgumentOutOfRangeException for a resolution below 2.

Motion profiles

MotionProfile is the abstract ScriptableObject base. MotionSettings (menu Ostryzhnyi/Casual UI Toolkit/Motion Settings) holds one profile per type: Instance (static, loaded from Resources/Ostryzhnyi/CasualUIToolkit/MotionSettings, may be null), Changed, Invalidate() (static, clears the cached lookup), and properties Button, Switch, Toggle, ProgressBar, Popup, Idle, Nope, Particles, Glow, Burst, StarSequence, FlyToTarget, Counter, Shine, Entrance, ProgressSpark, plus DimAmount (default 0.6, 0-1; amount graphics are dimmed to while a switch is off or a control is disabled).

MotionProfileResolver.Resolve<T>(T overrideProfile, T projectProfile) returns the override, else the project profile, else a cached hidden built-in instance.

Defaults (properties are the capitalised field names; Easy values come from Core's tween library):

Profile Defaults
ButtonMotionProfile HoverScale 1.07, HoverEase EaseOutBack, HoverDuration 0.25, PressScale (1.10, 0.88), PressDuration 0.07, BaseSinkOffset (0, -6), ReleaseDuration 0.55, ReleaseEase EaseOutElastic, BaseReturnEase EaseOutBack, ExitDuration 0.2
SwitchMotionProfile SlideDuration 0.35, SlideEase EaseOutBack, StretchAmount 1.28, StretchEase EaseOutElastic
ToggleMotionProfile PopEase EaseOutElastic, PopDuration 0.4, PopRotationFromDegrees -35, ShrinkDuration 0.18, ShrinkEase EaseInBack, WobbleDuration 0.35, WobbleScale (1.12, 0.88), WobbleEase EaseOutElastic
ProgressBarMotionProfile ChangeDuration 0.5, ChangeEase EaseOutBack, PunchScale 1.06, PunchEase EaseOutElastic, PunchDuration 0.35
PopupMotionProfile OpenScaleFrom 0.5, OpenEase EaseOutBack, OpenDuration 0.3, CascadeStagger 0.08, CloseDuration 0.2, CloseEase EaseInBack
IdleMotionProfile Period 1.7, PositionOffset (0, 4, 0), ScaleOffset (0.02, -0.02, 0), Ease EaseInOutSine
NopeMotionProfile WeakPressScale (0.97, 0.97), WeakPressDuration 0.05, WeakPressEase EaseOut, ShakeDuration 0.3, ShakeAmplitude 8, ShakeDecayEase EaseOutCubic
ParticlesMotionProfile MaxCount 12, SpawnInterval 0.45, Lifetime 6, FadeDuration 1, SpeedRange (12, 28), SizeRange (24, 72), Prewarm true
GlowMotionProfile PulsePeriod 2.2, AlphaRange (0.6, 1), SwayAmplitude 15, SwayPeriod 3.1
BurstMotionProfile Count 12, SpeedRange (180, 360), SpreadAngle 60, Gravity 500, Lifetime 0.8, SizeRange (16, 32)
StarSequenceMotionProfile StampScale 1.6, StampDuration 0.35, GapBetweenStars 0.25, ShakeAmplitude 8, ShakeDuration 0.2, SparkCount 6
FlyToTargetMotionProfile IconCount 10, Stagger 0.04, SpreadRadius 60, FlightDuration 0.6, ArcHeight 120
CounterMotionProfile RollDuration 0.5, PunchScale 1.25, PunchDuration 0.15
ShineMotionProfile Interval 3.5, SweepDuration 0.6, BandWidth 60
EntranceMotionProfile Stagger 0.05, PopDuration 0.18, OvershootEase EaseOutBack
ProgressSparkMotionProfile ShedInterval 0.15, FadeOutDuration 0.3

All motion runs on unscaled time, so it keeps playing at Time.timeScale 0.

Controls

Every control component below sits beside a native Selectable and animates its Layers child, never the root, so the hit area does not move. Each has ResolvedProfile (its profile type) and, except where noted, ProfileOverride.

CasualButton

Responsible for: hover, press and release motion of a button or card. Requires Button; forces the button's transition off. Implements pointer and selection handlers (OnPointerEnter, OnPointerExit, OnPointerDown, OnPointerUp, OnSelect, OnDeselect, all virtual).

Member Type Description
Layers Transform The animated visual. Assign in the Inspector.
Base Transform Layer that sinks on press; leave empty for a card (press is then scale only).
ActivitySignal ElementActivitySignal Active while a hover/press/release tween runs; CasualIdle pauses on it.
ResolvedProfile ButtonMotionProfile Resolved profile.

While the button's own interactable is false, its motion is left to CasualDisabledFeedback. Keyboard or gamepad selection shows the hover treatment.

CasualSwitch

Responsible for: slide and stretch of a switch knob. Requires Toggle; clears the toggle's transition and checkmark graphic. Moves Bar between the track ends computed from the current rect (a resize keeps the knob flush) and dims it while off through DimChannel. A value set with SetIsOnWithoutNotify is picked up on the next frame without animation.

Member Type Description
Bar RectTransform The knob and its highlight. Assign in the Inspector.
ActivitySignal, ResolvedProfile As above (SwitchMotionProfile).
Method Description
SetValue(bool value, bool animate = true, bool notify = true) Sets the switch. notify false suppresses onValueChanged; animate false snaps.

CasualToggle

Responsible for: checkmark pop/shrink and box wobble of a checkbox. Requires Toggle. Do not assign CheckIcon as Toggle.graphic; the native toggle fades that graphic and fights the tween.

Member Type Description
Layers Transform The box that wobbles.
CheckIcon Transform The checkmark that pops in and shrinks out.
ActivitySignal, ResolvedProfile As above (ToggleMotionProfile).

SetValue(bool value, bool animate = true, bool notify = true) as for CasualSwitch.

CasualProgressBar

Responsible for: a 0-1 bar that grows with overshoot and punches when it reaches 1. Drives Bar's right anchor within its track.

Member Type Description
Value float Current clamped value. Initial value 1.
Bar RectTransform The growing bar.
Layers Transform Whole element, punched on reaching 1.
DisplayedValueChanged event Action<float> Every frame the shown value changes during a tween (may briefly overshoot 0-1).
Settled event Action<float> When the value has settled at its target.
ReachedFull event Action When the value settles at exactly 1.
ActivitySignal, ResolvedProfile As above (ProgressBarMotionProfile).

SetValue(float value, bool animate = true): clamps to 0-1; without animate the bar snaps and Settled fires immediately.

CasualDisabledFeedback

Responsible for: dimming a non-interactable control and refusing its clicks with a squash and shake. Requires a Selectable; sits beside CasualButton, CasualSwitch or CasualToggle. Polls the control's own interactable flag each frame; a non-interactable parent CanvasGroup does not count. Members: Layers (Transform, graphics under it are dimmed and it is shaken), ActivitySignal, ResolvedProfile (NopeMotionProfile), OnPointerClick(PointerEventData) (virtual).

CasualShine

Responsible for: a periodic light band swept across a button. Requires a Selectable; pauses while it is not interactable.

Member Type Description
Clip RectTransform Clipping rect defining the sweep bounds.
Band Image The band that moves.
IsSweeping bool True while the band travels.
ProfileOverride, ResolvedProfile ShineMotionProfile.

Popups and screens

CasualPopup

Responsible for: a cascade open and an anticipating close. Owns one transition coroutine; calling Show() during a close (or the reverse) reverses from the current pose without a snap.

Member Type Description
Backdrop CanvasGroup Backdrop fade.
Panel CanvasGroup Panel scale and fade; parent of ContentRoot.
ContentRoot Transform Its direct children cascade in on open.
CascadeOrder List<Transform> Explicit cascade order; overrides ContentRoot's child order when not empty.
IsOpen bool True once Show() has settled; false once Hide() has.
Opened, Closed event Action Raised when the transition settles.
ResolvedProfile PopupMotionProfile Resolved profile.
Method Description
Show() Coroutine (IEnumerator): activates, fades the backdrop, scales the panel with overshoot, cascades the content.
Hide() Coroutine: shrinks and fades the panel, fades the backdrop, then deactivates.

CasualPopupStrategy

Responsible for: using a CasualPopup as the animation strategy of an EasyViewService BaseView (derives from BaseAnimationStrategy). Put it beside the BaseView.

Member Type Description
Popup CasualPopup Popup to animate; defaults to the one on the same object.
Show(), Hide() IEnumerator (override) Forward to the popup; Hide() then deactivates the view object.

CasualStaggerEntrance

Responsible for: popping a list of targets into view in order whenever its object is enabled.

Member Type Description
ContentRoot Transform Its direct children are used when Targets is empty.
Targets List<Transform> Explicit ordered targets.
IsPlaying bool True while a target is still entering.
ProfileOverride, ResolvedProfile EntranceMotionProfile.

CasualStarSequence

Responsible for: stamping earned stars into their slots one by one with a shake and a spark burst. Slots reset to the empty look on enable.

Member Type Description
StarSlots List<Transform> Ordered star slots (the fill layer). Keep them out of CasualPopup.CascadeOrder.
ShakeTarget RectTransform Shaken on each landing.
Burst CasualBurst Spark burst per star.
Popup CasualPopup When set and not open, Play waits for Opened.
ProfileOverride, ResolvedProfile StarSequenceMotionProfile.

Play(int earned) clamps earned to 0-StarSlots.Count and starts the sequence.

CasualEdgeFade

Responsible for: fading content to transparent along one edge of a RectMask2D (requires one).

Member Type Description
Edge RectTransform.Edge The fading edge; default Top.
FadeLength float Fade length; negative values become 0.

Changing either applies immediately. The component adds a CanvasGroup to each direct child so the fade reaches zero alpha at the edge.

Ambient motion

CasualIdle

Responsible for: an attention bob on unscaled time that yields to every one-shot motion. Pauses while any sibling motion component's ActivitySignal is active, and resumes from phase zero.

Member Type Description
Layers Transform The offset visual.
PlayOnEnable bool Start on enable; default true.
IsPlaying bool True between Play() and Stop(), even while paused by a one-shot.
ProfileOverride, ResolvedProfile IdleMotionProfile.

Play() starts or resumes the loop; Stop() halts it and returns Layers to rest.

CasualGlowMotion

Pulses a glow's CanvasGroup.alpha and sways its Z rotation, on a channel separate from recolouring. Requires CanvasGroup. Restores the authored alpha and rotation on disable; does nothing outside Play Mode. Members: ProfileOverride, ResolvedProfile (GlowMotionProfile).

CasualParticles

A pooled uGUI background-particle emitter. Requires Canvas. Sprites and colour come from the active style's Particles; timing comes from ParticlesMotionProfile. With Prewarm on it starts with a full steady-state population. Members: ProfileOverride, ResolvedProfile.

Effects

CasualBurst

Responsible for: one-shot star or ray particles from a point. Colour comes from the active style's Glow unless given.

Member Type Description
StarSprite, RaySprite Sprite Sprites for the two modes.
RayMode bool Use RaySprite instead of StarSprite.
ProfileOverride, ResolvedProfile BurstMotionProfile.
Method Description
Play(Vector2 localPoint, int count = -1, float scaleMultiplier = 1f) Burst at a point in this object's local rect. count -1 uses the profile's Count.
Play(Vector2 localPoint, Sprite sprite, int count = -1, float scaleMultiplier = 1f) With an explicit sprite (white tint).
Play(Vector2 localPoint, Color color, int count = -1, float scaleMultiplier = 1f) With an explicit colour.
Play(Vector2 localPoint, Sprite sprite, Color color, int count = -1, float scaleMultiplier = 1f) Both.
Play(Vector2 screenPoint, Camera camera, int count = -1, float scaleMultiplier = 1f) Converts a screen point first.

CasualCounter

Responsible for: a TMP number that rolls to new values with an icon punch per arrival.

Member Type Description
Label TMP_Text Displayed number.
Icon RectTransform Punched on each arrival; also the flight target of CasualFlyToTarget.
Value int Current target value.
ArrivalCount int Arrivals reported since the last AddAnimated.
ProfileOverride, ResolvedProfile CounterMotionProfile.
Method Description
SetValue(int value) Sets the value at once, no animation.
AddAnimated(int delta, int arrivals) Queues delta (negative treated as 0) split evenly across arrivals steps; with arrivals 0 or less adds it at once.
NotifyArrival() Applies the next queued step with a roll and a punch; does nothing when none is queued.
Complete() Applies every queued step, stops animation and shows the final value. Also runs on disable.

CasualFlyToTarget

Responsible for: reward icons that burst out of a point and fly in an arc to a CasualCounter's icon; each arrival calls Counter.NotifyArrival().

Member Type Description
Layer RectTransform Space the icons live in; defaults to this object.
Sprite Sprite Icon sprite.
Counter CasualCounter Target counter. Play does nothing without one.
ActiveIconCount, PooledIconCount int Icons in flight; icons created.
ProfileOverride, ResolvedProfile FlyToTargetMotionProfile.
Method Description
Play(Vector2 sourcePoint, int reward, int count = -1) Completes any running flight, queues reward on the counter over count arrivals (-1 uses IconCount) and spawns the icons.
Complete() Hides all icons and completes the counter.

CasualProgressSpark

Tracks a progress bar's fill edge, sheds stars while it advances and bursts at full.

Member Type Description
ProgressBar CasualProgressBar Bar to follow.
Spark RectTransform The spark.
SparkCanvasGroup CanvasGroup Spark visibility.
Burst CasualBurst Star shedding and the full burst.
IsVisible bool Spark alpha above 0.
ProfileOverride, ResolvedProfile ProgressSparkMotionProfile.

WaitForCompletionEffect() returns an IEnumerator that waits until the full-value effect has finished.

Motion helpers

Public building blocks used by the components; most projects do not call them.

Type Description
ButtonMotionModel Pure C# button state machine: PointerEnter(), PointerExit(), PointerDown(), PointerUp(), Select(), Deselect() each return a ButtonMotionTarget; ReleaseFinished() settles a completed release.
ButtonMotionTarget Readonly struct: HasTarget, Scale, ScaleEase, BaseOffset, BaseEase, Duration; None.
ElementActivitySignal Ref-counted Begin() / End() with IsActive.
LayerPoseHelper Applies a BasePose plus an idle offset to a Layers transform: BasePose, Apply(MotionPose idleOffset).
MotionPose Readonly struct Position, Scale; + operator.
DimChannel SetDimAmount(Graphic, float) multiplies a graphic's RGB on the channel recolouring does not use; Restore(Graphic) returns the authored colour. Play Mode only.
ProgressBarLayout Compute(float value, float trackWidth, float minWidth) returns a ProgressBarLayoutResult (AnchorMax, SizeDelta, IsVisible).
DelegateVector3Tween A Core Tween over getter/setter delegates: DelegateVector3Tween(Func<Vector3> getValue, Action<Vector3> setValue, Vector3 endValue, float duration).

Sample types

Assembly Ostryzhnyi.CasualUIToolkit.Sample, namespace Ostryzhnyi.CasualUIToolkit.Sample (views: .Views). Not part of the toolkit API; safe to delete.

  • SampleFlow (MonoBehaviour): Initialize(IViewService) and StartFlow() (virtual). Subscribes to every view's events and maps them to ShowView / HideView calls. Serialized Loading Duration (default 1 s). Starts the flow in Start, beginning with LoadingWindowView.
  • SampleView : BaseView (abstract): helpers Listen / StopListening for buttons.
  • FieldTapArea: raises LeftTapped or RightTapped by which half of the screen was clicked.
  • Views, each raising events for its buttons: LoadingWindowView (Completed, Play(float duration)), MainMenuWindowView (PlayRequested, LevelRequested, LevelIdles, CurrentLevelIndex), BottomPanelView (DailyRequested, MissionRequested, ShopRequested, SettingsRequested), GameplayHudView (PauseRequested, LeftFieldTapped, RightFieldTapped, OutOfBoosterRequested), PausePopupView (CloseRequested, ContinueRequested, RestartRequested, SettingsRequested, ExitRequested), SettingsPopupView (CloseRequested, PrivacyPolicyRequested, TermsOfUseRequested), LevelCompletePopupView (ChestRequested, CloseRequested), LevelFailedPopupView (RetryRequested, ExtraTimeRequested, ExitRequested), ChestOpenPopupView (RewardRequested, GetKeysRequested), RewardPopupView (PlayRequested), DailyRewardPopupView (CloseRequested, RewardRequested), ShopPopupView, MissionPopupView (CloseRequested), OutOfBoosterPopupView (CloseRequested, BuyRequested, AdsRequested).