protected void UpdateContents() { var touchBlocIndex = 0; GameObject parent = null; CreateTouchBloc(); if (scenePopups.Any()) { var index = 0; parent = parentInScene.Parent; touchBlocIndex = 0; var lastPopup = scenePopups.LastOrDefault(); foreach (var popup in scenePopups) { if (popup == lastPopup) { touchBlocIndex = index++; } popup.transform.SetSiblingIndex(index++); } } if (globalPopups.Any()) { var index = 0; parent = parentGlobal.Parent; touchBlocIndex = 0; var lastPopup = globalPopups.LastOrDefault(); foreach (var popup in globalPopups) { if (popup == lastPopup) { touchBlocIndex = index++; } popup.transform.SetSiblingIndex(index++); } } // ポップアップがなかった場合はグローバルの下に退避. if (parent == null) { parent = parentGlobal.Parent; } UnityUtility.SetParent(touchBloc.gameObject, parent); touchBloc.transform.SetSiblingIndex(touchBlocIndex); UnityUtility.SetLayer(parent, touchBloc.gameObject, true); // 一つでも登録されたら表示. if (!touchBloc.Active && (scenePopups.Any() || globalPopups.Any())) { if (touchBlocDisposable != null) { touchBlocDisposable.Dispose(); touchBlocDisposable = null; } UnityUtility.SetActive(touchBloc, true); touchBlocDisposable = touchBloc.FadeIn().Subscribe().AddTo(this); } // 空になったら非表示. if (touchBloc.Active && (scenePopups.IsEmpty() && globalPopups.IsEmpty())) { if (touchBlocDisposable != null) { touchBlocDisposable.Dispose(); touchBlocDisposable = null; } touchBlocDisposable = touchBloc.FadeOut() .Subscribe(_ => UnityUtility.SetActive(touchBloc, false)) .AddTo(this); } }
protected void UpdateContents() { var touchBlocIndex = 0; GameObject parent = null; if (touchBloc == null) { touchBloc = UnityUtility.Instantiate <TouchBloc>(parentGlobal.Parent, touchBlocPrefab); touchBloc.Initialize(); } if (scenePopups.Any()) { var index = 0; parent = parentInScene.Parent; touchBlocIndex = 0; foreach (var item in scenePopups) { if (item == scenePopups.LastOrDefault()) { touchBlocIndex = index++; } item.transform.SetSiblingIndex(index++); } } if (globalPopups.Any()) { var index = 0; parent = parentGlobal.Parent; touchBlocIndex = 0; foreach (var item in globalPopups) { if (item == globalPopups.LastOrDefault()) { touchBlocIndex = index++; } item.transform.SetSiblingIndex(index++); } } // ポップアップがなかった場合はグローバルの下に退避. if (parent == null) { parent = parentGlobal.Parent; } UnityUtility.SetParent(touchBloc.gameObject, parent); touchBloc.transform.SetSiblingIndex(touchBlocIndex); UnityUtility.SetLayer(parent, touchBloc.gameObject, true); // 一つでも登録されたら表示. if (!touchBloc.Active && (scenePopups.Any() || globalPopups.Any())) { if (touchBlocDisposable != null) { touchBlocDisposable.Dispose(); touchBlocDisposable = null; } touchBlocDisposable = touchBloc.FadeIn().Subscribe().AddTo(this); } // 空になったら非表示. if (touchBloc.Active && (scenePopups.IsEmpty() && globalPopups.IsEmpty())) { if (touchBlocDisposable != null) { touchBlocDisposable.Dispose(); touchBlocDisposable = null; } touchBlocDisposable = touchBloc.FadeOut().Subscribe().AddTo(this); } }