Beispiel #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);
            }
        }
Beispiel #2
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()));
        }