public static void Register() { NamedConstants.RegisterExpression("Console", () => new ConsoleObject(), "Console.WriteLine"); Object = Builder.New .WithAction("WriteLine", () => Console.WriteLine()) .WithAction("WriteLine", (TextValue t) => Console.WriteLine(t.Text), true) .WithAction("Write", (TextValue t) => Console.Write(t.Text), true) .WithAction("Repeat", (TextValue t, IntValue n) => Console.WriteLine(string.Concat(Enumerable.Repeat(t.Text, (int)n))), true) .Build(); }
private void OnEnable() { namedConstants = (NamedConstants)this.serializedObject.targetObject; list = new ReorderableList( serializedObject, serializedObject.FindProperty("values"), true, true, true, true); list.drawHeaderCallback = this.OnDrawHeader; list.drawElementCallback = this.OnDrawElement; }
public static void Register() { NamedConstants.RegisterExpression("Trig", () => new ConsoleObject(), "Trig.sin, Trig.arcsin, Trig.degsin, Trig.degarcsin"); Object = Builder.New .WithFunc("sin", (DecimalValue d) => (DecimalValue)Math.Sin((double)d), true) .WithFunc("cos", (DecimalValue d) => (DecimalValue)Math.Cos((double)d), true) .WithFunc("tan", (DecimalValue d) => (DecimalValue)Math.Tan((double)d), true) .WithFunc("degsin", (DecimalValue d) => (DecimalValue)(Math.Sin((double)d) / Math.PI * 180), true) .WithFunc("degcos", (DecimalValue d) => (DecimalValue)(Math.Cos((double)d) / Math.PI * 180), true) .WithFunc("degtan", (DecimalValue d) => (DecimalValue)(Math.Tan((double)d) / Math.PI * 180), true) .WithFunc("arcsin", (DecimalValue d) => (DecimalValue)Math.Sinh((double)d), true) .WithFunc("arccos", (DecimalValue d) => (DecimalValue)Math.Cosh((double)d), true) .WithFunc("arctan", (DecimalValue d) => (DecimalValue)Math.Tanh((double)d), true) .WithFunc("degarcsin", (DecimalValue d) => (DecimalValue)Math.Sinh((double)d / 180 * Math.PI), true) .WithFunc("degarccos", (DecimalValue d) => (DecimalValue)Math.Sinh((double)d / 180 * Math.PI), true) .WithFunc("degarctan", (DecimalValue d) => (DecimalValue)Math.Sinh((double)d / 180 * Math.PI), true) .Build(); }
public static void Register() { NamedConstants.RegisterExpression("SumDeep", () => new SumDeepFunction(), "Sums up all parameters given to it. Explores lists deeply"); }
public static void Register() { NamedConstants.RegisterValue("null", Null); }
public static void Register() { NamedConstants.RegisterValue("i", new ComplexValue(0, 1), "I"); }
public static void Register() { NamedConstants.RegisterExpression("Length", () => new LengthFunction(), "Gets the length of a vector described by a list"); }
public static void NamedConstantGroupMaskPopup(SerializedObject serializedObject, string label, string propertyName, NamedConstants constants, string groupName) { NamedConstantGroupMaskPopup(serializedObject, label, propertyName, constants, null); }
public static void Register() { NamedConstants.RegisterExpression("Sqrt", () => new SqrtFunction(), "Sqrt(v)"); }
public static void Register() { NamedConstants.RegisterValue("true", new BooleanValue(true)); NamedConstants.RegisterValue("false", new BooleanValue(false)); }
public static void Register() { NamedConstants.RegisterExpression("continue", () => new ContinueExpression(), "continue"); }
public static void Register() { NamedConstants.RegisterExpression("Pow", () => new PowFunction(), "Pow(base, exponent)"); }
public static void Register() { NamedConstants.RegisterExpression("this", () => new ThisConstant(), "This"); }
public static void Register() { NamedConstants.RegisterValue("pi", new DecimalValue(3.141592653589793238462643383279m)); NamedConstants.RegisterValue("e", new DecimalValue(2.71828182845904523536028747135266249m)); }
public static void Register() { NamedConstants.RegisterExpression("return", () => new ReturnFunctionExpression(), "return(val1, val2, ...)"); }
public static void Register() { NamedConstants.RegisterExpression("break", () => new BreakExpression(), "break"); }
public static void Register() { NamedConstants.RegisterExpression("ExecuteFile", () => new ExecuteFile(), "ExecuteFile(filename)"); }
public static void Register() { NamedConstants.RegisterExpression("Product", () => new ProductFunction(), "Product(x1, x2, ...)"); }
public static void Register() { NamedConstants.RegisterExpression("Help", () => new HelpFunction(), "Help([functionName/ValueName])"); }
public static void NamedConstantGroupMaskPopup(SerializedObject serializedObject, string label, string propertyName, NamedConstants constants, string groupName, Rect?position) { if (constants == null) { EditorGUILayout.LabelField(label, "<missing constants>"); return; } var property = serializedObject.FindProperty(propertyName); var values = constants.GetGroup(groupName); var labels = values.Select(x => x.Name).ToArray(); if (position == null) { property.intValue = EditorGUILayout.MaskField(label, property.intValue, labels); } else { property.intValue = EditorGUI.MaskField(position.Value, label, property.intValue, labels); } }
public static void Register() { NamedConstants.RegisterExpression("Abs", () => new AbsFunction(), "Abs(val)"); }