Пример #1
0
        private void SetTargetExt(ScalarValue ext)
        {
            BaseAxisField field = (BaseAxisField)typeof(ModuleRoboticServoPiston)
                                  .GetField("targetExtensionAxisField", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(servo);

            field.SetValue((float)ext, field.module);
        }
Пример #2
0
        /// <summary>
        /// Set the extension of the piston.
        /// </summary>
        /// <param name="value">The amount to which the piston should be extended.</param>
        public void SetExtension(float value)
        {
            BaseAxisField field = (BaseAxisField)typeof(ModuleRoboticServoPiston)
                                  .GetField("targetExtensionAxisField", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(servo);

            field.SetValue((float)value, field.module);
        }
        public override void OnStart(StartState state)
        {
            base.OnStart(state);
            brightnessField = (BaseAxisField)Fields["brightness"];
            startState      = state;
            if (!string.IsNullOrEmpty(label))
            {
                RedField.guiName        = label + ": Red";
                GreenField.guiName      = label + ": Green";
                BlueField.guiName       = label + ": Blue";
                brightnessField.guiName = label + ": Brightness";
            }

            if (!string.IsNullOrEmpty(color))
            {
                currentColor = Colors.Parse(color, DEFAULT_COLOR);
                red          = roundHundredths(currentColor.r);
                green        = roundHundredths(currentColor.g);
                blue         = roundHundredths(currentColor.b);
            }

            RedField.uiControlEditor.onFieldChanged   = OnColorSliderChanged;
            GreenField.uiControlEditor.onFieldChanged = OnColorSliderChanged;
            BlueField.uiControlEditor.onFieldChanged  = OnColorSliderChanged;
            lastBrightness = brightness;
        }
        public override void OnStart(StartState state)
        {
            base.OnStart(state);

            axisGroupField = (BaseAxisField)Fields["axisGroup"];

            StatusField.uiControlEditor.onFieldChanged = OnEditorToggleChanged;

            SetInputUIState();
        }
Пример #5
0
        private void SetRPM(float RPM)
        {
            BaseAxisField field = (BaseAxisField)typeof(ModuleRoboticServoRotor).GetField("rpmLimitAxisField", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(rotor);

            field.SetValue(RPM, field.module);
            //typeof(ModuleRoboticServoRotor)
            //.GetMethod("UpdateAxisFieldHardLimit", BindingFlags.Instance | BindingFlags.NonPublic)
            //.Invoke(rotor, new object[] {"rpmLimitAxisField", new Vector2(0f, RPM)});
            //rotor.Fields["rpmLimit"].SetValue(RPM, rotor);
            //object[] parametersArray = new object[] { UI_Scene.Flight };
            //BaseField a = typeof(BaseServo).GetField("partActionMenuOpen", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(rotor).SetValue(rotor, true);
            //rotor.GetType().GetMethod("UpdatePAWUI", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(rotor, parametersArray);
            //typeof(BaseServo).GetField("partActionMenuOpen", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(rotor, false);
        }
 public override void OnAwake()
 {
     base.OnAwake();
     brightnessField = (BaseAxisField)Fields["brightness"];
     brightnessField.OnValueModified += OnBrightnessModified;
 }