コード例 #1
0
        /// <summary>Day ends (before save). This event is triggered *before* OnSaveLoaded for a new game.</summary>
        public static void OnDayEnding()
        {
            bool isNewGame = Game1.Date.TotalDays == -1;

            if (isNewGame)
            {
                SaveGameHelper.LoadFromFileOrInitialize();
                return;
            }

            // don't ever reset, just apply the gift taste
            if (ConfigHelper.Config.ResetEveryXDays == 0)
            {
                // apply gift taste changes at the end of day (and not immediately after gifting)
                // this way the social tab will show the reaction you actually got for that day
                SaveGameHelper.Apply();
                return;
            }

            int nextDay = Game1.Date.TotalDays + 1;

            if (nextDay % ConfigHelper.Config.ResetEveryXDays == 0)
            {
                SaveGameHelper.ResetSaveState();
                return;
            }

            SaveGameHelper.Apply();
        }
コード例 #2
0
        /// <summary>After save game got loaded (or new one is created).</summary>
        public static void OnSaveLoaded()
        {
            NpcHelper.StoreDefaultGiftTastes();

            if (!Context.IsMainPlayer)
            {
                return;
            }

            SaveGameHelper.LoadFromFileOrInitialize();
            SaveGameHelper.Apply();
        }