PARAMETER PICKERS

The Parameter Pickers are another tool of the GUI for creating lists (dynamic or static) of possible values to be passed to a parameter. See the included example Example_ParamPickers for a possible application.

Parameter Pickers

Parameter Pickers

To add parameter pickers you have to create new classes that extend the base class ParameterPicker


1. Create a new class in any folder of your project.

Parameter Pickers


2. Set the following namespace for the class: GIGA.CommandConsole.UI.ParamPicker and make it inherit from base class ParameterPicker.

Parameter Pickers


3. Add the following attribute to the class: ParameterPickerGetterAttribute, specifying the command class type and the parameter name you want to link this picker class to.

Parameter Pickers


4. Edit the GetPickers() method to add your logic and fill the list of values. This method simply return a list of ParameterPickerInfo, containing the value to return and a label to be displayed in the list.


  public class ParamPicker_Test : ParameterPicker

  {

    public override List GetPickers()

    {

      List pickers = new List();



      // Getting all items from the list, and adding ParameterPickerInfo entry for each one. 

      foreach (var item in GameObject.FindObjectOfType().itemsList)

      {

        pickers.Add(new ParameterPickerInfo{

          value = item.Key,

          // The list will show labels in the format id - name (e.g. 1 - Boots).

          text = string.Format("{0} - {1}", item.Value.id, item.Value.name),

        });

      }

      

      return pickers;

    }

  }