Example #1
0
File: ccd.cs Project: OSEHRA/mdo
 public SXCM_TS()
 {
     this.operatorField = SetOperator.I;
 }
Example #2
0
File: ccd.cs Project: OSEHRA/mdo
 public SXCM_PPD_PQ()
 {
     this.operatorField = SetOperator.I;
 }
Example #3
0
File: ccd.cs Project: OSEHRA/mdo
 public SXCM_REAL()
 {
     this.operatorField = SetOperator.I;
 }
Example #4
0
 public SXCM_PPD_PQ()
 {
     this.operatorField = SetOperator.I;
 }
Example #5
0
 public CE_EXAMPLE()
 {
     this.operatorField = SetOperator.I;
 }
Example #6
0
 public SXCM_INT()
 {
     this.operatorField = SetOperator.I;
 }
 public override bool IsArithmeticSupported(SetOperator setOperator)
 {
     return(true);
 }
Example #8
0
        public override void DrawCommandGUI()
        {
            serializedObject.Update();

            SetVariable t = target as SetVariable;

            var flowchart = (Flowchart)t.GetFlowchart();

            if (flowchart == null)
            {
                return;
            }

            EditorGUILayout.PropertyField(variableProp);

            if (variableProp.objectReferenceValue == null)
            {
                serializedObject.ApplyModifiedProperties();
                return;
            }

            Variable selectedVariable = variableProp.objectReferenceValue as Variable;

            System.Type variableType = selectedVariable.GetType();

            List <GUIContent> operatorsList = new List <GUIContent>();

            operatorsList.Add(new GUIContent("="));
            if (variableType == typeof(BooleanVariable))
            {
                operatorsList.Add(new GUIContent("=!"));
            }
            else if (variableType == typeof(IntegerVariable) ||
                     variableType == typeof(FloatVariable))
            {
                operatorsList.Add(new GUIContent("+="));
                operatorsList.Add(new GUIContent("-="));
                operatorsList.Add(new GUIContent("*="));
                operatorsList.Add(new GUIContent("\\="));
            }

            int selectedIndex = 0;

            switch (t._SetOperator)
            {
            default:
            case SetOperator.Assign:
                selectedIndex = 0;
                break;

            case SetOperator.Negate:
                selectedIndex = 1;
                break;

            case SetOperator.Add:
                selectedIndex = 1;
                break;

            case SetOperator.Subtract:
                selectedIndex = 2;
                break;

            case SetOperator.Multiply:
                selectedIndex = 3;
                break;

            case SetOperator.Divide:
                selectedIndex = 4;
                break;
            }

            selectedIndex = EditorGUILayout.Popup(new GUIContent("Operation", "Arithmetic operator to use"), selectedIndex, operatorsList.ToArray());

            SetOperator setOperator = SetOperator.Assign;

            if (variableType == typeof(BooleanVariable) ||
                variableType == typeof(StringVariable))
            {
                switch (selectedIndex)
                {
                default:
                case 0:
                    setOperator = SetOperator.Assign;
                    break;

                case 1:
                    setOperator = SetOperator.Negate;
                    break;
                }
            }
            else if (variableType == typeof(IntegerVariable) ||
                     variableType == typeof(FloatVariable))
            {
                switch (selectedIndex)
                {
                default:
                case 0:
                    setOperator = SetOperator.Assign;
                    break;

                case 1:
                    setOperator = SetOperator.Add;
                    break;

                case 2:
                    setOperator = SetOperator.Subtract;
                    break;

                case 3:
                    setOperator = SetOperator.Multiply;
                    break;

                case 4:
                    setOperator = SetOperator.Divide;
                    break;
                }
            }

            setOperatorProp.enumValueIndex = (int)setOperator;

            if (variableType == typeof(BooleanVariable))
            {
                EditorGUILayout.PropertyField(booleanDataProp, new GUIContent("Boolean"));
            }
            else if (variableType == typeof(IntegerVariable))
            {
                EditorGUILayout.PropertyField(integerDataProp, new GUIContent("Integer"));
            }
            else if (variableType == typeof(FloatVariable))
            {
                EditorGUILayout.PropertyField(floatDataProp, new GUIContent("Float"));
            }
            else if (variableType == typeof(StringVariable))
            {
                EditorGUILayout.PropertyField(stringDataProp, new GUIContent("String"));
            }

            serializedObject.ApplyModifiedProperties();
        }
Example #9
0
 /// <summary>Constructs a simple interval based on a single value and an operator.</summary>
 /// <remarks>Constructs a simple interval based on a single value and an operator.</remarks>
 /// <TBD></TBD>
 /// <param name="value">the simple value for the Interval</param>
 /// <param name="operator">the operator for the Interval</param>
 /// <returns>the constructed Interval</returns>
 public static Interval <T> CreateSimple <T>(T value, SetOperator @operator)
 {
     return(new Interval <T>(value, @operator));
 }
Example #10
0
 public SXCM_REAL()
 {
     this.operatorField = SetOperator.I;
 }
Example #11
0
 public virtual void Apply(SetOperator setOperator, T value)
 {
     Debug.LogError("Variable doesn't have any operators.");
 }
Example #12
0
 /// <summary>
 /// Constructs a TS using the given date and operator.
 /// </summary>
 /// <param name="date">the initial value</param>
 /// <param name="setOperator">the initial operator</param>
 public TSImpl(PlatformDate date, SetOperator setOperator)  :
     base(typeof(PlatformDate), date, null, StandardDataType.TS)
 {
     base.Operator = setOperator;
 }
Example #13
0
 public override bool IsArithmeticSupported(SetOperator setOperator)
 {
     return(setOperator == SetOperator.Multiply || base.IsArithmeticSupported(setOperator));
 }
Example #14
0
 /// <summary>
 /// Constructs a TS using the given date and operator.
 /// </summary>
 /// <param name="date">the initial value</param>
 /// <param name="setOperator">the initial operator</param>
 public TSCDAR1Impl(MbDate date, SetOperator setOperator) :
     base(typeof(MbDate), date, null, StandardDataType.TS)
 {
 }