mirror of
https://github.com/boudji-ludwig-pett/cnam-geometry-dash.git
synced 2025-04-17 18:56:18 +02:00
42 lines
810 B
C#
42 lines
810 B
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class PageScript : MonoBehaviour
|
|
{
|
|
public List<GameObject> buttons;
|
|
public int visibleCount = 4;
|
|
private int currentIndex = 0;
|
|
|
|
public void ShowNext()
|
|
{
|
|
if (currentIndex + visibleCount < buttons.Count)
|
|
{
|
|
currentIndex++;
|
|
UpdateVisibility();
|
|
}
|
|
}
|
|
|
|
public void ShowPrevious()
|
|
{
|
|
if (currentIndex > 0)
|
|
{
|
|
currentIndex--;
|
|
UpdateVisibility();
|
|
}
|
|
}
|
|
|
|
void Start()
|
|
{
|
|
UpdateVisibility();
|
|
}
|
|
|
|
void UpdateVisibility()
|
|
{
|
|
for (int i = 0; i < buttons.Count; i++)
|
|
{
|
|
buttons[i].SetActive(i >= currentIndex && i < currentIndex + visibleCount);
|
|
}
|
|
}
|
|
}
|