Skip to content

Fisixus/CustomUILeaderboard

Repository files navigation

Custom UI Leaderboard

A high-performance, purely sprite-based leaderboard system.

Important

This project is built entirely without Unity UI (Canvas), RectTransforms, or the EventSystem. It utilizes a world-space approach with SpriteRenderers, SpriteMasks, and 3D TextMeshPro, demonstrating advanced UI techniques using standard 2D/3D objects.

A high-performance, virtualized Unity leaderboard system built on the Simon core framework. This project demonstrates advanced UI techniques, including rank-change animations, data-driven layouts, and a custom dependency injection / MVC architecture.

Watch the video


🚀 Key Features

Custom UI Leaderboard

  • Virtualization Engine: Efficiently handles thousands of entries by only spawning and updating items visible in the viewport.
  • Dynamic Rank Animations: Multi-phase rank-change transitions including:
    • Anticipation Nudge: A subtle "wind-up" movement in the direction of the rank change.
    • Smooth Interpolation: Quadratic easing for position, scale, and data (score/rank) updates.
    • Slotting Effect: Other players dynamically shift to make room for the moving "me" player.
  • "Sticky Me" Behavior: The player's own entry is managed persistently, ensuring it's always highlighted and correctly positioned relative to others.
  • Decoupled Service Layer: Mockable leaderboard data fetching through a clean service interface.

Simon Framework (Core)

  • Dependency Injection (DI): A custom, lightweight DI container supporting [Inject] attributes, Contexts (Project/Scene), and automated factory/pool generation.
  • MVC Implementation: Strict separation of concerns using Controller, View, and Model/State patterns.
  • Signal Bus: Type-safe event system for decoupled communication between game systems.
  • Object Pooling: Integrated pooling for UI elements to minimize GC allocations.
  • Serialization: Simplified JSON serialization helpers for data persistence and network communication.

🏗 Architecture Overview

Simon Core Structure

  • Simon.DI: Manages the lifecycle and dependencies of objects via DiContainer and Installers.
  • Simon.MVC: Provides base classes (MvcBase, Viewer) to ensure a consistent architectural flow.
  • Simon.Events: Handles system-wide messaging via Signals.

Leaderboard Implementation

  • LeaderboardController: Coordinates the flow between data updates and the UI.
  • LeaderboardListManager: The engine responsible for virtualization, layout calculations, and rank-change animations.
  • LeaderboardItemViewPool: Manages the lifecycle of individual leaderboard rows.
  • LeaderboardService: Simulates (or fetches) data updates.

🛠 Tech Stack

  • Unity 2022+: Core engine(Unity 6000.3.10).
  • TextMeshPro: High-quality text rendering.
  • DOTween: Powerful animation engine for UI transitions.

📖 How to Use

  1. Open the Scene: Navigate to Assets/Scenes/Loader.unity.
  2. Run: Press Play in the Unity Editor.
  3. Update Data: Click the Update button in the UI to simulate a rank change.
  4. Debug Your Rank: To test specific rank transitions:
    • Select the LeaderboardUpdateButton prefab or instance in the scene.
    • In the Inspector, enable Use Debug Rank.
    • Set the Debug Rank value (e.g., 1 or 1000) to force the "me" player to that position on the next update.
  5. Observe: The "me" player will perform a complex animation to its new rank, while other items shift accordingly.

📁 Project Directory

  • Assets/Scripts/_Simon: The core framework code.
  • Assets/Scripts/_Game: The leaderboard application logic.
  • Assets/Prefabs/Leaderboard: UI templates for the leaderboard and its items.
  • Assets/Settings: Universal Render Pipeline (URP) and Project settings.

About

No description, website, or topics provided.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors