Exemplo n.º 1
0
        public void Start(RenderWindow window, ushort numGroupsInit, ushort numGroupsLoad, float initProportion)
        {
            this.window         = window;
            this.numGroupsInit  = numGroupsInit;
            this.numGroupsLoad  = numGroupsLoad;
            this.initProportion = initProportion;

            // We need to pre-initialise the 'Bootstrap' group so we can use
            // the basic contents in the loading screen
            ResourceGroupManager.Singleton.InitialiseResourceGroup("Bootstrap");

            OverlayManager omgr = OverlayManager.Singleton;

            loadOverlay = omgr.GetByName("Core/LoadOverlay");
            if (loadOverlay == null)
            {
                System.Windows.Forms.MessageBox.Show("Cannot find loading overlay", "ExampleLoadingBar::start", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }
            loadOverlay.Show();

            // Save links to the bar and to the loading text, for updates as we go
            loadingBarElement         = omgr.GetOverlayElement("Core/LoadPanel/Bar/Progress");
            loadingCommentElement     = omgr.GetOverlayElement("Core/LoadPanel/Comment");
            loadingDescriptionElement = omgr.GetOverlayElement("Core/LoadPanel/Description");

            OverlayElement barContainer = omgr.GetOverlayElement("Core/LoadPanel/Bar");

            progressBarMaxSize      = barContainer.Width;
            loadingBarElement.Width = 0F;

            ResourceGroupManager.Singleton.ResourceGroupScriptingStarted += ResourceGroupScriptingStarted;
            ResourceGroupManager.Singleton.ScriptParseStarted            += ScriptParseStarted;
            ResourceGroupManager.Singleton.ScriptParseEnded          += ScriptParseEnded;
            ResourceGroupManager.Singleton.ResourceGroupLoadStarted  += ResourceGroupLoadStarted;
            ResourceGroupManager.Singleton.ResourceLoadStarted       += ResourceLoadStarted;
            ResourceGroupManager.Singleton.WorldGeometryStageStarted += WorldGeometryStageStarted;
            ResourceGroupManager.Singleton.WorldGeometryStageEnded   += WorldGeometryStageEnded;
        }