/// <summary>
        /// Function for cheking if the trigger should cause a screenshot
        /// </summary>
        /// <param name="key">Optional, used for keypress</param>
        /// <returns>True if the rule should trigger</returns>
        public bool CheckTrigger(SButton key = SButton.None)
        {
#if DEBUG
            MTrace($"m_triggered = {m_triggered}");
#endif
            if (m_triggered)
            {
                return(false);
            }
            DateFlags     current_date     = GetDate();
            WeatherFlags  current_weather  = GetWeather();
            LocationFlags current_location = GetLocation();
            if (current_weather != (current_weather & Weather))
            {
                return(false);
            }
            if (current_location != (current_location & Location))
            {
                return(false);
            }
            if (current_date != (current_date & Days))
            {
                // Trigger will never be valid for this day,
                // wait for the next to reset.
                // Some mods can mess with weather
                m_triggered = true;
                return(false);
            }

            // Some mods can mess with time so don't set triggered flag
            if (!CheckTime(Game1.timeOfDay))
            {
                return(false);
            }

            // Keys is not a flags enum, only one can be set at a time
            if (Key != key)
            {
                return(false);
            }


            // If it is button based, allow another screenshot after this one for this day
            if (SButton.None == key)
            {
                m_triggered = true;
            }

            return(true);
        }
Esempio n. 2
0
        void SetWeatherFlag(WeatherFlags flag, bool value)
        {
            if (value)
            {
                // When setting weather type, unset all weather types bits first
                if ((flag & WeatherFlags.WeatherTypeMask) != 0)
                {
                    Data.Flags &= ~WeatherFlags.WeatherTypeMask;
                }

                Data.Flags |= flag;
            }
            else
            {
                Data.Flags &= ~flag;
            }
        }
Esempio n. 3
0
 bool HasWeatherFlag(WeatherFlags flag)
 {
     return(Data.Flags.HasFlag(flag));
 }