示例#1
0
        /// <summary>
        /// Call it before use any other method
        /// </summary>
        public static void Init()
        {
            config = new RuntimeConfigRepository().Get();

            if (config == null)
            {
                throw new NullReferenceException(nameof(LocalizationConfig));
            }

            translationDatabase = new TranslationDatabase(
                new TranslationRepository(
                    new TranslationStorageProvider()));

            defaultCulture = CultureMap.Get(config.DefaultCulture);
            translations   = new RuntimeTranslationInfoRepository().GetAll();

            if (translations.Length == 0)
            {
                Debug.LogWarning("No cultures found.");
            }

            isInit = true;

            SetDefaultCulture();
        }
示例#2
0
        void Awake()
        {
            try {
                Log.Info("TMPELifecycle.Awake()");
                Instance = this;
#if BENCHMARK
                Benchmark.BenchmarkManager.Setup();
#endif
                TranslationDatabase.LoadAllTranslations();

                VersionUtil.LogEnvironmentDetails();
                Log._Debug("Scene is " + Scene);

                // check for incompatible mods
                if (UIView.GetAView() != null)
                {
                    // when TM:PE is enabled in content manager
                    CompatibilityCheck();
                }
                else
                {
                    // or when game first loads if TM:PE was already enabled
                    LoadingManager.instance.m_introLoaded += CompatibilityCheck;
                }

                HarmonyHelper.EnsureHarmonyInstalled();
                LoadingManager.instance.m_levelPreLoaded += Preload;

                InGameHotReload = InGameOrEditor();
                if (InGameHotReload)
                {
                    Preload();
                    SerializableDataExtension.Load();
                    Load();
                }

#if DEBUG
                const bool installHarmonyASAP = false; // set true for fast testing
                if (installHarmonyASAP)
                {
                    HarmonyHelper.DoOnHarmonyReady(Patcher.Install);
                }
#endif
            } catch (Exception ex) {
                ex.LogException(true);
            }
        }
 static LoadingExtension()
 {
     TranslationDatabase.LoadAllTranslations();
 }
 private void TryEnsureSchemas()
 {
     TranslationDatabase.TryEnsureSchema(typeof(Translation));
     LanguageDatabase.TryEnsureSchema(typeof(Language));
 }