Пример #1
0
        private IEnumerator initEducationMenu()
        {
            // Need to continue beyond loading complete now
            int i = 0;

            while (!Singleton <LoadingManager> .instance.m_loadingComplete || i++ < 25)
            {
                if (PanelHelper.initCustomEducationGroupPanel())
                {
                    break;
                }
                yield return(new WaitForEndOfFrame());
            }
        }
Пример #2
0
        private void attemptInitialization()
        {
            // Make sure not attempting initilization after loading has already completed -- This means the mod may not function properly, but it won't waste resources continuing to try
            if (Singleton <LoadingManager> .instance.m_loadingComplete)
            {
                Logger.logError("DormitoryInitializer.attemptInitialization -- *** NURSING HOMES FUNCTIONALITY DID NOT INITLIZIE PRIOR TO GAME LOADING -- THE SENIOR CITIZEN CENTER MOD MAY NOT FUNCTION PROPERLY ***");
                // Set initilized so it won't keep trying
                this.setInitialized();
            }

            // Check to see if initilization can start
            if (PrefabCollection <BuildingInfo> .LoadedCount() <= 0)
            {
                this.attemptingInitialization = 0;
                return;
            }

            // Wait for the Medical Clinic or other HospitalAI Building to load since all new Dormitories will copy its values
            BuildingInfo medicalBuildingInfo = this.findEducationBuildingInfo();

            if (medicalBuildingInfo == null)
            {
                this.attemptingInitialization = 0;
                return;
            }

            // Start loading
            Logger.logInfo(LOG_INITIALIZER, "DormitoryInitializer.attemptInitialization -- Attempting Initialization");
            Singleton <LoadingManager> .instance.QueueLoadingAction(ActionWrapper(() => {
                try {
                    if (this.loadedLevel == LOADED_LEVEL_GAME)
                    {
                        // Reset the PanelHelper and initilize the Education Menu
                        PanelHelper.reset();
                        this.StartCoroutine(this.initEducationMenu());
                    }
                    if (this.loadedLevel == LOADED_LEVEL_GAME || this.loadedLevel == LOADED_LEVEL_ASSET_EDITOR)
                    {
                        this.StartCoroutine(this.initDormitories(medicalBuildingInfo));
                        AddQueuedActionsToLoadingQueue();
                    }
                } catch (Exception e) {
                    Logger.logError("Error loading prefabs: {0}", e.Message);
                }
            }));

            // Set initilized
            this.setInitialized();
        }