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

40  {
41  // Get the value currently displayed
42  float val = input.value;
43 
44  // Update it to the target, if possible.
45  try {
46  switch (memberType)
47  {
48  case MemberType.FIELD:
49  {
50  target.GetType().GetField(field).SetValue(target,
51  System.Convert.ChangeType(val, target.GetType().GetField(field).FieldType)
52  );
53  break;
54  }
55  case MemberType.PROPERTY:
56  {
57  target.GetType().GetProperty(field).SetValue(target,
58  System.Convert.ChangeType(val, target.GetType().GetProperty(field).PropertyType)
59  );
60  break;
61  }
62  }
63  }
64  catch(System.Exception) {
65  AVR_DevConsole.cwarn("Could not update the given target value to "+val, this);
66  }
67  }