public static void initColor() { if (EditorGUIUtility.isProSkin) { background = MainContainer.fromRGB(124f, 96f, 77f); buttons = MainContainer.fromRGB(193f, 144f, 92f); } else { background = MainContainer.fromRGB(209f, 189f, 169f); buttons = MainContainer.fromRGB(203f, 164f, 112f); } }
public static Color doubleToPerfColor(double d) { int i = (int)d; switch (i) { case 0: return(MainContainer.fromRGB(177, 255, 140)); case 1: return(MainContainer.fromRGB(207, 255, 140)); case 2: return(MainContainer.fromRGB(255, 253, 140)); case 3: return(MainContainer.fromRGB(255, 203, 140)); case 4: return(MainContainer.fromRGB(255, 155, 140)); } return(MainContainer.fromRGB(255, 155, 140)); }
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; } }