1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- 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<Image>().sprite = onSprite;
- }
- else
- {
- this.GetComponent<Image>().sprite = offSprite;
- }
- }
- public void A__ClickSwitch()
- {
- _on = !_on;
- show();
- SettingManager.Instance.changSetting(Flag, _on);
- }
- }
|