public ShowIfAttribute(string fieldName, MultiOp multiOperator, params object[] values) { this.fieldName = fieldName; this.@operator = Op.None; this.multiOperator = multiOperator; this.values = values; }
public ShowIfAttribute(string fieldName, Op @operator, object value) { this.fieldName = fieldName; this.@operator = @operator; this.multiOperator = MultiOp.None; this.values = new object[] { value }; }
public SceneStack(IEngine engine) { Register = engine.MultiOp <Scene>(allowWriters: true); Unregister = engine.MultiOp <Scene>(allowWriters: true); ActiveScenes = engine.Li(new List <Scene>()); Back = engine.Op <bool>(allowWriters: true); registeredScenes = engine.Li(new List <Scene>()); }
private void InitializeDrawer(SerializedProperty property) { ShowIfAttribute showIfAttr = (this.drawer.attribute as ShowIfAttribute); if (showIfAttr != null) { this.fieldName = showIfAttr.fieldName; this.@operator = showIfAttr.@operator; this.multiOperator = showIfAttr.multiOperator; this.values = showIfAttr.values; } else { HideIfAttribute hideIfAttr = (this.drawer.attribute as HideIfAttribute); if (hideIfAttr != null) { this.fieldName = hideIfAttr.fieldName; this.@operator = hideIfAttr.@operator; this.multiOperator = hideIfAttr.multiOperator; this.values = hideIfAttr.values; } else { this.errorAttribute = "ShowIfAttribute or HideIfAttribute is required by field " + this.name + "."; } } this.conditionField = this.drawer.fieldInfo.DeclaringType.GetField(this.fieldName, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public); if (this.conditionField == null) { this.errorAttribute = this.name + " is requiring field \"" + this.fieldName + "\"."; return; } else if (this.@operator != Op.None) { if (this.values[0] == null) { this.targetValueStringified = new string[] { string.Empty }; this.PropertyHeight = this.GetHeightAllOpsString; if (this.@operator != Op.Equals && this.@operator != Op.Diff) { this.errorAttribute = this.name + " is requiring a null value whereas its operator is \"" + this.@operator + "\" which is impossible."; } } else if (this.values[0] is Boolean) { this.targetValueStringified = new string[] { this.values[0].ToString() }; this.PropertyHeight = this.GetHeightAllOpsString; if (this.@operator != Op.Equals && this.@operator != Op.Diff) { this.errorAttribute = this.name + " is requiring a boolean whereas its operator is \"" + this.@operator + "\" which is impossible."; } } else if (this.values[0] is Int32 || this.values[0] is Single || this.values[0] is Enum || this.values[0] is Double || this.values[0] is Decimal || this.values[0] is Int16 || this.values[0] is Int64 || this.values[0] is UInt16 || this.values[0] is UInt32 || this.values[0] is UInt64 || this.values[0] is Byte || this.values[0] is SByte) { this.targetValueDecimaled = new Decimal[] { Convert.ToDecimal(this.values[0]) }; this.PropertyHeight = this.GetHeightAllOpsScalar; } else { this.targetValueStringified = new string[] { this.values[0].ToString() }; this.PropertyHeight = this.GetHeightAllOpsString; } } else if (this.multiOperator != MultiOp.None) { if (this.CheckUseOfNonScalarValue() == true) { this.targetValueStringified = new string[this.values.Length]; for (int i = 0; i < this.values.Length; i++) { if (this.values[i] != null) { this.targetValueStringified[i] = this.values[i].ToString(); } else { this.targetValueStringified[i] = string.Empty; } } this.PropertyHeight = this.GetHeightMultiOpsString; } else { this.targetValueDecimaled = new Decimal[this.values.Length]; for (int i = 0; i < this.values.Length; i++) { this.targetValueDecimaled[i] = Convert.ToDecimal(this.values[i]); } this.PropertyHeight = this.GetHeightMultiOpsScalar; } } // Force the next update. object newValue = this.conditionField.GetValue(property.serializedObject.targetObject); if (this.lastValue == newValue) { this.lastValue = true; } }
public Token(MultiOp <T> s, Priority p, T m) { priority = p; value = m; source = s; }