public BubbleGuyManager(string sSavePath, string sSpriteDir, IModHelper helper, IMonitor monitor, bool bIsMaster) { IsMaster = bIsMaster; oHelper = helper; oMonitor = monitor; Recorder = new BubbleRecorder(sSavePath); sSpirteDirectory = sSpriteDir; if (((Game1.IsMultiplayer && Game1.IsMasterGame) || (!Game1.IsMultiplayer)) && bIsMaster) { // // the master game will handle the cleanups // helper.Events.GameLoop.SaveLoaded += GameLoop_SaveLoaded; helper.Events.GameLoop.Saving += GameLoop_Saving; helper.Events.Multiplayer.PeerDisconnected += Multiplayer_PeerDisconnected; monitor.Log("Bubble guy master game hooks added.", LogLevel.Info); } if (bIsMaster) { helper.Events.Player.Warped += Player_Warped; } // // load default or custom bubble backgrounds // if (File.Exists(Path.Combine(sSpirteDirectory, "custom_think_bubble.png"))) { monitor.Log("Using custom Think bubble", LogLevel.Info); sbThinkBubble = new StardewBitmap(Path.Combine(sSpirteDirectory, "custom_think_bubble.png")); } else { sbThinkBubble = new StardewBitmap(Path.Combine(sSpirteDirectory, "think_bubble.png")); } if (File.Exists(Path.Combine(sSpirteDirectory, "custom_talk_bubble.png"))) { monitor.Log("Using custom Talk bubble", LogLevel.Info); try { sbTalkBubble = new StardewBitmap(Path.Combine(sSpirteDirectory, "custom_talk_bubble.png")); } catch (Exception ex) { monitor.Log("Failed to load custom talk bubble, using default. See logs for details", LogLevel.Info); monitor.Log($"Custome talk bubble error: {ex}", LogLevel.Debug); sbTalkBubble = new StardewBitmap(Path.Combine(sSpirteDirectory, "talk_bubble.png")); } } else { sbTalkBubble = new StardewBitmap(Path.Combine(sSpirteDirectory, "talk_bubble.png")); } txTalkBubble = sbTalkBubble.Texture(); txThinkBubble = sbThinkBubble.Texture(); }
public BubbleGuyManager(string sSavePath, string sSpriteDir, IModHelper helper, IMonitor monitor) { oHelper = helper; oMonitor = monitor; Recorder = new BubbleRecorder(sSavePath, oHelper); sSpirteDirectory = sSpriteDir; if (Game1.IsMasterGame) { // // the master game will handle the cleanups // helper.Events.GameLoop.Saving += GameLoop_Saving; helper.Events.Multiplayer.PeerDisconnected += Multiplayer_PeerDisconnected; } helper.Events.Player.Warped += Player_Warped; }