コード例 #1
0
        /// <summary>Raised after drawing the HUD (item toolbar, clock, etc) to the sprite batch, but before it's rendered to the screen. The vanilla HUD may be hidden at this point (e.g. because a menu is open).</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OnRenderedHud(object sender, RenderedHudEventArgs e)
        {
            //float shadowMult = 0f;
            if (!Context.IsWorldReady)
            {
                return;
            }

            var weatherMenu = Game1.onScreenMenus.OfType <DayTimeMoneyBox>().FirstOrDefault();

            if (weatherMenu == null)
            {
                return;
            }
            // abort abort abort (maybe another mod replaced it?)

            if (WeatherOpt.EnableCustomWeatherIcon)
            {
                //determine icon offset
                if (!Game1.eventUp)
                {
                    if ((int)Conditions.CurrentWeatherIcon != (int)WeatherIcon.IconError)
                    {
                        RWeatherIcon = new Rectangle(0 + 12 * (int)Conditions.CurrentWeatherIcon, Game1.isDarkOut() ? 8 : 0, 12, 8);
                    }

                    if ((int)Conditions.CurrentWeatherIcon == (int)WeatherIcon.IconBloodMoon)
                    {
                        RWeatherIcon = new Rectangle(144, 8, 12, 8);
                    }

                    if ((int)Conditions.CurrentWeatherIcon == (int)WeatherIcon.IconError)
                    {
                        RWeatherIcon = new Rectangle(144, 0, 12, 8);
                    }

                    Game1.spriteBatch.Draw(OurIcons.WeatherSource, weatherMenu.position + new Vector2(116f, 68f), RWeatherIcon, Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, .1f);
                }

                //redraw mouse cursor
                SDVUtilities.RedrawMouseCursor();
            }
        }