Example #1
0
    public List <UnityEngine.ParticleSystem.MinMaxCurve> getThreeDCurve(bool changYZ = true)
    {
        var ret = new List <UnityEngine.ParticleSystem.MinMaxCurve>();
        List <List <CurveAnchor> > tmp = new List <List <CurveAnchor> > {
            anchorsX, anchorsY, anchorsZ
        };

        for (int i = 0; i < tmp.Count; ++i)
        {
            ret.Add(new UnityEngine.ParticleSystem.MinMaxCurve(maxXYZ[i], ValueTypeUtil.GenerateAnimationCurve(tmp[i])));
        }
        return(ret);
    }
Example #2
0
 public UnityEngine.ParticleSystem.MinMaxCurve getNegativeCurve(ValueTypeUtil.CurveType flag = ValueTypeUtil.CurveType.Normal, float scale = 1.0f)
 {
     UnityEngine.ParticleSystem.MinMaxCurve ret;
     if (flag == ValueTypeUtil.CurveType.Rotation)
     {
         ret = new UnityEngine.ParticleSystem.MinMaxCurve(maxCurveAnchorValue, ValueTypeUtil.GenerateAnimationCurve(anchors, true, UnityEngine.Mathf.PI / 180.0f * scale));
     }
     else
     {
         ret = new UnityEngine.ParticleSystem.MinMaxCurve(maxCurveAnchorValue, ValueTypeUtil.GenerateAnimationCurve(anchors, true, scale));
     }
     return(ret);
 }
        public override bool OnExportPhpScriptCode(ActionBranch previousAction, ActionBranch nextAction, StringCollection jsCode, StringCollection methodCode, JsMethodCompiler data)
        {
            string indexName = RepeatIndex.CodeName;

            methodCode.Add(Indentation.GetIndent());
            methodCode.Add("for(");
            methodCode.Add(indexName);
            methodCode.Add("=0;");
            methodCode.Add(indexName);
            methodCode.Add("<");
            methodCode.Add(RepeatCount.CreateJavaScript(methodCode));
            methodCode.Add(";");
            methodCode.Add(indexName);
            methodCode.Add("++) {\r\n");
            Indentation.IndentIncrease();
            string           indents = Indentation.GetIndent();
            StringCollection sc      = new StringCollection();

            if (_iconList != null)
            {
                foreach (ComponentIcon ci in _iconList)
                {
                    ComponentIconLocal cil = ci as ComponentIconLocal;
                    if (cil != null && cil.ScopeGroupId == this.BranchId)
                    {
                        sc.Add(indents);
                        sc.Add("$");
                        sc.Add(cil.LocalPointer.CodeName);
                        sc.Add("=");
                        sc.Add(ValueTypeUtil.GetDefaultPhpScriptValueByType(cil.LocalPointer.BaseClassType));
                        sc.Add(";\r\n");
                    }
                }
            }
            SetWithinLoop();
            Method.SubMethod.Push(this);
            data.AddSubMethod(this);
            bool bRet = base.OnExportPhpScriptCode(previousAction, nextAction, jsCode, sc, data);

            Method.SubMethod.Pop();
            //
            for (int i = 0; i < sc.Count; i++)
            {
                methodCode.Add(sc[i]);
            }
            Indentation.IndentDecrease();
            methodCode.Add(Indentation.GetIndent());
            methodCode.Add("}\r\n");
            return(bRet);
        }
Example #4
0
    public void deserialize(JObject data)
    {
        int count = (int)data["anchorCount"];

        curveType = (string)data["anchorType"];

        for (int i = 0; i < count; i++)
        {
            var value = ((string)data["anchor_" + i]).Split(',');
            maxCurveAnchorValue = UnityEngine.Mathf.Max(maxCurveAnchorValue, float.Parse(value[1]));
            anchors.Add(new CurveAnchor(float.Parse(value[0]), float.Parse(value[1])));
        }

        ValueTypeUtil.NormalizeCurveAnchor(anchors, maxCurveAnchorValue);
    }
Example #5
0
    public static UnityEngine.Gradient GenerateConstGradient(uint[] colors, float[] colorRatios)
    {
        var gradient = new UnityEngine.Gradient();

        gradient.mode = UnityEngine.GradientMode.Blend;
        UnityEngine.GradientColorKey[] gck = new UnityEngine.GradientColorKey[colors.Length];
        UnityEngine.GradientAlphaKey[] gak = new UnityEngine.GradientAlphaKey[colors.Length];
        for (int i = 0; i < colors.Length; ++i)
        {
            gck[i].time  = colorRatios[i];
            gck[i].color = ValueTypeUtil.GetColor(colors[i]);
            gak[i].time  = colorRatios[i];
            gak[i].alpha = 1.0f;
        }
        gradient.SetKeys(gck, gak);
        return(gradient);
    }
        public virtual CodeExpression ReturnCodeExpression(IMethodCompile method)
        {
            string s      = method.GetParameterCodeNameById(this.ID);
            bool   bFound = !string.IsNullOrEmpty(s);

            if (bFound)
            {
                if (_code != null)
                {
                    return(_code);
                }
                _actualCompiledType = null;
                return(new CodeArgumentReferenceExpression(Variable.CodeVariableName));
            }
            else
            {
                _actualCompiledType = new RaisDataType(this.DataType.Type);
                return(ValueTypeUtil.GetDefaultCodeByType(this.DataType.Type));
            }
        }
Example #7
0
    public void ApplyToUnityParticleSystem(UnityEngine.ParticleSystem ups, ParticleSystem ps)
    {
        var colorModule = ups.colorOverLifetime;

        var gradient = new UnityEngine.Gradient();

        gradient.mode = UnityEngine.GradientMode.Blend;
        UnityEngine.GradientColorKey[] gck;

        if (justAlpha)
        {
            gck          = new UnityEngine.GradientColorKey[2];
            gck[0].time  = 0.0f;
            gck[0].color = ps.Emitter.color.getValue(gck[0].time);
            gck[1].time  = 1.0f;
            gck[1].color = ps.Emitter.color.getValue(gck[1].time);
        }
        else
        {
            gck = new UnityEngine.GradientColorKey[colors.Count];

            for (int i = 0; i < colors.Count; ++i)
            {
                gck[i].time  = colorRatios[i] / 255.0f;
                gck[i].color = ValueTypeUtil.GetColor(colors[i]);
            }
        }

        UnityEngine.GradientAlphaKey[] gak = new UnityEngine.GradientAlphaKey[alphaRatios.Count];

        for (int i = 0; i < alphaRatios.Count; ++i)
        {
            gak[i].time  = alphaRatios[i] / 255.0f;
            gak[i].alpha = alphas[i];
        }

        gradient.SetKeys(gck, gak);
        colorModule.enabled = true;
        colorModule.color   = new UnityEngine.ParticleSystem.MinMaxGradient(gradient);
    }
Example #8
0
    public void deserialize(JObject data)
    {
        int count = (int)data["anchorXCount"];

        curveTypeX = (string)data["anchorXType"];

        for (int i = 0; i < count; i++)
        {
            var value = ((string)data["anchorX" + i]).Split(',');
            anchorsX.Add(new CurveAnchor(float.Parse(value[0]), float.Parse(value[1])));
            maxXYZ[0] = UnityEngine.Mathf.Max(maxXYZ[0], float.Parse(value[1]));
        }

        ValueTypeUtil.NormalizeCurveAnchor(anchorsX, maxXYZ[0]);

        count      = (int)data["anchorYCount"];
        curveTypeY = (string)data["anchorYType"];

        for (int i = 0; i < count; i++)
        {
            var value = ((string)data["anchorY" + i]).Split(',');
            anchorsY.Add(new CurveAnchor(float.Parse(value[0]), float.Parse(value[1])));
            maxXYZ[1] = UnityEngine.Mathf.Max(maxXYZ[1], float.Parse(value[1]));
        }

        ValueTypeUtil.NormalizeCurveAnchor(anchorsY, maxXYZ[1]);

        count      = (int)data["anchorZCount"];
        curveTypeZ = (string)data["anchorZType"];

        for (int i = 0; i < count; i++)
        {
            var value = ((string)data["anchorZ" + i]).Split(',');
            anchorsZ.Add(new CurveAnchor(float.Parse(value[0]), float.Parse(value[1])));
            maxXYZ[2] = UnityEngine.Mathf.Max(maxXYZ[2], float.Parse(value[1]));
        }

        ValueTypeUtil.NormalizeCurveAnchor(anchorsZ, maxXYZ[2]);
    }
        public override CodeExpression ExportCode(MethodType method)
        {
            CodeStatementCollection supprtStatements = method.MethodCode.Statements;

            if (!MathNodeVariable.VariableDeclared(supprtStatements, this.CodeVariableName))
            {
                MathNode.Trace("Declare variable {0}", this.TraceInfo);
                supprtStatements.Add(new CodeVariableDeclarationStatement(new CodeTypeReference(VariableType.ObjectType), CodeVariableName, ValueTypeUtil.GetDefaultCodeByType(VariableType.ObjectType)));
            }
            MathNode.Trace("MathNodeVar.ExportCode returns variable reference to {0}", this.CodeVariableName);
            return(new CodeVariableReferenceExpression(this.CodeVariableName));
        }
Example #10
0
        public bool ExportPhpScriptCode(StringCollection jsCode, StringCollection methodCode, JsMethodCompiler data)
        {
            bool bRet = false;

            MathNode.Trace("BranchList.ExportPhpScriptCode. Method {0}, action blocks {1}================", _method.Name, this.Count);
            //create code threads
            List <ActionBranch> independentThreads;

            if (_independentThreads == null)
            {
                independentThreads = FindoutActionThreads(true);
            }
            else
            {
                independentThreads = _independentThreads;
            }
            IsMultiThreads = (independentThreads.Count > 1);
            //the case of Count == 0 (empty method) is handled by MethodClass.ExportCode
            if (independentThreads.Count > 0)
            {
                int k0 = 0;                // main thread index
                this.ActionThreads.Clear();
                foreach (ActionBranch a in independentThreads)
                {
                    _threads.Add(a.BranchId, a);
                }
                for (int k = 0; k < independentThreads.Count; k++)
                {
                    if (independentThreads[k].IsMainThread)
                    {
                        k0 = k;
                        break;
                    }
                }
                if (k0 == 0)
                {
                    independentThreads[0].IsMainThread = true;
                }
                this.MainThreadId = independentThreads[k0].BranchId;
                List <UInt32> usedBranches = new List <uint>();
                for (int k = 0; k < independentThreads.Count; k++)
                {
                    independentThreads[k].IsMainThread = (k == k0);
                    independentThreads[k].SetIsMainThreadForSubBranches(usedBranches);
                }
                //javascript does not support threading
                for (int k = 0; k < independentThreads.Count; k++)
                {
                    if (k != k0)
                    {
                        ActionBranch ab = independentThreads[k];
                        ab.IsMainThread = false;
                        ////method contents: a single thread
                        ab.ExportPhpScriptCode(null, null, jsCode, methodCode, data);
                    }
                }
                //main thread code
                bRet = independentThreads[k0].ExportPhpScriptCode(null, null, jsCode, methodCode, data);
                //
                if (_method == null)
                {
                    MathNode.LogError("method is null");
                }
                else                 //
                {
                    if (_method.ReturnValue != null)
                    {
                        if (!typeof(void).Equals(_method.ReturnValue.ObjectType))
                        {
                            //check whether all branches ends with a method return statement
                            if (!independentThreads[k0].AllBranchesEndWithMethodReturnStatement())
                            {
                                methodCode.Add("return ");
                                methodCode.Add(ValueTypeUtil.GetDefaultPhpScriptValueByType(_method.ReturnValue.ObjectType));
                                methodCode.Add(";\r\n");
                            }
                        }
                    }
                }
            }
            MathNode.Trace("End of BranchList.ExportPhpScriptCode. Method {0}================", _method.Name);
            return(bRet);
        }
Example #11
0
        public void Execute(List <ParameterClass> eventParameters)
        {
            MethodPointer mp  = (MethodPointer)ActionMethod;
            MethodBase    mif = mp.MethodDef;

            ParameterInfo[] pifs = mp.Info;
            object[]        vs   = new object[mp.ParameterCount];
            if (_parameterValues == null)
            {
                _parameterValues = new ParameterValueCollection();
            }
            mp.ValidateParameterValues(_parameterValues);
            for (int k = 0; k < mp.ParameterCount; k++)
            {
                vs[k] = null;
                IEventParameter iep = _parameterValues[k].AsEventParameter();
                if (iep != null)
                {
                    if (eventParameters != null)
                    {
                        foreach (ParameterClass p in eventParameters)
                        {
                            if (iep.IsSameParameter(p))
                            {
                                vs[k] = p.ObjectInstance;
                                break;
                            }
                        }
                    }
                }
                else
                {
                    vs[k] = _parameterValues[k].ObjectInstance;
                }
                if (vs[k] != null)
                {
                    if (!pifs[k].ParameterType.Equals(vs[k].GetType()))
                    {
                        vs[k] = ValueTypeUtil.ConvertValueByType(pifs[k].ParameterType, vs[k]);
                    }
                }
            }
            object ret;

            if (mif.IsStatic)
            {
                ret = mif.Invoke(null, vs);
            }
            else
            {
                ret = mif.Invoke(mp.ObjectInstance, vs);
            }
            MethodInfo minfo = mif as MethodInfo;

            if (minfo != null)
            {
                if (!typeof(void).Equals(minfo.ReturnType))
                {
                    ReturnValue = ret;
                }
            }
        }
Example #12
0
 public UnityEngine.ParticleSystem.MinMaxGradient getGradient()
 {
     return(new UnityEngine.ParticleSystem.MinMaxGradient(ValueTypeUtil.GetColor(color0), ValueTypeUtil.GetColor(color1)));
 }
 public UnityEngine.ParticleSystem.MinMaxGradient getGradient()
 {
     return(new UnityEngine.ParticleSystem.MinMaxGradient(ValueTypeUtil.GenerateConstGradient(colors.ToArray(), colorRatios.ToArray())));
 }
        public override bool OnExportPhpScriptCode(ActionBranch previousAction, ActionBranch nextAction, StringCollection jsCode, StringCollection methodCode, JsMethodCompiler data)
        {
            string c;

            if (_logicExpression == null)
            {
                c = "true";
            }
            else
            {
                _logicExpression.PrepareForCompile(this.Method);
                c = _logicExpression.CreatePhpScript(methodCode);
            }
            methodCode.Add(Indentation.GetIndent());
            string initCodeStr  = null;
            string increCodeStr = null;

            if (_initAction != null && _initAction.Action != null)
            {
                StringCollection initCode = new StringCollection();
                _initAction.Action.ExportPhpScriptCode(null, null, methodCode, initCode, data);
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < initCode.Count; i++)
                {
                    sb.Append(initCode[i]);
                }
                initCodeStr = sb.ToString().Replace("\r\n", "");
            }
            if (_increAction != null && _increAction.Action != null)
            {
                StringCollection increCode = new StringCollection();
                _increAction.Action.ExportPhpScriptCode(null, null, methodCode, increCode, data);
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < increCode.Count; i++)
                {
                    sb.Append(increCode[i]);
                }
                increCodeStr = sb.ToString().Replace("\r\n", "");
            }
            if (string.IsNullOrEmpty(initCodeStr))
            {
                initCodeStr = ";";
            }
            if (!string.IsNullOrEmpty(increCodeStr))
            {
                increCodeStr = increCodeStr.Trim();
                while (increCodeStr.EndsWith(";", StringComparison.Ordinal))
                {
                    increCodeStr = increCodeStr.Substring(0, increCodeStr.Length - 1);
                    increCodeStr = increCodeStr.Trim();
                }
            }
            methodCode.Add("for(");
            methodCode.Add(initCodeStr);
            methodCode.Add(c);
            methodCode.Add(";");
            methodCode.Add(increCodeStr);
            methodCode.Add(") {\r\n");
            Indentation.IndentIncrease();
            string           indents = Indentation.GetIndent();
            StringCollection sc      = new StringCollection();

            if (_iconList != null)
            {
                foreach (ComponentIcon ci in _iconList)
                {
                    ComponentIconLocal cil = ci as ComponentIconLocal;
                    if (cil != null && cil.ScopeGroupId == this.BranchId)
                    {
                        sc.Add(indents);
                        sc.Add("$");
                        sc.Add(cil.LocalPointer.CodeName);
                        sc.Add("=");
                        sc.Add(ValueTypeUtil.GetDefaultPhpScriptValueByType(cil.LocalPointer.BaseClassType));
                        sc.Add(";\r\n");
                    }
                }
            }
            Method.SubMethod.Push(this);
            data.AddSubMethod(this);
            bool bRet = base.OnExportPhpScriptCode(previousAction, nextAction, jsCode, sc, data);

            Method.SubMethod.Pop();
            //
            for (int i = 0; i < sc.Count; i++)
            {
                methodCode.Add(sc[i]);
            }
            Indentation.IndentDecrease();
            methodCode.Add(Indentation.GetIndent());
            methodCode.Add("}\r\n");
            return(bRet);
        }
Example #15
0
 protected internal virtual ValueType type()
 {
     return(ValueTypeUtil.get(this.head()));
 }
        static CodeExpression CastOrConvert(CodeExpression code, Type sourceType, Type targetType, CodeStatementCollection csc)
        {
            if (sourceType.Equals(targetType))
            {
                MathNode.Trace("CastOrConvert 1: same type: {0}", targetType);
                return(code);
            }
            if (targetType.IsByRef)
            {
                MathNode.Trace("CastOrConvert 2: by ref type: {0}", targetType);
                return(code);
            }
            if (targetType.Equals(typeof(string)))
            {
                MathNode.Trace("CastOrConvert 3: to string from: {0}", sourceType);
                return(new CodeMethodInvokeExpression(code, "ToString", new CodeExpression[] { }));
            }
            TypeCode tcTarget = Type.GetTypeCode(targetType);
            TypeCode tcSource = Type.GetTypeCode(sourceType);

            if (IsNumeric(tcTarget))
            {
                if (IsNumeric(tcSource))
                {
                    return(new CodeCastExpression(targetType, VPLUtil.GetCoreExpressionFromCast(code)));
                }
                else
                {
                    if (tcSource == TypeCode.String)
                    {
                        return(new CodeMethodInvokeExpression(new CodeTypeReferenceExpression(typeof(Convert)), GetConverToName(tcTarget), code));
                    }
                }
            }
            switch (tcTarget)
            {
            case TypeCode.Boolean:
                if (IsNumeric(tcSource) || tcSource == TypeCode.Char)
                {
                    return(new CodeBinaryOperatorExpression(code, CodeBinaryOperatorType.IdentityInequality, new CodeCastExpression(sourceType, new CodePrimitiveExpression(0))));
                }
                switch (tcSource)
                {
                case TypeCode.Boolean:
                    return(code);

                case TypeCode.DateTime:
                    return(new CodeBinaryOperatorExpression(code, CodeBinaryOperatorType.GreaterThan, new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(typeof(DateTime)), "MinValue")));

                case TypeCode.Object:
                    return(new CodeBinaryOperatorExpression(code, CodeBinaryOperatorType.IdentityInequality, new CodePrimitiveExpression(null)));
                }
                break;

            case TypeCode.String:
                return(new CodeMethodInvokeExpression(code, "ToString"));

            case TypeCode.Char:
                if (code is CodePrimitiveExpression)
                {
                    CodePrimitiveExpression cp = (CodePrimitiveExpression)code;
                    if (cp.Value == null)
                    {
                        return(new CodePrimitiveExpression('\0'));
                    }
                    if (ValueTypeUtil.IsNumber(cp.Value.GetType()))
                    {
                        short v = Convert.ToInt16(cp.Value);
                        return(new CodePrimitiveExpression((char)v));
                    }
                    string s = cp.Value.ToString();
                    if (string.IsNullOrEmpty(s))
                    {
                        return(new CodePrimitiveExpression('\0'));
                    }
                    else
                    {
                        return(new CodePrimitiveExpression(s[0]));
                    }
                }
                return(new CodeMethodInvokeExpression(new CodeTypeReferenceExpression(typeof(Convert)), "ToChar", code));

            case TypeCode.DateTime:
                return(new CodeMethodInvokeExpression(new CodeTypeReferenceExpression(typeof(Convert)), "ToDateTime", code));
            }
            if (sourceType.IsSubclassOf(targetType))
            {
                return(code);
            }
            if (targetType.IsSubclassOf(sourceType))
            {
                return(new CodeCastExpression(targetType, code));
            }
            return(CodeExpConvertTo(code, sourceType, targetType, csc));
        }
Example #17
0
 internal virtual ValueType Type()
 {
     return(ValueTypeUtil.Get(this.Head));
 }
Example #18
0
        public ConvertExceptionInfo DetectionFourLine(string[] comments, string[] types, string[] clientFields)
        {
            if (comments.Length < 2 || types.Length < 2 || clientFields.Length < 2)
            {
                return(ConvertExceptionInfo.Warn(string.Format("{0}-({1}),格式不正确,忽略该分页!", _excelName, _sheetName)));
            }

            if (!IsType("TYPE", types))
            {
                return(ConvertExceptionInfo.Warn(ContentInfo("第二行第一列应为TYPE,忽略该分页! " + _defLength)));
            }

            if (!IsType("CLIENT", clientFields))
            {
                return(ConvertExceptionInfo.Warn(ContentInfo("第三行第一列应为CLIENT,忽略该分页!")));
            }


            //  客户端类型
            _sheetClientDefs.Clear();
            int defLength = 0;

            for (int i = 0; i < clientFields.Length; i++)
            {
                var field = clientFields[i];
                // var str = field == null ? "" : field.ToString();
                if (i == 0 || string.IsNullOrEmpty(field))
                {
                    continue;
                }


                string typeStr = string.Empty;
                if (i < types.Length)
                {
                    typeStr = types[i];
                }
                else
                {
                    SystemUtil.Abend(string.Format("{0}-({1})-({2},{3}), [{4}]字段,没有填写类型!",
                                                   _excelName,
                                                   _sheetName,
                                                   3,
                                                   i + 1,
                                                   field));
                }

                var valueType = ValueTypeUtil.String2ValueType(typeStr);
                if (valueType == ValueType.None)
                {
                    SystemUtil.Abend(string.Format("{0}-({1})-({2},{3}), 类型不存在! {4}",
                                                   _excelName,
                                                   _sheetName,
                                                   2,
                                                   i + 1,
                                                   valueType));
                }

                ClientDef def = new ClientDef();
                def.Field     = field;
                def.ValueType = valueType;

                //  主键类型缓存
                if (i == 1)
                {
                    _mainKeyDef.Field     = def.Field;
                    _mainKeyDef.ValueType = def.ValueType;
                }

                _sheetClientDefs.Add(i, def);
                ++defLength;
            }

            if (defLength < 1)
            {
                return(ConvertExceptionInfo.Warn(ContentInfo("该分页没有定义客户端字段,忽略该分页!")));
            }
            // else if (_defLength != -1 && _defLength != defLength)
            // {
            //     SystemUtil.Abend (ContentInfo (string.Format("分页之间,客户端字段数量不匹配! {0} : {1}", _defLength, defLength)));
            // }

            if (_defLength == -1)
            {
                _defLength = defLength;
            }
            return(null);
        }
 public UnityEngine.ParticleSystem.MinMaxGradient getGradient()
 {
     return(new UnityEngine.ParticleSystem.MinMaxGradient(ValueTypeUtil.GenerateConstGradient(new uint[] { color0, color0 }, new float[] { 0.0f, 1.0f }), ValueTypeUtil.GenerateConstGradient(new uint[] { color1, color1 }, new float[] { 0.0f, 1.0f })));
 }
Example #20
0
        public static object CreateObject(Type type)
        {
            if (type.IsValueType)
            {
                if (type.Equals(typeof(void)))
                {
                    return(Activator.CreateInstance(typeof(object)));
                }
                else
                {
                    return(Activator.CreateInstance(type));
                }
            }
            object v0 = null;
            bool   bFound;
            LinkedListNode <System.Reflection.ConstructorInfo> node;
            LinkedList <System.Reflection.ConstructorInfo>     constructors = new LinkedList <System.Reflection.ConstructorInfo>();

            System.Reflection.ConstructorInfo[] cis = type.GetConstructors();
            for (int i = 0; i < cis.Length; i++)
            {
                int n = 0;
                System.Reflection.ParameterInfo[] pis = cis[i].GetParameters();
                if (pis != null)
                {
                    n = pis.Length;
                }
                if (constructors.Count == 0)
                {
                    constructors.AddFirst(cis[i]);
                }
                else
                {
                    bFound = false;
                    node   = constructors.First;
                    while (node != null)
                    {
                        System.Reflection.ParameterInfo[] pis0 = node.Value.GetParameters();
                        if (pis0.Length >= n)
                        {
                            bFound = true;
                            constructors.AddBefore(node, cis[i]);
                            break;
                        }
                        node = node.Next;
                    }
                    if (!bFound)
                    {
                        constructors.AddLast(cis[i]);
                    }
                }
            }
            bFound = false;
            node   = constructors.First;
            while (node != null)
            {
                System.Reflection.ParameterInfo[] pis0 = node.Value.GetParameters();
                try
                {
                    if (pis0.Length == 0)
                    {
                        v0 = node.Value.Invoke(null);
                    }
                    else
                    {
                        object[] vs = new object[pis0.Length];
                        for (int i = 0; i < pis0.Length; i++)
                        {
                            vs[i] = ValueTypeUtil.GetDefaultValue(pis0[i].ParameterType);
                        }
                        v0 = node.Value.Invoke(vs);
                    }
                    bFound = true;
                    break;
                }
                catch
                {
                }
                node = node.Next;
            }
            if (!bFound)
            {
                //throw new RAISException(string.Format("The .Net Type {0} does not have a constructor we can use", type));
            }
            return(v0);
        }
        public override bool OnExportJavaScriptCode(ActionBranch previousAction, ActionBranch nextAction, StringCollection jsCode, StringCollection methodCode, JsMethodCompiler data)
        {
            bool bRet;

            if (_actionData == null)
            {
                _actionData = (ActionSubMethod)this.Method.GetActionInstance(_actId.ActionId);                // (ActionSubMethod)compiler.ActionEventList.GetAction(_actId);
            }
            if (_actionData == null)
            {
                return(false);
            }
            SubMethodInfoPointer smi = _actionData.ActionMethod as SubMethodInfoPointer;
            SubMethodInfo        mi  = smi.MethodInformation as SubMethodInfo;

            if (mi == null)
            {
                return(false);
            }
            if (mi.IsForeach)
            {
                ParameterClassSubMethod p  = mi.GetParameterType(0, smi, this);
                StringBuilder           sb = new StringBuilder();
                string         s1          = smi.Owner.CodeName;
                IObjectPointer op          = smi.Owner;
                sb.Append(s1);
                while (!(op is ILocalvariable) && op.Owner != null && op.Owner.Owner != null)
                {
                    if (!s1.StartsWith(op.Owner.CodeName, StringComparison.Ordinal))
                    {
                        s1 = op.Owner.CodeName;
                        sb.Insert(0, ".");
                        sb.Insert(0, s1);
                    }
                    op = op.Owner;
                }
                s1 = sb.ToString();
                string indents = Indentation.GetIndent();
                string a       = string.Format(CultureInfo.InvariantCulture,
                                               "a{0}", Guid.NewGuid().GetHashCode().ToString("x", CultureInfo.InvariantCulture));
                string idx = string.Format(CultureInfo.InvariantCulture,
                                           "i{0}", Guid.NewGuid().GetHashCode().ToString("x", CultureInfo.InvariantCulture));
                string s0 = string.Format(System.Globalization.CultureInfo.InvariantCulture,
                                          "{4}var {3} = {1};\r\n{4}if({3}) for(var {0}=0;{0}<{3}.length;{0}++) {{\r\n{4}var {2}={3}[{0}]; \r\n", idx, s1, p.CodeName, a, indents);
                methodCode.Add(s0);
                Method.SubMethod.Push(this);
                data.AddSubMethod(this);
                Indentation.IndentIncrease();
                bRet = base.OnExportJavaScriptCode(previousAction, nextAction, jsCode, methodCode, data);
                Indentation.IndentDecrease();
                Method.SubMethod.Pop();
                //
                methodCode.Add(indents);
                methodCode.Add("}\r\n");
            }
            else
            {
                string indents = Indentation.GetIndent();
                methodCode.Add(indents);
                methodCode.Add("for(var ");
                methodCode.Add(mi.GetInitStatementJS(smi, jsCode, methodCode, data, this.BranchId));
                methodCode.Add(mi.GetTestExpressionJS(smi, jsCode, methodCode, data, this.BranchId));
                methodCode.Add(mi.GetIncrementalStatementJS(smi, jsCode, methodCode, data, this.BranchId));
                methodCode.Add(") {\r\n");
                Method.SubMethod.Push(this);
                data.AddSubMethod(this);
                Indentation.IndentIncrease();
                if (_iconList != null)
                {
                    foreach (ComponentIcon ci in _iconList)
                    {
                        ComponentIconLocal cil = ci as ComponentIconLocal;
                        if (cil != null && cil.ScopeGroupId == this.BranchId)
                        {
                            methodCode.Add(Indentation.GetIndent());
                            methodCode.Add("var ");
                            methodCode.Add(cil.LocalPointer.CodeName);
                            methodCode.Add("=");
                            methodCode.Add(ValueTypeUtil.GetDefaultJavaScriptValueByType(cil.LocalPointer.BaseClassType));
                            methodCode.Add(";\r\n");
                        }
                    }
                }
                bRet = base.OnExportJavaScriptCode(previousAction, nextAction, jsCode, methodCode, data);
                Method.SubMethod.Pop();
                //
                Indentation.IndentDecrease();
                methodCode.Add(indents);
                methodCode.Add("}\r\n");
            }

            return(bRet);
        }