Exemplo n.º 1
0
        private IEnumerator Start()
        {
            if (IsStudio())
            {
                StudioHooks.Init();
            }
            yield return(new WaitUntil(() =>
            {
                return IsLoaded();
            }));

            Settings               = new GlobalSettings();
            CameraSettings         = new CameraSettings();
            LightingSettings       = new LightingSettings();
            PostProcessingSettings = new PostProcessingSettings(CameraSettings.MainCamera);
            SSSSettings            = new SSSSettings();

            _sssManager = new SSSManager();
            _sssManager.Initialize();

            _skyboxManager           = Instance.GetOrAddComponent <SkyboxManager>();
            _skyboxManager.Parent    = this;
            _skyboxManager.AssetPath = ConfigCubeMapPath.Value;
            _skyboxManager.Logger    = Logger;
            DontDestroyOnLoad(_skyboxManager);

            _postProcessingManager        = Instance.GetOrAddComponent <PostProcessingManager>();
            _postProcessingManager.Parent = this;
            _postProcessingManager.LensDirtTexturesPath = ConfigLensDirtPath.Value;
            DontDestroyOnLoad(_postProcessingManager);

            LocalizationManager.Parent          = this;
            LocalizationManager.CurrentLanguage = ConfigLanguage.Value;

            _lightManager  = new LightManager(this);
            _presetManager = new PresetManager(ConfigPresetPath.Value, this);

            yield return(new WaitUntil(() => PCSSLight.LoadAssets()));

            yield return(new WaitUntil(() => SEGI.LoadAssets()));

            _inspector = new Inspector.Inspector(this);
            _isLoaded  = true;
        }
Exemplo n.º 2
0
        private IEnumerator Start()
        {
            if (IsStudio())
            {
                StudioHooks.Init();
            }

            yield return(new WaitUntil(() =>
            {
                switch (KoikatuAPI.GetCurrentGameMode())
                {
                case GameMode.Maker:
                    return KKAPI.Maker.MakerAPI.InsideAndLoaded;

                case GameMode.Studio:
                    return KKAPI.Studio.StudioAPI.StudioLoaded;

                case GameMode.MainGame:
                    return null != GameObject.Find("MapScene") && SceneManager.GetActiveScene().isLoaded&& null != Camera.main;      //KKAPI doesn't provide an api for in game check

                default:
                    return false;
                }
            }));

            Settings               = new GlobalSettings();
            CameraSettings         = new CameraSettings();
            LightingSettings       = new LightingSettings();
            PostProcessingSettings = new PostProcessingSettings(CameraSettings.MainCamera);

            _skyboxManager           = Instance.GetOrAddComponent <SkyboxManager>();
            _skyboxManager.Parent    = this;
            _skyboxManager.AssetPath = ConfigCubeMapPath.Value;
            _skyboxManager.Logger    = Logger;
            DontDestroyOnLoad(_skyboxManager);

            _postProcessingManager        = Instance.GetOrAddComponent <PostProcessingManager>();
            _postProcessingManager.Parent = this;
            _postProcessingManager.LensDirtTexturesPath = ConfigLensDirtPath.Value;
            DontDestroyOnLoad(_postProcessingManager);

            LocalizationManager.Parent          = this;
            LocalizationManager.CurrentLanguage = ConfigLanguage.Value;

            _lightManager = new LightManager(this);

            _focusPuller = Instance.GetOrAddComponent <FocusPuller>();
            _focusPuller.init(this);
            DontDestroyOnLoad(_focusPuller);
            _presetManager = new PresetManager(ConfigPresetPath.Value, this);

            _inspector = new Inspector.Inspector(this);

            // It takes some time to fully loaded in studio to save/load stuffs.
            yield return(new WaitUntil(() =>
            {
                return IsStudio() ? KKAPI.Studio.StudioAPI.InsideStudio && _skyboxManager != null : true;
            }));

            _isLoaded = true;
        }