mirror of
https://github.com/boudji-ludwig-pett/cnam-geometry-dash.git
synced 2025-06-10 22:20:40 +02:00
feat: map editor design (#53)
This commit is contained in:
41
Assets/Scripts/PageScript.cs
Normal file
41
Assets/Scripts/PageScript.cs
Normal file
@ -0,0 +1,41 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user