Ejemplo n.º 1
0
    void addPerfSection(float amount, double perf, string iconname)
    {
        float width = Screen.width * 0.9f;

        GUI.color = PerformanceProfile.doubleToPerfColor(perf);
        GUILayout.Label(amount + "", GUILayout.Width(width / 2));
        GUI.color = Color.white;
        addButton(iconname, 0, -20, 15, false);
    }
Ejemplo n.º 2
0
    void OnGUI()
    {
        scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, true, GUILayout.Width(position.width), GUILayout.Height(position.height - 74));
        GuiLine(2);
        KAPProfile[] kps = KAPProfile.getAllInProject();
        foreach (KAPProfile item in kps)
        {
            AvatarsContainer.initKPValue(item.name);
            addButton("avatar", 3, 0, 20, true);
            GUILayout.Label("    " + item.name, EditorStyles.boldLabel);
            GUI.color = PerformanceProfile.doubleToPerfColor(item.perfP.performance());
            Rect r = EditorGUILayout.BeginVertical();
            EditorGUI.ProgressBar(r, ((4 - item.perfP.performance()) / 4), PerformanceProfile.doubleToPerfName(item.perfP.performance()) + " (" + (4 - item.perfP.performance()) + ")");
            GUILayout.Space(18);
            EditorGUILayout.EndVertical();
            GUI.color = Color.white;
            AvatarsContainer.kpsfoldout[item.name] = EditorGUILayout.Foldout(AvatarsContainer.kpsfoldout[item.name], "details");
            if (AvatarsContainer.kpsfoldout[item.name])
            {
                GUILayout.BeginHorizontal();
                addPerfSection(item.polys, item.perfP.polysperf, "polygon");
                DrawBreak();
                addPerfSection(item.boneamount, item.perfP.boneamountperf, "bone");
                GUILayout.EndHorizontal();
                GuiLine();
                GUILayout.BeginHorizontal();
                addPerfSection(item.meshrenderers, item.perfP.meshrenderersperf, "mesh");
                DrawBreak();
                addPerfSection(item.dynboneamount, item.perfP.dynboneamountperf, "dynamic_bone");
                GUILayout.EndHorizontal();
                GuiLine();
                GUILayout.BeginHorizontal();
                addPerfSection(item.dynbonecolliders, item.perfP.dynbonecollidersperf, "dynamic_bone_collider");
                DrawBreak();
                addPerfSection(item.particle_systems, item.perfP.particle_systemsperf, "particle");
                GUILayout.EndHorizontal();
                GuiLine();
                GUILayout.BeginHorizontal();
                addPerfSection(item.audio_sources, item.perfP.audio_sourcesperf, "audio");
                DrawBreak();
                addPerfSection(item.lights, item.perfP.lightsperf, "light_source");
                GUILayout.EndHorizontal();
                GuiLine();
                GUILayout.BeginHorizontal();
                addPerfSection(item.animators, item.perfP.animatorsperf, "animator");
                DrawBreak();
                addPerfSection(item.cloth, item.perfP.clothperf, "cloth");
                GUILayout.EndHorizontal();
                GUILayout.Space(5);
                GUILayout.BeginHorizontal();
                AvatarsContainer.kpsscene[item.name]  = GUILayout.Button("scene");
                AvatarsContainer.kpsfolder[item.name] = GUILayout.Button("folder");
                GUI.backgroundColor = MainContainer.fromRGB(255f, 119f, 110f);
                AvatarsContainer.kpsdelete[item.name] = GUILayout.Button("delete");
                GUI.backgroundColor = Color.white;
                GUILayout.EndHorizontal();
            }
            GuiLine(2);

            if (AvatarsContainer.kpsscene[item.name])
            {
                item.openScene();
            }
            if (AvatarsContainer.kpsfolder[item.name])
            {
                item.openFolder();
                CleanFolder.cleanFolder(item.name);
            }
            if (AvatarsContainer.kpsdelete[item.name])
            {
                item.delete();
            }
        }
        GUILayout.EndScrollView();
        addButton("avatar", 3, 0, 20, true);
        GUILayout.Label("    add avatar", EditorStyles.boldLabel);

        model = (GameObject)EditorGUILayout.ObjectField("select your avatar:", model, typeof(GameObject), true);
        if (model != null)
        {
            bool btn = GUILayout.Button("do it!");
            if (btn == true)
            {
                AvatarStructureBuilder.BuildOverride(model);
            }
        }
        else
        {
            GUI.enabled = false;
            GUILayout.Button("please select a .fbx");
            GUI.enabled = true;
        }
    }
Ejemplo n.º 3
0
 /// <summary>
 /// Sets the overall performance level based on the provided enumeration value, providing
 /// for coarse grained adjustments control over CPU and RAM consumption.
 /// </summary>
 /// <param name="performanceProfile">
 /// The PerformanceLevel value indicating the new performance and resource usage settings to adopt.
 /// </param>
 public static void SetPerformanceLevel(PerformanceProfile performanceProfile)
 {
     Concurrency.SetByPerformanceMode(performanceProfile);
     Memory.SetByPerformanceMode(performanceProfile);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Sets the maximum size to which the lookup caches can collectively grow based on the
 /// specified ResourceMode
 /// </summary>
 /// <param name="mode">
 /// The ResourceMode which will be used to determine the maximum collective cache size
 /// </param>
 public static void SetByPerformanceMode(PerformanceProfile mode) =>
 MinRamThreshold = mode == PerformanceProfile.High ?
                   (MB)2048 : mode == PerformanceProfile.Normal ? (MB)3072 : (MB)4096;
Ejemplo n.º 5
0
 /// <summary>
 /// Sets the maximum allowed Concurrency level based on the supplied ResourceUsageMode.
 /// </summary>
 /// <param name="profile">
 /// The <see cref="PerformanceProfile"/> value from which to determine concurrency settings.
 /// </param>
 public static void SetByPerformanceMode(PerformanceProfile profile)
 {
     // Get the number of logical cores.
     Max = concurrencyCalculationMap[profile](Environment.ProcessorCount);
 }