// Backボタン public void Back() { UIBaseLayer layer = null; foreach (var group in s_BackAbleGroups) { layer = m_LayerController.FindFrontLayerInGroup(group); if (layer != null) { break; } } if (layer == null) { return; } bool ret = layer.Base.OnBack(); if (ret) { Remove(layer.Base); } }
private bool Eject() { bool isEject = false; if (m_removingList.Count <= 0) { return isEject; } bool isLoading = m_addingList.Exists(layer => { return (layer.IsNotYetLoaded()); }); List<UIBaseLayer> list = m_removingList; m_removingList = new List<UIBaseLayer>(); bool isFadeIn = IsFadeIn(); for (int i = 0; i < list.Count; i++) { UIBaseLayer layer = list[i]; if (!isFadeIn && layer.state == State.OutFading) { layer.Remove(); } if (layer.state != State.Removing || isLoading) { m_removingList.Add(layer); continue; } m_uiList.Eject(layer); layer.Destroy(); isEject = true; } return isEject; }
public override async UniTask OnLoadedBase() { UIBaseLayer previewFieldLayer = UIController.Instance.GetBaseLayer(typeof(PreviewFieldBase)); m_PreviewFieldBase = previewFieldLayer.Base as PreviewFieldBase; UIBaseLayer mixedBallTabBase = UIController.Instance.GetBaseLayer(typeof(MixedBallTabBase)); m_MixedBallTabBase = mixedBallTabBase.Base as MixedBallTabBase; m_LaboScrollerView = RootTransform.GetComponent <LaboScrollerView>(); InitLaboScrollerController(); List <UIPart> parts = new List <UIPart> { // new HomeTabPart(m_LaboScrollerView.m_TabView, JumpToDataIndex) }; // 追加待ち await UIController.Instance.YieldAttachParts(this, parts); const int FIRST_INDEX = 2; m_LaboScrollerView.m_Scroller.JumpToDataIndex(FIRST_INDEX); }
public IEnumerator LoadAndSetup(UIBaseLayer layer) { if (m_ui.root == null && !string.IsNullOrEmpty(m_ui.prefabPath)) { PrefabReceiver receiver = new PrefabReceiver(); yield return(UIController.implements.prefabLoader.Load(m_ui.prefabPath, receiver)); m_prefab = receiver.prefab; if (m_prefab != null) { GameObject g = GameObject.Instantiate(m_prefab) as GameObject; m_ui.root = g.transform; } } if (m_ui.root == null) { m_ui.root = new GameObject("root").transform; } m_ui.root.gameObject.SetActive(false); CollectComponents(m_ui.root.gameObject, layer); yield return(m_ui.OnLoaded((UIBase)layer.m_ui)); m_ui.root.gameObject.SetActive(true); }
private bool Insert() { bool isInsert = false; if (m_addingList.Count <= 0) { return isInsert; } List<UIBaseLayer> list = m_addingList; m_addingList = new List<UIBaseLayer>(); bool isFadeIn = IsFadeIn(); for (int i = 0; i < list.Count; i++) { UIBaseLayer layer = list[i]; if (!isFadeIn && layer.state == State.InFading) { StartCoroutine(layer.Load()); } if (layer.IsNotYetLoaded() || (isFadeIn && !layer.ui.ActiveWituoutFade())) { m_addingList.Add(layer); continue; } if (layer.Activate()) { isInsert = true; } } return isInsert; }
// レイヤ削除 public void Remove(UIBase uiBase) { if (uiBase == null) { return; } UIBaseLayer layer = m_LayerController.Find(uiBase); bool isInactive = false; if (layer != null) { isInactive = layer.SetInactive(); } if (isInactive) { m_RemovingLayerList.Add(layer); } if (m_FadeController.IsShouldFadeByRemoving(uiBase, m_LayerController, m_RemovingLayerList)) { m_FadeController.FadeIn(Implements, m_AddingLayerList, AddFront); } }
private void RefreshLayer() { bool visible = true; bool touchable = true; UIBaseLayer frontLayer = null; int index = m_uiLayers.childCount - 1; m_uiList.ForEachAnything(layer => { if (layer.IsNotYetLoaded()) { return; } bool preVisible = layer.IsVisible(); bool preTouchable = layer.IsTouchable(); layer.SetVisible (visible); layer.SetTouchable(touchable); if (!preVisible && visible ) { layer.ui.OnRevisible(); } if (!preTouchable && touchable) { layer.ui.OnRetouchable(); } visible = visible && layer.ui.BackVisible(); touchable = touchable && layer.ui.BackTouchable(); layer.siblingIndex = index--; if (frontLayer != null) { frontLayer.back = layer; frontLayer.CallSwitchBack(); } layer.front = frontLayer; layer.CallSwitchFront(); layer.back = null; frontLayer = layer; }); }
private void CollectTouchListener(GameObject target, UIBaseLayer layer) { m_Listeners = target.GetComponentsInChildren <UITouchListener>(); foreach (UITouchListener item in m_Listeners) { item.SetPart(layer, Part); } }
public string GetFrontUINameInGroup(UIGroup group) { UIBaseLayer layer = m_uiList.FindFrontLayerInGroup(group); if (layer == null) { return ""; } else { return layer.ui.name; } }
public void Remove(UIBaseLayer targetLayer) { int index = m_List.FindIndex(layer => (layer == targetLayer)); if (index >= 0) { m_List.RemoveAt(index); } }
private void FadeIn() { if (m_uiFade != null) { return; } if (m_implements.fadeCreator == null) { return; } UIFade fade = m_implements.fadeCreator.Create(); AddFront(fade); m_uiFade = m_addingList.Find(l => { return l.ui == fade; }); }
public void ToastOut(Action <UIBase> remove) { if (m_ToastBaseLayer == null) { return; } remove.Invoke(m_ToastBaseLayer.Base); m_ToastBaseLayer = null; }
public void LoadingOut(Action <UIBase> remove) { if (m_LoadingBaseLayer == null) { return; } remove.Invoke(m_LoadingBaseLayer.Base); m_LoadingBaseLayer = null; }
public void FadeOut(Action <UIBase> remove) { if (m_FadeBaseLayer == null) { return; } remove.Invoke(m_FadeBaseLayer.Base); m_FadeBaseLayer = null; }
protected void CollectComponents(GameObject target, UIBaseLayer layer) { m_listeners = target.GetComponentsInChildren <UITouchListener>(); for (int i = 0; i < m_listeners.Length; i++) { m_listeners[i].SetUI(layer, m_ui); } Animator[] animators = target.GetComponentsInChildren <Animator>(); m_ui.animators = animators; }
public void Eject(UIBaseLayer layer) { int index = m_list.FindIndex(l => { return(l == layer); }); if (index >= 0) { m_list.RemoveAt(index); } }
// UIパーツ追加(完了待ち(OnLoadedBase内で呼ばれる)) public async UniTask YieldAttachParts(UIBase targetUIBase, IEnumerable <UIPart> parts) { UIBaseLayer layer = m_LayerController.Find(targetUIBase); if (layer == null) { return; } await layer.AttachParts(parts); }
public void Remove(UIBase ui) { if (ui == null) { return; } UIBaseLayer layer = m_uiList.Find(ui); if (layer != null && layer.Inactive()) { m_removingList.Add(layer); } if (ShouldFadeByRemoving(ui)) { FadeIn(); } }
private void SetTouchableDisable(UIBaseLayer layer, IEnumerable <BaseRaycaster> rayCasterComponents) { if (m_TouchOffCount == 0) { foreach (BaseRaycaster rayCaster in rayCasterComponents) { rayCaster.enabled = false; } } m_TouchOffCount++; layer.ScreenTouchOffCount++; }
public void SetPart(UIBaseLayer layer, UIPart part) { int generation = GetGeneration(transform, part.RootTransform); if (m_Generation < generation) { return; } Layer = layer; Part = part; m_Generation = generation; }
public void AddOrInsert(UIBaseLayer layer) { int index = FindInsertPosition(layer.Base.Group); if (index < 0) { m_List.Add(layer); } else { m_List.Insert(index, layer); } }
public void Back() { UIBaseLayer layer = null; for (int i = 0; i < UIBackable.groups.Count; i++) { layer = m_uiList.FindFrontLayerInGroup(UIBackable.groups[i]); if (layer != null) { break; } } if (layer == null) { return; } bool ret = layer.ui.OnBack(); if (ret) { Remove(layer.ui); } }
public void Insert(UIBaseLayer layer) { int index = FindInsertPosition(layer.ui.group); if (index < 0) { m_list.Add(layer); } else { m_list.Insert(index, layer); } }
public void SetUI(UIBaseLayer layer, UIPart ui) { int generation = GetGeneration(transform, ui.root); if (m_generation < generation) { return; } m_layer = layer; m_ui = ui; m_generation = generation; }
private bool CanTouchable() { UIBaseLayer layer = m_front; while (layer != null) { if (!layer.ui.BackTouchable()) { return(false); } layer = layer.m_front; } return(true); }
public void AddFront(UIBase ui) { if (ui == null) { return; } UIBaseLayer layer = new UIBaseLayer(ui, m_uiLayers); if (layer.ui.LoadingWithoutFade()) { StartCoroutine(layer.Load()); } if (ShouldFadeByAdding(ui)) { FadeIn(); } m_addingList.Add(layer); m_uiList.Insert(layer); }
public void SetScreenTouchable(UIBaseLayer layer, bool enable, IEnumerable <BaseRaycaster> rayCasterComponents) { if (layer == null) { return; } if (enable) { SetTouchableEnable(layer, rayCasterComponents); } else { SetTouchableDisable(layer, rayCasterComponents); } }
public void FadeIn(UIImplements implements, List <UIBaseLayer> addingList, Action <UIBase> addFront) { if (m_FadeBaseLayer != null) { return; } if (implements.FadeCreator == null) { return; } UIFade fade = implements.FadeCreator.Create(); addFront.Invoke(fade); m_FadeBaseLayer = addingList.Find(layer => layer.Base == fade); }
public void LoadingIn(UIImplements implements, List <UIBaseLayer> addingList, Action <UIBase> addFront) { if (m_LoadingBaseLayer != null) { return; } if (implements.LoadingCreator == null) { return; } UILoading loading = implements.LoadingCreator.Create(); addFront.Invoke(loading); m_LoadingBaseLayer = addingList.Find(layer => layer.Base == loading); }
public void ToastIn(UIImplements implements, List <UIBaseLayer> addingList, Action <UIBase> addFront, string message) { if (m_ToastBaseLayer != null) { return; } if (implements.ToastCreator == null) { return; } UIToast toast = implements.ToastCreator.Create(message); addFront.Invoke(toast); m_ToastBaseLayer = addingList.Find(layer => layer.Base == toast); }