You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1021 B
C#
45 lines
1021 B
C#
1 month ago
|
using System;
|
||
|
using UnityEngine;
|
||
|
using System.Collections.Generic;
|
||
|
|
||
|
namespace WalletConnectUnity.UI
|
||
|
{
|
||
|
public class WCTabsController : MonoBehaviour, ITabsController
|
||
|
{
|
||
|
[SerializeField] protected List<WCTabPage> pages = new();
|
||
|
[SerializeField] protected WCTabsBar tabsBar;
|
||
|
|
||
|
public event EventHandler<WCTabPage> PageSelected;
|
||
|
|
||
|
protected bool isInitialized;
|
||
|
|
||
|
public virtual void Initialize()
|
||
|
{
|
||
|
if (isInitialized) return;
|
||
|
|
||
|
tabsBar.Initialize(this);
|
||
|
|
||
|
isInitialized = true;
|
||
|
}
|
||
|
|
||
|
public virtual void Enable(object parameters)
|
||
|
{
|
||
|
tabsBar.Enable(pages);
|
||
|
}
|
||
|
|
||
|
public virtual void Disable()
|
||
|
{
|
||
|
tabsBar.Disable();
|
||
|
}
|
||
|
|
||
|
public void SelectPage(WCTabPage page)
|
||
|
{
|
||
|
foreach (var p in pages)
|
||
|
{
|
||
|
p.PageTransform.gameObject.SetActive(p == page);
|
||
|
}
|
||
|
|
||
|
PageSelected?.Invoke(this, page);
|
||
|
}
|
||
|
}
|
||
|
}
|