using System; using System.Collections; using System.Collections.Generic; using UI.Hall; using Unity.VisualScripting; using UnityEngine; using UnityEngine.UI; public class SwitchButtonComp : MonoBehaviour { // public GameObject OnDisplay; public Sprite onSprite; public Sprite offSprite; public int Flag; private bool _on; private void Start() { if (Flag == 0) { throw new NotImplementedException(); } _on = SettingManager.Instance.isSettingOpen(Flag); show(); } private void show() { if (_on) { this.GetComponent().sprite = onSprite; } else { this.GetComponent().sprite = offSprite; } } public void A__ClickSwitch() { _on = !_on; show(); SettingManager.Instance.changSetting(Flag, _on); } }