コード例 #1
0
ファイル: WindowBase.cs プロジェクト: MasaKoha/Clione
        /// <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);
            }
        }
コード例 #2
0
ファイル: WindowBase.cs プロジェクト: MasaKoha/Clione
        /// <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);
        }
コード例 #3
0
ファイル: WindowBase.cs プロジェクト: nkjzm/Clione
        /// <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);
        }
コード例 #4
0
ファイル: WindowBase.cs プロジェクト: nkjzm/Clione
        /// <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()));
        }