Skip to content

Game.UI.Widgets.IPaged

Assembly: Assembly-CSharp.dll (game assembly)
Namespace: Game.UI.Widgets

Type: interface

Base: None (does not extend other interfaces)

Summary:
IPaged is a small interface used by UI widgets that present paged content (for example, lists, galleries or pagers). It exposes the total number of pages and the currently selected page index so controllers or other UI elements can query and change the visible page. Implementations are responsible for enforcing valid page ranges and updating the visual state when currentPageIndex changes.


Fields

  • None
    This interface declares no fields. Implementing classes will hold any required backing fields/state.

Properties

  • public int pageCount { get; }
    Total number of pages available. Implementations should return a non-negative integer. This is typically used to drive UI controls (e.g., disabling "next" when pageCount <= 1).

  • public int currentPageIndex { get; set; }
    Zero-based index of the currently selected page. Implementations should clamp or validate set values to the valid range (0 .. pageCount - 1) and perform whatever UI updates or events are necessary when the page changes.

Constructors

  • None
    Interfaces do not declare constructors. Concrete implementing classes will provide constructors/initialization logic as needed.

Methods

  • None
    IPaged only exposes properties. Any page-change logic, events or helper methods belong to the implementing type.

Usage Example

using UnityEngine;
using Game.UI.Widgets;

public class SimplePagedWidget : MonoBehaviour, IPaged
{
    [SerializeField] private int m_pageCount = 1;
    private int m_currentPageIndex = 0;

    public int pageCount => Mathf.Max(0, m_pageCount);

    public int currentPageIndex
    {
        get => m_currentPageIndex;
        set
        {
            int clamped = Mathf.Clamp(value, 0, Mathf.Max(0, pageCount - 1));
            if (clamped == m_currentPageIndex) return;
            m_currentPageIndex = clamped;
            RefreshVisiblePage();
        }
    }

    private void RefreshVisiblePage()
    {
        // Update the UI to show the currently selected page.
        // E.g. enable/disable child panels, update page indicators, load page data, etc.
    }
}

Notes and recommendations: - Treat pageCount as authoritative; changes to pageCount should ensure currentPageIndex remains valid (clamp or reset). - Decide whether currentPageIndex is zero-based in your implementation (standard practice is zero-based). - If the UI needs to notify others of page changes, implement events (e.g., OnPageChanged) in the concrete class — the interface intentionally keeps responsibilities minimal.