Пример #1
0
        //{
        //    //------------Initialise Simulator---------------

        //    //workplaceManager = new WorkplaceManager(this);
        //    //  resourceManager = new ResourceManager(this);
        //    //agentManager = new AgentManager(this);

        //    //Envent handler to set agent skills when a skill is created
        //    // workplaceManager.OnSkillCreated += agentManager.SetAllAgentSkills;

        //    //    agentManager.OnAgentCreated += workplaceManager.SetSkillsForAgent;

        //    //-----------------------------------------------



        //    //-----------Create Gameplay Screen--------------


        //    //NOTE: All controllers present on load should be created during loading

        //    //NOTE: All entities present on load should be passed to the GameplayScreen before it starts loading

        //    GameplayScreen s = new GameplayScreen(content, graphics, screenManager, TEMP_type);
        //    s.Pause += PauseSimulation;
        //    s.Play += PlaySimulation;
        //    gameplayScreens.Add(s);
        //    currentGameplayScreenIndex = gameplayScreens.IndexOf(s);

        //    //---------------------------------------------------------------------------------------------------------

        //    //NOTE: might need to initialise managers here
        //    //agentManager.Initialise();
        //    //resourceManager.InitialiseResources();
        //    //  workplaceManager.InitialiseTasks();
        //    //---------------------------------------------------------------------------------------------------------

        //    //Load the game

        //    gameplayScreens[currentGameplayScreenIndex].Load3DWorld();

        //    //NOTE: Only using Update to ensure gameWorld has a valid gameState for other managers to use to load
        //    //Entities. Should do this in separate loading method for each screen/manager being initialised here
        //    Update(null);
        //    //-----------------------------------------------
        //    this.isVisible = true;


        //    //Add code to create the simulator and initial Gameplay Screen


        //    //NOTE: Initialisation of Task/Resource managers has been moved to onLoad, so as not to disrupt loading of
        //    //3D elements. Need to look into order/coordination of loading so that they may be correclty initialised here.


        //    ScreenManager.unregisterThread(loadingThread);//Unregister thread on termination
        //    //Put the thread to sleep so that anything still being initialised is ready when it exits and fires OnLoad event
        //    Thread.Sleep(500);
        //    LoadingComplete(this, new EventArgs());
        //    // OnLoad(this, new EventArgs());
        //}


        public void LoadingComplete(object sender, EventArgs e)
        {
            ScreenManager.GetInstance().UnregisterThread(loadingThread);//Unregister thread on termination


            ScreenManager.GetInstance().LoadComplete(this, new EventArgs());
            IsVisible = true;
            HasFocus  = true;
            isActive  = true;
            gameplayScreen.LoadComplete();

            /*  if (gameplayScreen != null)
             * {
             *    gameplayScreen.SetScreensActive();
             * }*/
        }