VR Development Framework
v 1.0.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
override void AVR.UI.Link.AVRUI_Link_TMPDropdown.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 55 of file AVRUI_Link_TMPDropdown.cs.

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