123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- using UnityEngine;
- using UnityEngine.SceneManagement;
- public class Scene1Ctrl : MonoBehaviour
- {
- public LatticeButton m_defaultSelectBtn;
- public LatticeButton m_level2DefaultSelectBtn;
- public GameObject m_level2Obj;
- public LatticeButton m_deleteLevel1Btn;
- public LatticeButton m_deleteLevel2Btn;
- public LatticeButton m_backBtn;
- public void OnDoubleTapCallBack()
- {
- CloseLevel2();
- }
- void Start()
- {
- LatticeBrain.FocusLevel(m_defaultSelectBtn.level);
- LatticeBrain.SelectButton(m_defaultSelectBtn);
- LatticeBrain.Brain.OnDoubleTap += OnDoubleTapCallBack;
- m_defaultSelectBtn.onClick.AddListener(OnClick);
- m_level2DefaultSelectBtn.onClick.AddListener(CloseLevel2);
- m_deleteLevel1Btn.onClick.AddListener(DeleteLevel1);
- m_deleteLevel2Btn.onClick.AddListener(DeleteLevel2);
- m_backBtn.onClick.AddListener(BackToMainScene);
- }
- private void BackToMainScene()
- {
- SceneManager.LoadScene("SampleMain");
- }
- private void DeleteLevel1()
- {
- LatticeBrain.RemoveButton(m_deleteLevel1Btn);
- }
- private void DeleteLevel2()
- {
- LatticeBrain.RemoveButton(m_deleteLevel2Btn);
- }
- private void CloseLevel2()
- {
- m_level2Obj.SetActive(false);
- LatticeBrain.FocusLevel(m_defaultSelectBtn.level);
- }
- private void OnClick()
- {
- m_level2Obj.SetActive(true);
- LatticeBrain.SelectButton(m_level2DefaultSelectBtn, true);
- }
- // Update is called once per frame
- void Update()
- {
- }
- }
|