| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class JCFruitMaster : MonoBehaviour
- {
- [SerializeField] Canvas menuUI;
- [SerializeField] Canvas gamingUI;
- [SerializeField] GameObject btnStart;
- [SerializeField] GameObject btnResume;
- bool _mouseAwaked = true;
- bool _needMouseAwaked;
- [SerializeField] Image aimingCross;
- public static JCFruitMaster ins;
- void Start()
- {
- ins = this;
- menuUI.sortingOrder = 4;
- gamingUI.sortingOrder = 4;
- gamingUI.transform.Find("PauseExitBack/ExitBtn").gameObject.SetActive(false);
- gamingUI.transform.Find("PauseExitBack/PauseBtn").gameObject.SetActive(false);
- CrossHairOutBoundChecker1 outBoundChecker = Instantiate(Resources.Load<GameObject>("Prefabs/CrossHairOutBoundChecker1")).GetComponent<CrossHairOutBoundChecker1>();
- outBoundChecker.crossHair = aimingCross.transform as RectTransform;
- }
- void OnDestroy()
- {
- if (ins == this) ins = null;
- }
- void Update()
- {
- _needMouseAwaked = btnStart.activeInHierarchy || btnResume.activeInHierarchy;
- if (_mouseAwaked && !_needMouseAwaked)
- {
- SimulateMouseController.ins?.RemoveOpenLocker("NotGame");
- _mouseAwaked = false;
- }
- else if (!_mouseAwaked && _needMouseAwaked)
- {
- SimulateMouseController.ins?.AddOpenLocker("NotGame");
- _mouseAwaked = true;
- }
- aimingCross.enabled = !SB_EventSystem.ins.simulateMouseIsAwaked;
- }
- public void ResetAim()
- {
- if (_needMouseAwaked)
- {
- AimHandler.ins?.DoIdentity();
- }
- else
- {
- AutoResetView.DoIdentity();
- }
- }
- }
|