VR Development Framework
v 1.0.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
override void AVR.UI.Link.AVRUI_Link_Dropdown.updateValue ( )
inlinevirtual

This method is executed when the runtime user changes the value of the UI element. This method should change the field on the actual target respectively.

Implements AVR.UI.Link.AVRUI_Link.

Definition at line 56 of file AVRUI_Link_Dropdown.cs.

57  {
58  // Get the value currently displayed
59  string text = input.options[input.value].text;
60 
61  // Update it to the target, if possible.
62  try {
63  switch (memberType)
64  {
65  case MemberType.FIELD:
66  {
67  int numval = (int)System.Enum.Parse(target.GetType().GetField(field).FieldType, text);
68  target.GetType().GetField(field).SetValue(target, numval);
69  break;
70  }
71  case MemberType.PROPERTY:
72  {
73  int numval = (int)System.Enum.Parse(target.GetType().GetProperty(field).PropertyType, text);
74  target.GetType().GetProperty(field).SetValue(target, numval);
75  break;
76  }
77  }
78  }
79  catch(System.Exception) {
80  AVR_DevConsole.cwarn("Could not update the given target value to "+text, this);
81  }
82  }