private void cmdResetPortableTV(string _command, string[] _args) { try { tv = new PortableTV(); } catch (Exception e) { Monitor.Log($"Couldn't reset Portable TV: {e.Message}", LogLevel.Error); } }
private void onDayStarted(object _sender, DayStartedEventArgs _e) { // Set up the PortableTV. This furniture item isn't actually made or // handled by the player; it only handles running the TV on screen // when the "Portable TV" inventory object is interacted with. tv = new PortableTV(); // Have the the inventory toolbar and its buttons ready for checking // in onButtonPressed. var toolbar = Game1.onScreenMenus.First((m) => m is Toolbar) as Toolbar; this.toolbar = new WeakReference <Toolbar> (toolbar); toolbarButtons = Helper.Reflection.GetField <List <ClickableComponent> > (toolbar, "buttons"); }
private void cmdResetPortableTV(string _command, string[] _args) { try { if (!Context.IsWorldReady) { throw new Exception("Cannot reset Portable TV without an active save."); } tv = new PortableTV(); } catch (Exception e) { Monitor.Log($"Couldn't reset Portable TV: {e.Message}", LogLevel.Error); } }