public override void Begin() { base.Begin(); // add on-screen elements like GameLoader/OverworldLoader Add(new HudRenderer()); Add(snow); RendererList.UpdateLists(); // register the routine Entity entity = new Entity(); entity.Add(new Coroutine(Routine())); Add(entity); // run the update check task asynchronously new Task(() => { // display "checking for updates" message, in case the async task is not done yet. modUpdatingMessage = Dialog.Clean("AUTOUPDATECHECKER_CHECKING"); SortedDictionary <ModUpdateInfo, EverestModuleMetadata> updateList = ModUpdaterHelper.GetAsyncLoadedModUpdates(); if (updateList == null || updateList.Count == 0) { // no mod update, clear message and continue right away. modUpdatingMessage = null; shouldContinue = true; } else { // install mod updates autoUpdate(updateList); } }).Start(); }
private IEnumerator Routine() { // display "checking for updates" message, in case the async task is not done yet. modUpdatingMessage = Dialog.Clean("AUTOUPDATECHECKER_CHECKING"); // wait until the update check is over. showCancel = true; while (!ModUpdaterHelper.IsAsyncUpdateCheckingDone() && !skipUpdate) { yield return(null); } showCancel = false; if (!skipUpdate) { SortedDictionary <ModUpdateInfo, EverestModuleMetadata> updateList = ModUpdaterHelper.GetAsyncLoadedModUpdates(); if (updateList == null || updateList.Count == 0) { // no mod update, clear message and continue right away. modUpdatingMessage = null; shouldContinue = true; } else { // install mod updates new Task(() => autoUpdate(updateList)).Start(); } // wait until we can continue (async task finished, or player hit Confirm to continue) while (!shouldContinue) { yield return(null); } } // proceed to the title screen, as GameLoader would do it normally. Engine.Scene = new OverworldLoader(Overworld.StartMode.Titlescreen, snow); }
public MainMenuModOptionsButton(string labelName, string iconName, Oui oui, Vector2 targetPosition, Vector2 tweenFrom, Action onConfirm) : base(labelName, iconName, oui, targetPosition, tweenFrom, onConfirm) { int delayedModCount = Everest.Loader.Delayed.Count; // if the update check failed or isn't done yet, assume there are no updates (no message in main menu). int modUpdatesAvailable = ModUpdaterHelper.IsAsyncUpdateCheckingDone() ? (ModUpdaterHelper.GetAsyncLoadedModUpdates()?.Count ?? 0) : 0; if (delayedModCount > 1) { subText = string.Format(Dialog.Get("MENU_MODOPTIONS_MULTIPLE_MODS_FAILEDTOLOAD"), delayedModCount); } else if (delayedModCount == 1) { subText = Dialog.Clean("MENU_MODOPTIONS_ONE_MOD_FAILEDTOLOAD"); } else if (Everest.Updater.HasUpdate) { subText = Dialog.Clean("MENU_MODOPTIONS_UPDATE_AVAILABLE"); } else if (modUpdatesAvailable > 1) { subText = string.Format(Dialog.Get("MENU_MODOPTIONS_MOD_UPDATES_AVAILABLE"), modUpdatesAvailable); } else if (modUpdatesAvailable == 1) { subText = Dialog.Clean("MENU_MODOPTIONS_MOD_UPDATE_AVAILABLE"); } else if (CoreModule.Settings.WarnOnEverestYamlErrors && Everest.Loader.FilesWithMetadataLoadFailures.Count > 0) { subText = Dialog.Clean("MENU_MODOPTIONS_EVEREST_YAML_ERRORS"); } else { subText = null; } }
private static Scene _GetNextScene(Overworld.StartMode startMode, HiresSnow snow) { bool transitionToModUpdater = false; if (CoreModule.Settings.AutoUpdateModsOnStartup) { if (!ModUpdaterHelper.IsAsyncUpdateCheckingDone()) { // update checking is not done yet. // transition to mod updater screen to display the "checking for updates" message. transitionToModUpdater = true; } else { SortedDictionary <ModUpdateInfo, EverestModuleMetadata> modUpdates = ModUpdaterHelper.GetAsyncLoadedModUpdates(); if (modUpdates != null && modUpdates.Count != 0) { // update checking is done, and updates are available. // transition to mod updater screen in order to install the updates transitionToModUpdater = true; } } } if (transitionToModUpdater) { return(new AutoModUpdater(snow)); } else { return(new OverworldLoader(startMode, snow)); } }