123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using Sirenix.OdinInspector;
- using KairoEngine.UI.InteractionHandler;
- namespace KairoEngine.UI
- {
- [HideMonoScript]
- public class TabButton : MonoBehaviour
- {
- public Button targetButton;
- public Sprite buttonGraphic;
- public Sprite buttonActiveGraphic;
- private bool active = false;
- public void SwitchState()
- {
- if(active)
- {
- active = false;
- targetButton.image.sprite = buttonGraphic;
- }
- else
- {
- active = true;
- targetButton.image.sprite = buttonActiveGraphic;
- }
- }
- public void Activate()
- {
- active = true;
- targetButton.image.sprite = buttonActiveGraphic;
- }
- public void Deactivate()
- {
- active = false;
- targetButton.image.sprite = buttonGraphic;
- }
- }
- }
|