예제 #1
0
    static protected void loadMissingScreen(string screenName, Action <ScreenObject> onComplete)
    {
        ScreenLoading.showLoadingScreen();

        //re-add "screen-" prefix if missing
        string fullName = screenName;

        if (!fullName.StartsWith("screen-"))
        {
            fullName = "screen-" + fullName;
        }

        // first search if already exists
        ScreenObject so = getScreen(fullName);

        if (so != null)
        {
            onComplete(so);
            return;
        }

        Debug.Log("screen to open : <b>" + fullName + "</b> is not loaded");

        EngineLoader.queryScene(fullName, delegate()
        {
            so = getScreen(screenName);
            if (so == null)
            {
                Debug.LogError("ScreensManager | end of screen loading (name given : " + screenName + ") but no <ScreenObject> returned");
            }
            onComplete(so);
        });
    }
예제 #2
0
    protected override void build()
    {
        base.build();

        _instance = this;

        if (txt != null)
        {
            txt.enabled = false;
        }

        //loading must be sticky to not be closed by maanger open/close logic
        //of other screens
        if (!sticky)
        {
            sticky = true;
        }

        cam = GetComponent <Camera>();
        if (cam == null)
        {
            cam = GetComponentInChildren <Camera>();
        }

        //Debug.Log("hiding loading screen through static call");
        show();
    }
예제 #3
0
    private void OpenPlay()
    {
        //ScreenPlay.Open ();
        LoadingData loadingData = new LoadingData();

        loadingData.nextScreen         = "Play";
        loadingData.isNextScreenCached = true;
        loadingData.coroutines.Add(Wait());
        ScreenLoading.Open(loadingData);
    }
예제 #4
0
 public void LoadingScreen(bool freez)
 {
     if (freez)
     {
         this.Enabled = false;
         ScreenLoading.BringToFront();
         ScreenLoading.Visible = true;
     }
     else
     {
         ScreenLoading.Visible = false;
         this.Enabled          = true;
     }
 }
예제 #5
0
 public void SetScreenLoading(ScreenLoading screenLoading)
 {
     this.screenLoading = screenLoading;
 }
예제 #6
0
        IEnumerator processStartup()
        {
            Coroutine co = null;

            Debug.Log(getStamp() + " process startup, frame : " + Time.frameCount);

            //leave a few frame for loading screen to be created and displayed
            //Scene are not flagged as loaded during frame 1
            yield return(null);

            yield return(null);

            yield return(null);

            //EngineLoader.loadScene("screen-loading");
            //ScreenLoading.create(false);
            ScreenLoading.showLoadingScreen();

            //Debug.Log(getStamp() + " waiting for loading screen");
            //attendre l'écran de loading
            //while (ScreenLoading.get() == null) yield return null;

            //Debug.Log(getStamp() + " loading screen should be visible, frame : " + Time.frameCount);

            string engineSceneName = EngineLoader.prefixResource + "engine";

            //Debug.Log(getStamp() + " triggering feeders ...");

            // then we load engine, to get the feeder script
            co = EngineLoader.loadScenes(new string[] { engineSceneName },
                                         delegate() { co = null; });

            Debug.Log(getStamp() + " waiting for engine scene ...");

            while (co != null)
            {
                yield return(null);
            }

            //NEEDED if not present
            //must be created after the (existing ?) engine scene is loaded (doublon)
            //EngineManager.create();

            //safe check for engine scene presence
            Scene engineScene = SceneManager.GetSceneByName(engineSceneName);

            Debug.Assert(engineScene.IsValid());

            while (!engineScene.isLoaded)
            {
                yield return(null);
            }
            yield return(null);

            Debug.Log(getStamp() + " triggering feeders ...");

            // les feeders qui sont déjà présents quand on lance le runtime (pas par un load)
            EngineLoaderFeederBase[] feeders = GameObject.FindObjectsOfType <EngineLoaderFeederBase>();
            Debug.Log(getStamp() + " " + feeders.Length + " feeders still running");
            for (int i = 0; i < feeders.Length; i++)
            {
                //feeders[i].feed(gameObject.scene);
                if (!feeders[i].isFeeding())
                {
                    feeders[i].feed();
                }
            }

            //tant qu'on a des loaders qui tournent ...
            while (EngineLoader.areAnyLoadersRunning())
            {
                yield return(null);
            }

            Debug.Log(getStamp() + " is done at frame " + Time.frameCount + ", removing gameobject");

            if (engineScene.rootCount <= 0)
            {
                SceneManager.UnloadSceneAsync(engineScene);
            }

            EngineBoot booter = GameObject.FindObjectOfType <EngineBoot>();

            if (booter == null)
            {
                Debug.LogWarning(getStamp() + " no booter found ?");
            }
            else
            {
                booter?.loadingCompleted();
            }

            yield return(null);

            //temp
            ScreenLoading.hideLoadingScreen();

            yield return(null);

            GameObject.Destroy(gameObject);
        }