Ejemplo n.º 1
0
        /// <summary>
        /// Window が開かられるときの処理
        /// </summary>
        public IEnumerator OnOpenWindowEnumerator(string nextScreenPath, string currentScreenPath)
        {
            if (currentScreenPath != nextScreenPath)
            {
                if (!ScreenBaseList.ContainsKey(nextScreenPath) || ScreenBaseList[nextScreenPath] == null)
                {
                    var        loaded = false;
                    GameObject prefab = null;
                    ClioneResourceLoader.LoadAsync <GameObject>(nextScreenPath,
                                                                uiParts =>
                    {
                        prefab = uiParts;
                        loaded = true;
                    },
                                                                () =>
                    {
                        Debug.LogError($"{nextScreenPath} is not found.");
                        loaded = true;
                    });

                    while (!loaded)
                    {
                        yield return(null);
                    }

                    ScreenBaseList.Add(nextScreenPath, Instantiate(prefab, this.transform).GetComponent <ScreenBase>());
                    var initialize = ScreenBaseList[nextScreenPath].InitializeEnumerator();
                    while (initialize.MoveNext())
                    {
                        yield return(null);
                    }
                }

                CurrentOpenScreen = ScreenBaseList[nextScreenPath];
                CurrentOpenScreen.gameObject.SetActive(true);
                CurrentOpenScreen.SetScreenPath(nextScreenPath);
            }


            var onBeforeOpen = CurrentOpenScreen.OnBeforeOpenScreenEnumerator();

            while (onBeforeOpen.MoveNext())
            {
                yield return(null);
            }

            var onOpen = CurrentOpenScreen.OnOpenScreenEnumerator();

            while (onOpen.MoveNext())
            {
                yield return(null);
            }

            var onAfterOpen = CurrentOpenScreen.OnAfterOpenScreenEnumerator();

            while (onAfterOpen.MoveNext())
            {
                yield return(null);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 現在開かれている Screen が閉じられる前の処理
        /// </summary>
        public IEnumerator OnCloseScreenEnumerator()
        {
            var onBeforeClose = CurrentOpenScreen.OnBeforeCloseScreenEnumerator();

            while (onBeforeClose.MoveNext())
            {
                yield return(null);
            }

            var onClose = CurrentOpenScreen.OnCloseScreenEnumerator();

            while (onClose.MoveNext())
            {
                yield return(null);
            }

            var onAfterClose = CurrentOpenScreen.OnAfterCloseScreenEnumerator();

            while (onAfterClose.MoveNext())
            {
                yield return(null);
            }

            CurrentOpenScreen.gameObject.SetActive(false);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 現在開かれている Screen が閉じられる前の処理
        /// </summary>
        public IEnumerator OnCloseScreenEnumerator()
        {
            yield return(StartCoroutine(CurrentOpenScreen.OnBeforeCloseScreenEnumerator()));

            yield return(StartCoroutine(CurrentOpenScreen.OnCloseScreenEnumerator()));

            yield return(StartCoroutine(CurrentOpenScreen.OnAfterCloseScreenEnumerator()));

            CurrentOpenScreen.gameObject.SetActive(false);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Window が開かられるときの処理
        /// </summary>
        public IEnumerator OnOpenWindowEnumerator(string nextScreenPath, string currentScreenPath)
        {
            if (currentScreenPath != nextScreenPath)
            {
                if (!ScreenBaseList.ContainsKey(nextScreenPath) || ScreenBaseList[nextScreenPath] == null)
                {
                    var prefab = Resources.Load <GameObject>(nextScreenPath);
                    ScreenBaseList.Add(nextScreenPath, Instantiate(prefab, this.transform).GetComponent <ScreenBase>());
                    yield return(StartCoroutine(ScreenBaseList[nextScreenPath].InitializeEnumerator()));
                }

                CurrentOpenScreen = ScreenBaseList[nextScreenPath];
                CurrentOpenScreen.gameObject.SetActive(true);
                CurrentOpenScreen.SetScreenPath(nextScreenPath);
            }

            yield return(StartCoroutine(CurrentOpenScreen.OnBeforeOpenScreenEnumerator()));

            yield return(StartCoroutine(CurrentOpenScreen.OnOpenScreenEnumerator()));

            yield return(StartCoroutine(CurrentOpenScreen.OnAfterOpenScreenEnumerator()));
        }