示例#1
0
        // 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);
            }
        }
示例#2
0
		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;
		}
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
		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;
		}
示例#6
0
        // レイヤ削除
        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);
            }
        }
示例#7
0
		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;
			});
		}
示例#8
0
 private void CollectTouchListener(GameObject target, UIBaseLayer layer)
 {
     m_Listeners = target.GetComponentsInChildren <UITouchListener>();
     foreach (UITouchListener item in m_Listeners)
     {
         item.SetPart(layer, Part);
     }
 }
示例#9
0
		public string GetFrontUINameInGroup(UIGroup group) {
			UIBaseLayer layer = m_uiList.FindFrontLayerInGroup(group);
			if (layer == null) {
				return "";
			} else {
				return layer.ui.name;
			}
		}
示例#10
0
        public void Remove(UIBaseLayer targetLayer)
        {
            int index = m_List.FindIndex(layer => (layer == targetLayer));

            if (index >= 0)
            {
                m_List.RemoveAt(index);
            }
        }
示例#11
0
		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; });
		}
示例#12
0
        public void ToastOut(Action <UIBase> remove)
        {
            if (m_ToastBaseLayer == null)
            {
                return;
            }

            remove.Invoke(m_ToastBaseLayer.Base);
            m_ToastBaseLayer = null;
        }
示例#13
0
        public void LoadingOut(Action <UIBase> remove)
        {
            if (m_LoadingBaseLayer == null)
            {
                return;
            }

            remove.Invoke(m_LoadingBaseLayer.Base);
            m_LoadingBaseLayer = null;
        }
示例#14
0
        public void FadeOut(Action <UIBase> remove)
        {
            if (m_FadeBaseLayer == null)
            {
                return;
            }

            remove.Invoke(m_FadeBaseLayer.Base);
            m_FadeBaseLayer = null;
        }
示例#15
0
        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;
        }
示例#16
0
        public void Eject(UIBaseLayer layer)
        {
            int index = m_list.FindIndex(l => {
                return(l == layer);
            });

            if (index >= 0)
            {
                m_list.RemoveAt(index);
            }
        }
示例#17
0
        // 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);
        }
示例#18
0
		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();
			}
		}
示例#19
0
        private void SetTouchableDisable(UIBaseLayer layer, IEnumerable <BaseRaycaster> rayCasterComponents)
        {
            if (m_TouchOffCount == 0)
            {
                foreach (BaseRaycaster rayCaster in rayCasterComponents)
                {
                    rayCaster.enabled = false;
                }
            }

            m_TouchOffCount++;
            layer.ScreenTouchOffCount++;
        }
示例#20
0
        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;
        }
示例#21
0
        public void AddOrInsert(UIBaseLayer layer)
        {
            int index = FindInsertPosition(layer.Base.Group);

            if (index < 0)
            {
                m_List.Add(layer);
            }
            else
            {
                m_List.Insert(index, layer);
            }
        }
示例#22
0
		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);
			}
		}
示例#23
0
        public void Insert(UIBaseLayer layer)
        {
            int index = FindInsertPosition(layer.ui.group);

            if (index < 0)
            {
                m_list.Add(layer);
            }
            else
            {
                m_list.Insert(index, layer);
            }
        }
示例#24
0
        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;
        }
示例#25
0
        private bool CanTouchable()
        {
            UIBaseLayer layer = m_front;

            while (layer != null)
            {
                if (!layer.ui.BackTouchable())
                {
                    return(false);
                }
                layer = layer.m_front;
            }
            return(true);
        }
示例#26
0
		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);
		}
示例#27
0
        public void SetScreenTouchable(UIBaseLayer layer, bool enable,
                                       IEnumerable <BaseRaycaster> rayCasterComponents)
        {
            if (layer == null)
            {
                return;
            }

            if (enable)
            {
                SetTouchableEnable(layer, rayCasterComponents);
            }
            else
            {
                SetTouchableDisable(layer, rayCasterComponents);
            }
        }
示例#28
0
        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);
        }
示例#29
0
        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);
        }
示例#30
0
        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);
        }