コード例 #1
0
 private void Specialized_LoadStageChanged(object sender, LoadStageChangedEventArgs e)
 {
     if (e.NewStage == StardewModdingAPI.Enums.LoadStage.Loaded)
     {
         this.PreloadAssets();
     }
 }
コード例 #2
0
ファイル: Mod.cs プロジェクト: Pathoschild/smapi-mod-dump
 private void OnLoadStageChanged(object sender, LoadStageChangedEventArgs e)
 {
     if (e.NewStage == LoadStage.CreatedInitialLocations || e.NewStage == LoadStage.SaveAddedLocations)
     {
         Game1.locations.Add(new JunimoWoods(Helper.Content));
     }
 }
コード例 #3
0
 /// <inheritdoc cref="ISpecializedEvents.LoadStageChanged"/>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event arguments.</param>
 private void OnLoadStageChanged(object sender, LoadStageChangedEventArgs e)
 {
     if (e.NewStage == LoadStage.SaveParsed)
     {
         LegacyDataMigrator.OnSaveParsed(this.Helper.ModRegistry);
     }
 }
コード例 #4
0
 private void OnLoadStageChanged(object s, LoadStageChangedEventArgs e)
 {
     if (e.NewStage == StardewModdingAPI.Enums.LoadStage.SaveLoadedBasicInfo)
     {
         this.EarlySetup();
     }
 }
コード例 #5
0
 private void onLoadStageChanged(object sender, LoadStageChangedEventArgs e)
 {
     if (e.NewStage == StardewModdingAPI.Enums.LoadStage.SaveParsed)
     {
         Log.debug("Loading stuff early (loading)");
         initStuff(loadIdFiles: false);
     }
 }
コード例 #6
0
        private void Specialized_LoadStageChanged(object sender, LoadStageChangedEventArgs e)
        {
            if (e.NewStage == StardewModdingAPI.Enums.LoadStage.Loaded)
            {
                Log.T("Invalidating assets on connected for multiplayer peer.");

                this.Helper.Content.InvalidateCache(Path.Combine("Data", "BigCraftablesInformation"));
                this.Helper.Content.InvalidateCache(Path.Combine("Data", "CraftingRecipes"));
                this.Helper.Content.InvalidateCache(Path.Combine("TileSheets", "Craftables"));
            }
        }
コード例 #7
0
 /// <summary>Raised when the low-level stage in the game's loading process has changed. This is an advanced event for mods which need to run code at specific points in the loading process. The available stages or when they happen might change without warning in future versions (e.g. due to changes in the game's load process), so mods using this event are more likely to break or have bugs.</summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event data.</param>
 private void OnLoadStageChanged(object sender, LoadStageChangedEventArgs e)
 {
     switch (e.NewStage)
     {
     case LoadStage.CreatedBasicInfo:
     case LoadStage.SaveLoadedBasicInfo:
         this.Monitor.VerboseLog($"Updating context: load stage changed to {e.NewStage}.");
         this.TokenManager.IsBasicInfoLoaded = true;
         this.UpdateContext();
         break;
     }
 }
コード例 #8
0
ファイル: ModEntry.cs プロジェクト: pomepome/StardewMods
 /// <summary>Raised when the low-level stage in the game's loading process has changed. This is an advanced event for mods which need to run code at specific points in the loading process. The available stages or when they happen might change without warning in future versions (e.g. due to changes in the game's load process), so mods using this event are more likely to break or have bugs.</summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event data.</param>
 private void OnLoadStageChanged(object sender, LoadStageChangedEventArgs e)
 {
     switch (e.NewStage)
     {
     case LoadStage.CreatedBasicInfo:
     case LoadStage.SaveLoadedBasicInfo:
     case LoadStage.Loaded when Game1.dayOfMonth == 0:     // handled by OnDayStarted if we're not creating a new save
         this.Monitor.VerboseLog($"Updating context: load stage changed to {e.NewStage}.");
         this.TokenManager.IsBasicInfoLoaded = true;
         this.UpdateContext(ContextUpdateType.All);
         break;
     }
 }
コード例 #9
0
ファイル: Mod.cs プロジェクト: Pathoschild/smapi-mod-dump
 private void OnLoadStageChanged(object sender, LoadStageChangedEventArgs e)
 {
     if (e.NewStage == LoadStage.CreatedInitialLocations || e.NewStage == LoadStage.SaveAddedLocations)
     {
         Game1.locations.Add(new MountainTop(Helper.Content));
         Game1.locations.Add(new MoonLandingArea(Helper.Content));
         Game1.locations.Add(new AsteroidsEntrance(Helper.Content));
         Game1.locations.Add(new LunarFarm(Helper.Content));
         Game1.locations.Add(new LunarFarmCave(Helper.Content));
         Game1.locations.Add(new MoonPlanetOverlook(Helper.Content));
         Game1.locations.Add(new UfoInterior(Helper.Content));
         Game1.locations.Add(new LunarFarmHouse(Helper.Content));
         Game1.locations.Add(new MoonInfuserRoom(Helper.Content));
     }
 }
コード例 #10
0
ファイル: ModEntry.cs プロジェクト: somnomania/smapi-mod-dump
        /*
         * When the mod first loads (Load initial overrides)
         */
        private void OnInitialLoad(object sender, LoadStageChangedEventArgs e)
        {
            // ignore if player hasn't loaded a save yet
            if (!Context.IsWorldReady)
            {
                return;
            }

            GameLocation playerLocation = Game1.player.currentLocation;

            if (playerLocation is FarmHouse)
            {
                this.UpdateSprites((FarmHouse)playerLocation, Game1.player);
            }
        }
コード例 #11
0
 private void OnLoadStageChanged(object sender, LoadStageChangedEventArgs e)
 {
     if (e.NewStage == StardewModdingAPI.Enums.LoadStage.SaveParsed)
     {
         LoadModData();
         LoadContentPacks();
         SetUpChickenData();
         string jaObjectsPath = System.IO.Path.Combine(Constants.CurrentSavePath, "JsonAssets", "ids-objects.json");
         if (System.IO.File.Exists(jaObjectsPath))
         {
             jaData = JsonConvert.DeserializeObject <Dictionary <string, int> >(System.IO.File.ReadAllText(jaObjectsPath));
         }
         FindIDsForEggs();
     }
 }
コード例 #12
0
        private void TryToResolveFarmId(object sender, LoadStageChangedEventArgs e)
        {
            if (e.NewStage == StardewModdingAPI.Enums.LoadStage.SaveLoadedBasicInfo)
            {
                if (Game1.whichFarm >= 5)
                {
                    MethodInfo  keyReader = Helper.Data.GetType().GetMethod("GetSaveFileKey", BindingFlags.NonPublic | BindingFlags.Instance);
                    string      key       = (string)keyReader.Invoke(Helper.Data, new object[] { "MtnFarmData" });
                    MtnFarmData farmData  = JsonConvert.DeserializeObject <MtnFarmData>(SaveGame.loaded.CustomData[key]);

                    if (farmData != null)
                    {
                        return;
                    }

                    CustomFarm farm = CustomManager.FarmList.Find(x => x.ID == Game1.whichFarm);

                    MtnFarmData customData = new MtnFarmData {
                        FarmTypeName = farm.Name
                    };
                    Helper.Data.WriteSaveData("MtnFarmData", customData);
                    Game1.whichFarm = 200;

                    CustomManager.LoadCustomFarmByMtnData();

                    int    farmIndex;
                    Map    map;
                    string mapAssetKey;

                    Game1.removeLocationFromLocationLookup("Farm");
                    for (farmIndex = 0; farmIndex < Game1.locations.Count; farmIndex++)
                    {
                        if (Game1.locations[farmIndex].Name == "Farm")
                        {
                            break;
                        }
                    }

                    mapAssetKey = CustomManager.GetAssetKey(out map, "Farm");
                    Game1.locations[farmIndex] = new Farm(mapAssetKey, "Farm");
                    Game1.locations[farmIndex].reloadMap();
                }
            }
        }
コード例 #13
0
 private void onLoadStageChanged(object sender, LoadStageChangedEventArgs e)
 {
     if (e.NewStage == StardewModdingAPI.Enums.LoadStage.SaveParsed)
     {
         Log.debug("Loading stuff early (loading)");
         initStuff(loadIdFiles: true);
     }
     else if (e.NewStage == StardewModdingAPI.Enums.LoadStage.SaveLoadedLocations)
     {
         Log.debug("Fixing IDs");
         fixIdsEverywhere();
     }
     else if (e.NewStage == StardewModdingAPI.Enums.LoadStage.Loaded)
     {
         Log.debug("Adding default recipes");
         foreach (var obj in objects)
         {
             if (obj.Recipe != null && obj.Recipe.IsDefault && !Game1.player.knowsRecipe(obj.Name))
             {
                 if (obj.Category == ObjectData.Category_.Cooking)
                 {
                     Game1.player.cookingRecipes.Add(obj.Name, 0);
                 }
                 else
                 {
                     Game1.player.craftingRecipes.Add(obj.Name, 0);
                 }
             }
         }
         foreach (var big in bigCraftables)
         {
             if (big.Recipe != null && big.Recipe.IsDefault && !Game1.player.knowsRecipe(big.Name))
             {
                 Game1.player.craftingRecipes.Add(big.Name, 0);
             }
         }
     }
 }
コード例 #14
0
 private void OnLoadingStageChanged(object sender, LoadStageChangedEventArgs e)
 {
     this.Helper.Content.AssetEditors.Add(new VoidshroomDataInjector(this.Monitor));
 }