public void RenderingActiveMenu_CharacterCustomization(object sender, RenderingActiveMenuEventArgs e) { Type type = typeof(CharacterCustomization); CharacterCustomization activeMenu = Game1.activeClickableMenu as CharacterCustomization; TextBox nameBox = LazyHelper.GetInstanceField(type, activeMenu, "nameBox") as TextBox; TextBox farmNameBox = LazyHelper.GetInstanceField(type, activeMenu, "farmnameBox") as TextBox; TextBox favThingBox = LazyHelper.GetInstanceField(type, activeMenu, "favThingBox") as TextBox; if (!nameBox.Selected && String.IsNullOrWhiteSpace(nameBox.Text)) { nameBox.Text = "Player"; } Game1.player.Name = nameBox.Text; if (!farmNameBox.Selected && String.IsNullOrWhiteSpace(farmNameBox.Text)) { farmNameBox.Text = "Farm"; } if (!favThingBox.Selected && String.IsNullOrWhiteSpace(favThingBox.Text)) { favThingBox.Text = "Bananas"; } }
public void MenuChanged_CarpenterMenu(object sender, MenuChangedEventArgs e) { if (!Context.IsWorldReady) { return; } if (Game1.IsMasterGame || Game1.IsServer) { // int buildingsConstructed = Game1.getFarm().getNumberBuildingsConstructed("Cabin"); Type type = typeof(CarpenterMenu); object newMenu = e.NewMenu; List <BluePrint> bluePrints = LazyHelper.GetInstanceField(type, newMenu, "blueprints") as List <BluePrint>; bluePrints?.Add(new BluePrint("Stone Cabin")); bluePrints?.Add(new BluePrint("Plank Cabin")); bluePrints?.Add(new BluePrint("Log Cabin")); } }