/** * <summary>Create a new NewsBulletinObject that draws its events from the given manager.</summary> * * <param name="eventManager">The event manager that provides the current events.</param> */ public NewsBulletinObject(EconEventManager eventManager) { this.eventManager = eventManager; // Set up some properties: this.name = null; this.displayName = null; this.type = "interactive"; this.fragility = 2; // Prevent it from breaking this.boundingBox = new Rectangle(0, 0, Game1.tileSize, Game1.tileSize); this.canBeGrabbed = false; this.isRecipe = false; this.isLamp = false; this.questItem = false; }
private void SaveEvents_AfterLoad(object sender, EventArgs e) { // Note: This is called both at the beginning of a new game and after // loading a game. // Create the event manager and load events for the player. this.Monitor.Log("Creating Event Manager for loaded game.", LogLevel.Trace); this.eventManager = new EconEventManager(this.Monitor); this.Monitor.Log($"Loading events for {Game1.player.name}.", LogLevel.Info); if (this.eventManager.LoadPlayerEvents(this.Helper)) { this.Monitor.Log("Loaded the following events:"); foreach (var evnt in this.eventManager.CurrentEvents) { this.Monitor.Log($"\t{evnt}"); } } else { this.Monitor.Log("Failed to load events. Must create new events on DayStart."); } // Modify town to move Pierre's hours sign tile from Buildings layer // to Back layer. This prevents the Town object from displaying a // dialogue we don't want without screwing with the way the building // looks. It has the unfortunate effect of making the tile passable, // which we remedy by adding our own invisible, non-passable object // to the tile location. this.Monitor.Log("HACK: Moving Pierre's hours sign from Buildings layer to Back layer.", LogLevel.Trace); var town = GetTown(); var signLoc = new xTile.Dimensions.Location(45, 56); var buildings = town.Map.GetLayer("Buildings"); var back = town.Map.GetLayer("Back"); var signTile = buildings.Tiles[signLoc]; buildings.Tiles[signLoc] = null; back.Tiles[signLoc] = signTile; // Add our news bulletin object: this.Monitor.Log("Adding Bulletin object to location of Pierre's hours sign.", LogLevel.Trace); var signLocVec = new Microsoft.Xna.Framework.Vector2(signLoc.X, signLoc.Y); this.bulletinObject = new NewsBulletinObject(this.eventManager); this.bulletinObject.SetInTown(town, signLocVec); }