private void DrawElement(Rect rect, int index, bool isActive, bool isFocused) { plyVar plyVar = this.targetHandler.variables[index]; if (plyVar != null && plyVar.ValueHandler != null) { plyVarEd plyVarEd = plyVariablesEditor.editors[plyVar.ValueHandler.GetType()]; plyVarEd_Array.GC_Element.text = this.targetHandler.variables.Count.ToString(); float num = (float)(plyEdGUI.Styles.Label_RT.CalcSize(plyVarEd_Array.GC_Element).x + 5.0); Rect rect2 = rect; rect2.width = num; plyVarEd_Array.GC_Element.text = index.ToString(); GUI.Label(rect2, plyVarEd_Array.GC_Element, plyEdGUI.Styles.Label_RT); rect2.x = rect2.xMax; rect2.width = rect.width - num; EditorGUI.BeginChangeCheck(); plyVarEd.DrawEditor(rect2, this.isOnSceneObject, plyVar, this.targetVar, index); if (EditorGUI.EndChangeCheck()) { this.saveCallback(); } } }
public bool Initialize(Action onValueChangedCallback) { if (!Application.isEditor) { this.storedData = null; } if (this.dataContext == DataContext.Constant) { this.Value = this.constant.GetValue(); if (!Application.isEditor) { this.constant = null; } return(true); } if (this.dataContext == DataContext.GlobalProperty) { this.onValueChanged += onValueChangedCallback; this.property.onValueChanged += this.BoundValueChanged; return(true); } return(false); }
public override string VarTypeName(plyVar target) { return("Vector4"); }
public override bool DrawEditor(Rect rect, bool isOnSceneObject, plyVar target, plyVar objRefProxy, int objRefProxyIdx) { plyVar_Vector2 plyVar_Vector = (plyVar_Vector2)target.ValueHandler; plyVar_Vector.storedValue = EditorGUI.Vector2Field(rect, GUIContent.none, plyVar_Vector.storedValue); return(false); }
public override bool DrawEditor(Rect rect, bool isOnSceneObject, plyVar target, plyVar objRefProxy, int objRefProxyIdx) { plyVar_Float plyVar_Float = (plyVar_Float)target.ValueHandler; plyVar_Float.storedValue = EditorGUI.FloatField(rect, plyVar_Float.storedValue); return(false); }
public override string VarTypeName(plyVar target) { plyVar_Array plyVar_Array = (plyVar_Array)target.ValueHandler; return("Array<" + BloxEd.PrettyTypeName(plyVar_Array.baseType, false) + ">"); }
public override string VarTypeName(plyVar target) { return(target.variableType.Name); }
public plyVar RunAndGetVariable(Type expectedType = null) { if (this.varType == plyVariablesType.Event) { this.v = base.owningEvent.FindVariable(this.varName, expectedType); if (this.v == null) { if (base.owningBlock == null) { BloxBlock obj = base.paramBlocks[0]; expectedType = (((obj != null) ? obj.returnType : null) ?? typeof(object)); } else if (base.fieldIdx == -1) { expectedType = (base.owningBlock.ContextType() ?? typeof(object)); } else { Type[] array = base.owningBlock.ParamTypes(); expectedType = ((array == null || base.fieldIdx < 0 || base.fieldIdx >= array.Length) ? typeof(object) : (array[base.fieldIdx] ?? typeof(object))); } this.v = base.owningEvent.FindVariable(this.varName, expectedType); if (this.v == null) { base.LogError("The Event Variable [" + this.varName + "] does not exist in Event [" + base.owningEvent.screenName + "] on GameObject: " + base.owningEvent.container.name, null); return(null); } } } else if (this.varType != plyVariablesType.Blox) { if (this.varType == plyVariablesType.Object) { GameObject gameObject = null; object obj2 = (base.paramBlocks[1] == null) ? base.owningEvent.container.gameObject : base.paramBlocks[1].Run(); if (obj2 != null) { gameObject = (obj2 as GameObject); if ((UnityEngine.Object)gameObject == (UnityEngine.Object)null) { Component component = obj2 as Component; if ((UnityEngine.Object)component != (UnityEngine.Object)null) { gameObject = component.gameObject; } } } if ((UnityEngine.Object)gameObject != (UnityEngine.Object)null) { ObjectVariables component2 = gameObject.GetComponent <ObjectVariables>(); if ((UnityEngine.Object)component2 != (UnityEngine.Object)null) { this.v = component2.variables.FindVariable(this.varName); if (this.v == null) { base.LogError("The Object Variable [" + this.varName + "] does not exist on GameObject: " + gameObject.name, null); return(null); } goto IL_0265; } base.LogError("Could not find ObjectVariables component on GameObject [" + gameObject.name + "] for Object Variable: " + this.varName, null); return(null); } base.LogError("The 2nd field must be set to a target GameObject that has the Object Variable component on it with the variable named: " + this.varName, null); return(null); } if (this.varType != plyVariablesType.Global) { base.LogError("Invalid Variable Type specified. This should not happen.", null); return(null); } } goto IL_0265; IL_0265: return(this.v); }
public override bool DrawEditor(Rect rect, bool isOnSceneObject, plyVar target, plyVar objRefProxy, int objRefProxyIdx) { plyVar_Color32 plyVar_Color = (plyVar_Color32)target.ValueHandler; plyVar_Color.storedValue = EditorGUI.ColorField(rect, plyVar_Color.storedValue); return(false); }
public override string VarTypeName(plyVar target) { return("AnimationCurve"); }
public override string VarTypeName(plyVar target) { return("Prefab"); }
public virtual bool DrawEditor(Rect rect, bool isOnSceneObject, plyVar target, plyVar objRefProxy, int objRefProxyIdx) { return(false); }
public virtual bool DrawAdvancedEditor(plyVar target, bool isOnSceneObject, Action saveCallback) { return(false); }
public virtual bool DrawCreateWizard(plyVar target) { return(true); }
public virtual string VarTypeName(plyVar target) { return(""); }
public override string VarTypeName(plyVar target) { return("Integer"); }
public override bool DrawEditor(Rect rect, bool isOnSceneObject, plyVar target, plyVar objRefProxy, int objRefProxyIdx) { plyVar_Bool plyVar_Bool = (plyVar_Bool)target.ValueHandler; plyVar_Bool.storedValue = EditorGUI.ToggleLeft(rect, plyVar_Bool.storedValue ? plyVarEd_Bool.GC_True : plyVarEd_Bool.GC_False, plyVar_Bool.storedValue); return(false); }
public override string VarTypeName(plyVar target) { return("Boolean"); }
public override bool DrawEditor(Rect rect, bool isOnSceneObject, plyVar target, plyVar objRefProxy, int objRefProxyIdx) { plyVar_AnimationCurve plyVar_AnimationCurve = (plyVar_AnimationCurve)target.ValueHandler; plyVar_AnimationCurve.storedValue = EditorGUI.CurveField(rect, plyVar_AnimationCurve.storedValue); return(false); }
public override bool DrawEditor(Rect rect, bool isOnSceneObject, plyVar target, plyVar objRefProxy, int objRefProxyIdx) { plyVar_Vector4 plyVar_Vector = (plyVar_Vector4)target.ValueHandler; plyVar_Vector.storedValue = plyEdGUI.Vector4Field(rect, plyVar_Vector.storedValue); return(false); }
protected override object RunBlock() { int num = 0; int num2 = 0; try { if (base.paramBlocks[1] != null) { num = (int)base.paramBlocks[1].Run(); } if (base.paramBlocks[2] != null) { num2 = (int)base.paramBlocks[2].Run(); } } catch (InvalidCastException) { base.LogError("An Integer was expected in [from] and [while less].", null); return(null); } catch (Exception ex2) { base.LogError(ex2.Message, null); return(null); } if (num > num2) { base.LogError("The start value should be smaller than the end value", null); return(null); } plyVar plyVar = null; try { if (base.paramBlocks[0] != null) { plyVar = ((Variable_Block)base.paramBlocks[0]).RunAndGetVariable(typeof(int)); if (plyVar != null && plyVar.ValueHandler != null && plyVar.variableType == typeof(int)) { goto end_IL_0081; } base.LogError("The Variable used in [with] must be of Integer type.", null); return(null); } end_IL_0081 :; } catch (InvalidCastException) { base.LogError("A Variable was expected in [with].", null); return(null); } catch (Exception ex4) { base.LogError(ex4.Message, null); return(null); } int num3 = 0; int num4 = num; while (num4 != num2) { if (plyVar != null) { plyVar.SetValue(num4); } base.RunChildBlocks(); if (base.flowSig == BloxFlowSignal.Break) { base.flowSig = BloxFlowSignal.None; break; } if (base.flowSig == BloxFlowSignal.Stop) { break; } if (base.flowSig == BloxFlowSignal.Continue) { base.flowSig = BloxFlowSignal.None; } num4++; num3++; if (num3 >= BloxGlobal.Instance.deadlockDetect) { Debug.LogErrorFormat(base.owningEvent.container.gameObject, "Deadlock detected in Loop in Event [{0}:{1}]. Forcing break.", base.owningEvent.container.gameObject.name, base.owningEvent.screenName); base.flowSig = BloxFlowSignal.Break; break; } } return(null); }
public void VariableWasAdded() { this.advVar = null; this.advEd = null; }
public override string VarTypeName(plyVar target) { return("Color32"); }
public override string VarTypeName(plyVar target) { return("GameObject"); }
public override bool DrawEditor(Rect rect, bool isOnSceneObject, plyVar target, plyVar objRefProxy, int objRefProxyIdx) { plyVar_Array plyVar_Array = (plyVar_Array)target.ValueHandler; this.targetVar = target; this.targetHandler = plyVar_Array; this.isOnSceneObject = isOnSceneObject; bool result = false; plyVarEd_Array.GC_Button.text = "[" + plyVar_Array.variables.Count + "] click to edit array"; if (GUI.Button(rect, plyVarEd_Array.GC_Button, GUI.skin.label)) { result = true; plyVarEd_Array.GC_Head.text = "Array: <b>" + target.name + "</b>"; } return(result); }
public override bool DrawEditor(Rect rect, bool isOnSceneObject, plyVar target, plyVar objRefProxy, int objRefProxyIdx) { GUI.Label(rect, "Can't edit this variable type"); return(false); }
public override CodeExpression CreateBlockCodeExpression(BloxBlockEd bdi) { Variable_Block variable_Block = (Variable_Block)bdi.b; plyVar plyVar = null; if (!this.UpdateBlockReturnType(bdi, ref plyVar)) { Debug.LogErrorFormat("The [{0}] variable [{1}] is not defined.", variable_Block.varType, variable_Block.varName); return(null); } if (variable_Block.varType == plyVariablesType.Event) { if (BloxScriptGenerator.processingEvent.def.pars.Length != 0) { BloxEventDef.Param[] pars = BloxScriptGenerator.processingEvent.def.pars; for (int i = 0; i < pars.Length; i++) { BloxEventDef.Param param = pars[i]; if (param.name == variable_Block.varName) { bdi.sgReturnType = param.type; return(new CodeVariableReferenceExpression(variable_Block.varName)); } } } string cleanEventVariableName = BloxScriptGenerator.GetCleanEventVariableName(variable_Block.varName, false); if (BloxScriptGenerator.processingEvent.ev.ident == "Custom" && cleanEventVariableName.StartsWith("param") && cleanEventVariableName.Length > 5) { int argIdx = -1; if (int.TryParse(cleanEventVariableName.Substring(5), out argIdx)) { Type type = (bdi.fieldIdx == -1) ? bdi.owningBlock.def.contextType : bdi.owningBlock.ParameterTypes()[bdi.fieldIdx]; if (type == null) { type = typeof(object); } BloxScriptGenerator.AddEventVariable(cleanEventVariableName, type, null, argIdx, false); } } else { Type type2 = (bdi.fieldIdx == -1) ? bdi.owningBlock.def.contextType : bdi.owningBlock.ParameterTypes()[bdi.fieldIdx]; if (type2 == null) { type2 = typeof(object); } BloxScriptGenerator.AddEventVariable(cleanEventVariableName, type2, null, -1, false); } Type eventVariableType = BloxScriptGenerator.GetEventVariableType(cleanEventVariableName); if (eventVariableType != null) { bdi.sgReturnType = eventVariableType; } return(new CodeVariableReferenceExpression(cleanEventVariableName)); } if (variable_Block.varType == plyVariablesType.Blox) { CodeExpression targetObject = new CodeVariableReferenceExpression(BloxScriptGenerator.GetCleanBloxVariableName(variable_Block.varName)); Type type3 = (bdi.fieldIdx == -1) ? bdi.owningBlock.def.contextType : bdi.owningBlock.ParameterTypes()[bdi.fieldIdx]; if (type3 != null) { plyVarValueHandler valueHandler = plyVar.ValueHandler; Type type4 = (valueHandler != null) ? valueHandler.GetType() : null; if (type4 == typeof(plyVar_GameObject) || type4 == typeof(plyVar_Component)) { if (typeof(GameObject).IsAssignableFrom(type3)) { bdi.sgReturnType = type3; return(new CodeMethodInvokeExpression(targetObject, "GetGameObject")); } if (typeof(Component).IsAssignableFrom(type3)) { bdi.sgReturnType = type3; return(new CodeMethodInvokeExpression(new CodeMethodReferenceExpression(targetObject, "GetComponent", new CodeTypeReference(type3)))); } } else if (plyVar.ValueHandler.GetType() == typeof(plyVar_UnityObject)) { bdi.sgReturnType = type3; return(new CodeMethodInvokeExpression(new CodeMethodReferenceExpression(targetObject, "GetObject", new CodeTypeReference(type3)))); } } return(new CodeMethodInvokeExpression(targetObject, "GetValue")); } if (variable_Block.varType == plyVariablesType.Object) { CodeExpression targetObject2 = BloxScriptGenerator.CreateBlockCodeExpression(bdi.paramBlocks[1], null) ?? new CodePropertyReferenceExpression(new CodeThisReferenceExpression(), "gameObject"); targetObject2 = new CodeMethodInvokeExpression(new CodeMethodReferenceExpression(targetObject2, "GetComponent", new CodeTypeReference(typeof(ObjectVariables)))); Type type5 = (bdi.fieldIdx == -1) ? bdi.owningBlock.def.contextType : bdi.owningBlock.ParameterTypes()[bdi.fieldIdx]; if (type5 != null) { if (typeof(GameObject).IsAssignableFrom(type5)) { bdi.sgReturnType = type5; return(new CodeMethodInvokeExpression(targetObject2, "GetGameObjectVarValue", new CodePrimitiveExpression(variable_Block.varName))); } if (typeof(Component).IsAssignableFrom(type5)) { bdi.sgReturnType = type5; return(new CodeMethodInvokeExpression(new CodeMethodReferenceExpression(targetObject2, "GetComponentVarValue", new CodeTypeReference(type5)), new CodePrimitiveExpression(variable_Block.varName))); } if (typeof(UnityEngine.Object).IsAssignableFrom(type5)) { bdi.sgReturnType = type5; return(new CodeMethodInvokeExpression(new CodeMethodReferenceExpression(targetObject2, "GetUnityObjectVarValue", new CodeTypeReference(type5)), new CodePrimitiveExpression(variable_Block.varName))); } } return(new CodeMethodInvokeExpression(targetObject2, "GetVarValue", new CodePrimitiveExpression(variable_Block.varName))); } if (variable_Block.varType == plyVariablesType.Global) { CodeExpression targetObject3 = new CodeVariableReferenceExpression(BloxScriptGenerator.GetCleanGlobalVariableName(variable_Block.varName)); Type type6 = (bdi.fieldIdx == -1) ? bdi.owningBlock.def.contextType : bdi.owningBlock.ParameterTypes()[bdi.fieldIdx]; if (type6 != null) { plyVarValueHandler valueHandler2 = plyVar.ValueHandler; Type type7 = (valueHandler2 != null) ? valueHandler2.GetType() : null; if (type7 == typeof(plyVar_GameObject) || type7 == typeof(plyVar_Component)) { if (typeof(GameObject).IsAssignableFrom(type6)) { bdi.sgReturnType = type6; return(new CodeMethodInvokeExpression(targetObject3, "GetGameObject")); } if (typeof(Component).IsAssignableFrom(type6)) { bdi.sgReturnType = type6; return(new CodeMethodInvokeExpression(new CodeMethodReferenceExpression(targetObject3, "GetComponent", new CodeTypeReference(type6)))); } } else if (plyVar.ValueHandler.GetType() == typeof(plyVar_UnityObject)) { bdi.sgReturnType = type6; return(new CodeMethodInvokeExpression(new CodeMethodReferenceExpression(targetObject3, "GetObject", new CodeTypeReference(type6)))); } } return(new CodeMethodInvokeExpression(targetObject3, "GetValue")); } return(null); }
public override string VarTypeName(plyVar target) { return("Float"); }
public override bool DrawEditor(Rect rect, bool isOnSceneObject, plyVar target, plyVar objRefProxy, int objRefProxyIdx) { if (target == objRefProxy && (target.objRefs == null || target.objRefs.Length == 0)) { target.objRefs = new UnityEngine.Object[1]; } objRefProxy.objRefs[objRefProxyIdx] = EditorGUI.ObjectField(rect, objRefProxy.objRefs[objRefProxyIdx], target.variableType, isOnSceneObject); return(false); }
public override bool DrawEditor(Rect rect, bool isOnSceneObject, plyVar target, plyVar objRefProxy, int objRefProxyIdx) { plyVar_Gradient plyVar_Gradient = (plyVar_Gradient)target.ValueHandler; plyEdUtil.DrawGradientField(rect, plyVar_Gradient.storedValue); return(false); }