Ejemplo n.º 1
0
    public Vector2 DrawStatistics(Vector2 sliderPos, float scrollViewHeight)
    {
        int countDict1, countDict2;

        JSMgr.GetDictCount(out countDict1, out countDict2);
        GUILayout.TextArea(
            "JS->CS Count: " + jsCallCSPerFrame + " Round: " + JSMgr.jsEngineRound + " Objs(Total " + countDict1 +
            ", Class " + countDict2 + ") CSR(Obj " + CSRepresentedObject.s_objCount + " Fun " +
            CSRepresentedObject.s_funCount + ") Del " + JSMgr.getJSFunCSDelegateCount());
#if UNITY_EDITOR
        GUILayout.TextArea(jsCallLogInfo);
#endif

        int clsCount = 0;
        var dict1    = JSMgr.GetDict1();
        var Keys     = new List <int>(dict1.Keys);

        var class2Count = new Dictionary <string, int>();
        foreach (int K in Keys)
        {
            if (!dict1.ContainsKey(K))
            {
                continue;
            }

            var Rel      = dict1[K];
            var typeName = Rel.csObj.GetType().Name;
            if (class2Count.ContainsKey(typeName))
            {
                class2Count[typeName]++;
            }
            else
            {
                class2Count[typeName] = 1;
            }
            if (Rel.csObj != null && Rel.csObj.GetType().IsClass)
            {
                clsCount++;
            }
        }
        float y = 40;
        sliderPos = GUILayout.BeginScrollView(sliderPos, GUILayout.Height(scrollViewHeight));
        GUILayout.TextArea("class count: " + clsCount);
        y += 20;
        GUILayout.TextArea("valueMapSize: " + JSApi.getValueMapSize());
        y += 20;
        GUILayout.TextArea("valueMapIndex: " + JSApi.getValueMapIndex());
        y += 20;
        foreach (var v in class2Count)
        {
            GUILayout.TextArea(v.Key + ": " + v.Value);
            y += 20;
        }
        GUILayout.EndScrollView();

        return(sliderPos);
    }
Ejemplo n.º 2
0
    // OnGUI: Output some statistics
    void OnGUI()
    {
        if (this != JSEngine.inst)
        {
            return;
        }
        if (!showStatistics)
        {
            return;
        }
        int countDict1, countDict2;

        JSMgr.GetDictCount(out countDict1, out countDict2);

        GUI.TextArea(new Rect(guiX, 10, 500, 20), "JS->CS Count " + this.jsCallCountPerFrame + " Round " + JSMgr.jsEngineRound + " Objs(Total " + countDict1.ToString() + ", Class " + countDict2.ToString() + ") CSR(Obj " + CSRepresentedObject.s_objCount + " Fun " + CSRepresentedObject.s_funCount + ") Del " + JSMgr.getJSFunCSDelegateCount());

        int clsCount = 0;
        Dictionary <int, JSMgr.JS_CS_Rel> dict1 = JSMgr.GetDict1();
        List <int> Keys = new List <int>(dict1.Keys);

        Dictionary <string, int> class2Count = new Dictionary <string, int>();

        foreach (var K in Keys)
        {
            if (!dict1.ContainsKey(K))
            {
                continue;
            }

            var Rel = dict1[K];
            if (class2Count.ContainsKey(Rel.name))
            {
                class2Count[Rel.name]++;
            }
            else
            {
                class2Count[Rel.name] = 1;
            }
            if (Rel.csObj != null && Rel.csObj.GetType().IsClass)
            {
                clsCount++;
            }
        }
        float y = 40;

        GUI.TextArea(new Rect(guiX, y, 400, 20), "class count: " + clsCount);
        y += 20;

        GUI.TextArea(new Rect(guiX, y, 400, 20), "valueMapSize: " + JSApi.getValueMapSize());
        y += 20;

        GUI.TextArea(new Rect(guiX, y, 400, 20), "valueMapIndex: " + JSApi.getValueMapIndex());
        y += 20;

        foreach (var v in class2Count)
        {
            GUI.TextArea(new Rect(guiX, y, 400, 20), v.Key + ": " + v.Value);
            y += 20;
        }
    }