public static bool IsClickUI() { bool res = false; if (EventSystem.current != null) { res = EventSystem.current.currentSelectedGameObject != null; if (!res) { PointerEventData eventDataCurrentPosition = new PointerEventData(EventSystem.current); eventDataCurrentPosition.position = InputUtils.GetTouchPosition(); Canvas canvas = PageManager.Instance.GetComponent <Canvas>(); GraphicRaycaster uiRaycaster = canvas.gameObject.GetComponent <GraphicRaycaster>(); List <RaycastResult> results = new List <RaycastResult>(); uiRaycaster.Raycast(eventDataCurrentPosition, results); res = results.Count > 0; if (!res) { canvas = GeneralUIManager.GetCanvas(); uiRaycaster = canvas.gameObject.GetComponent <GraphicRaycaster>(); results = new List <RaycastResult>(); uiRaycaster.Raycast(eventDataCurrentPosition, results); res = results.Count > 0; } } } return(res); }
IEnumerator LoadNextScene(AsyncOperation ao, float startTime) { while (true) { if (_progress < 1f) { // ao.progress到0.9就卡住了,所以大约在0.8之前读取ao.progress,之后模拟进度直到100% float threshold = .8f; if (_progress < threshold) { RefreshProgress(ao.progress); } else { RefreshProgress(1f); } yield return(null); } else { if (!_dontDestroy) { PageManager.Instance.DestroyCurrentPages(); } yield return(null); if (_nextSceneHandleData != null) { _nextSceneHandleData(); _nextSceneHandleData = null; } while (!_loadPageComplete) { yield return(null); } ao.allowSceneActivation = true; while (SceneManager.GetActiveScene().name == LoadingScene) { yield return(null); } Resources.UnloadUnusedAssets(); System.GC.Collect(); GeneralUIManager.RefreshSortingOrder(); _isLoading = false; break; } } }
// Start is called before the first frame update public void Start() { cubeEntitiesClient = new Dictionary <int, CubeEntity>(); clientId = Random.Range(0, 1000000); channel = new Channel(Utils.GetPortFromId(clientId)); GameObject.Find("Players(Client)").transform.position = Vector3.zero; print($"IPAddress: {GameManager.IPAddress}"); UICanvas = GameObject.Find("UICanvas").GetComponent <GeneralUIManager>(); packetsCooldown = new Cooldown(1f / pps); reconciliateCooldown = new Cooldown(1f / rps); GameManager.laserPrefab = laserPrefab; }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } waitLoadingTime = 10f; }
public override void OnInspectorGUI() { DrawDefaultInspector(); GeneralUIManager myScript = (GeneralUIManager)target; if (GUILayout.Button("Set Colors")) { myScript.UpdateColors(); } if (GUILayout.Button("Find All Images")) { myScript.FindAllImages(); } }