Replies: 41 (Who?), Viewed: 7492 times.
Page 2 of 2
Field Researcher
Original Poster
#35 Old 22nd Jul 2018 at 6:06 PM Last edited by Battery : 22nd Jul 2018 at 7:50 PM.
Thanks for the imput Lyralei i implementet this way for version 1.0.0 and up.

I have Added the Cycleable MenuObject for Version 1.0.1


CyclableMenuOption(string Descriptor, IList Collection, object CurrentObject, Action<object> SetValueAction)

Example:

public string SelectedDay = "Monday";

CyclableMenuOption("Weekday", new String[]{"Monday","Tuesday","Wednesday","Thursday ","Friday"},SelectedDay,(x)=>
{
SelectedDay = (string)x;
}));

This will let the user select one day from Monday to Friday left clicking the option will move one day ahead while a right click will move the selection one day back.
Field Researcher
#36 Old 9th Aug 2020 at 1:00 AM
Hello @Battery! I hope this is still the right place to ask questions about this mod? Thank you for sharing it, it looks like it's going to make menus so much easier!

I'm using version 1.02b4 to make a menu for choosing a sim from a set of possibilities; I've followed your Object Picker example and written a row-populating method, a method to run after making a selection, and a method to display the menu, but the MenuContainer constructor (is that the right thing to call it?) seems to be expecting my row-populating method to have a different return type than it does - is declaring that method as a public static list and the post-selection method as a public static void still correct? I notice the version I've been using is newer than the example, so I wondered if something changed.
Field Researcher
Original Poster
#37 Old 9th Aug 2020 at 8:35 AM
Hey @lizcandor,

thanks for checking out the mod. I indeed change it around a bit. I guess you are using the 7. Overload of the ctor ?
This one:


if so here is a populating method you can use you need to have a List that contains your sims (in the example below its called Simlist)

Code:
		static List<List<ObjectPicker.RowInfo>> Populate()
		{
			List<List<ObjectPicker.RowInfo>> rinfolist = new List<List<ObjectPicker.RowInfo>>();
			rinfolist.Add(Battery.UI.Menus.MenuFormattingUtil.F_ColorCodeSimList(Simlist));
			return rinfolist;
		}


You can then act upon the selection with a method like this

Code:
		static void OnEnd(List<ObjectPicker.RowInfo> Selection)
		{
			for (int i = 0; i < Selection.Count; i++) 
			{
				MessageUtil.WriteNotification((Selection[i].Item as Sim).FullName);
			}
		}
Screenshots
Field Researcher
#38 Old 9th Aug 2020 at 2:43 PM
Ah, I see, my populate method just returns a list instead of a list of lists - I'll give that a try! Thank you!
Field Researcher
Original Poster
#39 Old 9th Aug 2020 at 3:11 PM
Yes just a short explanation. the top level list is for the different tabs each sub list contains the menu entries for that specific tab

so list[0][1] would be the second menu entry of the first Menu Tab
Field Researcher
#40 Old 9th Aug 2020 at 3:27 PM
The menu appeared, and had the sims on it that it was supposed to! Yaaay! Now to make the post-selection method actually do something instead of just saying "hi I ran", that should be the easy part. This is great!

Another question: does the way to add column info also change? I'd like to add some text about each sim in the list as well, and making the column info also a list of lists doesn't seem to be the right way to do that.

(Also that's good to know about how the list levels work, I was wondering how to navigate that)
Field Researcher
Original Poster
#41 Old 9th Aug 2020 at 3:38 PM Last edited by Battery : 9th Aug 2020 at 6:34 PM.
Here i modified the ColorCode Method to include a description next to the Thumbnail and name you can modify it further to fit your needs
Code:
public static List<ObjectPicker.RowInfo> F_ColorCodeSimList(List<Sim> SimList)
{
		List<ObjectPicker.RowInfo> rinfo = new List<ObjectPicker.RowInfo>();
		List<ObjectPicker.ColumnInfo> cinfo;
		foreach (Sim sim in SimList) 
		{
			cinfo = new List<ObjectPicker.ColumnInfo>();
			if (sim.IsFemale) 
			{
				cinfo.Add(new ObjectPicker.ThumbAndTextColumn(sim.SimDescription.GetThumbnailKey(ThumbnailSize.Large, 0), sim.LastName + ", " + sim.FirstName));
				cinfo.Add(new ObjectPicker.TextColumn("Your Desciption Here"));  // Put Your Description Text here (replace "Your Desciption Here")
				cinfo[0].mbOverrideTextColor = true;
				cinfo[0].TextColor = new Color(255, 105, 180);
				cinfo[0].mbOverrideTextStyle = true;
				cinfo[0].TextStyle = 2u;
				rinfo.Add(new ObjectPicker.RowInfo(sim, cinfo));
			} 
			else 
			{
				cinfo.Add(new ObjectPicker.ThumbAndTextColumn(sim.SimDescription.GetThumbnailKey(ThumbnailSize.Large, 0), sim.LastName + ", " + sim.FirstName));
				cinfo.Add(new ObjectPicker.TextColumn("Your Desciption Here")); // Put Your Description Text here (replace "Your Desciption Here")
				cinfo[0].mbOverrideTextColor = true;
				cinfo[0].TextColor = new Color(65, 105, 225);
				cinfo[0].mbOverrideTextStyle = true;
				cinfo[0].TextStyle = 2u;
				rinfo.Add(new ObjectPicker.RowInfo(sim, cinfo));
			}
		}
	return rinfo;
}


It is important to note that every MenuEntry within a Tab has to have the same Column configuration !

You can also set the number of possible selections by setting mc.mSelectable to your desired value.
Field Researcher
#42 Old 9th Aug 2020 at 6:22 PM
Ah, I see how that works now - thanks!
Page 2 of 2
Back to top