public void ShowCheckDetailResult() { OnKeyBoardEvent(); //Unity在GUI中改变界面状态时,渲染界面会出错 //http://answers.unity3d.com/questions/400454/argumentexception-getting-control-0s-position-in-a-1.html if (Event.current.type == EventType.Layout) { OptimizeCheckResult(); } viewListScrollPos = EditorGUILayout.BeginScrollView(viewListScrollPos); { for (int i = 0; i < FilterList.Count; i++) { ObjectDetail detail = FilterList[i]; GUILayout.BeginHorizontal(); if (IsItemVisible(i)) { ShowCheckRowItem(detail); } else { GUILayout.Label(" ", GUILayout.Height(previewItem.width)); } GUILayout.EndHorizontal(); ShowChildDetail(detail); } } EditorGUILayout.EndScrollView(); }
public void ShowCheckRowItem(ObjectDetail detail) { if (detail.isWarningDetail) { GUI.color = CheckerConfigManager.checkerConfig.warningItemColor; } if (detail.isSelected) { GUI.color = CheckerConfigManager.checkerConfig.highlightTextColor; } //通用CheckListUI checkItem.ForEach(item => ShowCheckDetail(detail, item)); GUI.color = CheckerConfigManager.defaultTextColor; }
public void ShowCheckDetail(ObjectDetail tCheck, CheckItem item) { if (item.show == false || !tCheck.checkMap.ContainsKey(item)) { return; } if (item.type == CheckType.Texture) { Texture tex = tCheck.checkMap[item] as Texture; if (tex == null) { GUILayout.Box("null", GUILayout.Width(item.width), GUILayout.Height(item.width)); } else { GUILayout.Box(tex, GUILayout.Width(item.width), GUILayout.Height(item.width)); } } else { string label = null; if (item.type == CheckType.FormatSize) { label = FormatSizeString((int)tCheck.checkMap[item]); } else if (item.type == CheckType.List) { List <Object> list = tCheck.checkMap[item] as List <Object>; label = list.Count.ToString(); } else { label = tCheck.checkMap[item].ToString(); } if (item.clickOption == null) { GUILayout.Label(label, GUILayout.Width(item.width)); } else { if (GUILayout.Button(label, GUILayout.Width(item.width))) { SelectObjectDetail(tCheck); item.clickOption(tCheck); } } } }
public override void AddObjectDetail(Object rootObj) { ObjectDetail detail = null; foreach (var v in CheckList) { if (v.checkObject == rootObj) { detail = v; } } if (detail == null) { detail = new SelfObjectDetail(rootObj, this); } }
public override void AddObjectDetail(Object obj, Object refObj, Object detailRefObj) { ObjectDetail detail = null; foreach (var v in CheckList) { if (v.checkObject == obj) { detail = v; } } if (detail == null) { detail = new SceneDetail(obj, this); } detail.AddObjectReference(refObj, detailRefObj); }
public void ShiftSelectObject(ObjectDetail detail) { if (SelectList.Count > 0) { int start = SelectList.Min(x => FilterList.IndexOf(x)); int end = FilterList.IndexOf(detail); ClearSelect(); if (end > start) { SelectList.AddRange(FilterList.GetRange(start, end - start + 1)); } else { SelectList.AddRange(FilterList.GetRange(end, start - end + 1)); } } }
public void OnRefButtonClick(ObjectDetail detail) { ResCheckModuleBase curCheckModule = ResourceCheckerPlus.instance.CurrentCheckModule(); if (!(curCheckModule is DirectResCheckModule) && CheckerConfigManager.checkerConfig.autoFilterOnSideBarButtonClick) { ObjectChecker checker = ResourceCheckerPlus.instance.CurrentCheckModule().CurrentActiveChecker(); if (checker is ParticleChecker || checker is GameObjectChecker) { return; } RefFilterItem filter = new RefFilterItem(checker); checker.filterItem.Clear(true); filter.checkObjList = SelectList.Select(x => x.checkObject).ToList(); checker.filterItem.AddFilterNode(filter); checker.RefreshCheckResult(); } }
private void OnUpDownButtonSelect(KeyCode key) { List <ObjectDetail> list = GetSelectObjectDetails(); ObjectDetail nextSelect = null; if (list.Count > 0) { ObjectDetail detail = list[0]; int index = FilterList.IndexOf(detail); if (key == KeyCode.UpArrow) { if (index - 1 >= 0) { nextSelect = FilterList[index - 1]; viewListScrollPos.y -= 41; } } else if (key == KeyCode.DownArrow) { if (index + 1 < FilterList.Count) { nextSelect = FilterList[index + 1]; viewListScrollPos.y += 41; } } if (nextSelect != null) { ClearSelect(); SelectObjectDetail(nextSelect); ResourceCheckerPlus.instance.Repaint(); } } else { if (FilterList.Count > 0) { ObjectDetail detail = FilterList[0]; ClearSelect(); SelectObjectDetail(detail); viewListScrollPos.y = 0; ResourceCheckerPlus.instance.Repaint(); } } }
private void GenerateDetailLine(ref string line, ObjectDetail detail, CheckItem item) { if (item.type != CheckType.Texture) { if (item.type == CheckType.FormatSize) { line += FormatSizeString((int)detail.checkMap[item]); } else if (item.type == CheckType.List) { List <Object> list = detail.checkMap[item] as List <Object>; line += list.Count.ToString(); } else { line += detail.checkMap[item].ToString().Replace("\n", "").Replace(" ", ""); } line += "\t"; } }
public override void ShowChildDetail(ObjectDetail detail) { ParticleDetail pDetail = detail as ParticleDetail; if (pDetail.showChildParticleCom) { foreach (var child in pDetail.childParticles) { GUILayout.BeginHorizontal(); GUILayout.Space(85); if (GUILayout.Button(child.name, GUILayout.Width(245))) { SelectObject(child.psObject); } string maxChildParticles = "" + child.maxCount; GUILayout.Label(maxChildParticles, GUILayout.Width(80)); string maxChildSize = "" + child.maxSize; GUILayout.Label(maxChildSize, GUILayout.Width(80)); GUILayout.Label("Active: " + child.active.ToString()); GUILayout.EndHorizontal(); } } if (pDetail.showChildTrailCom) { foreach (var child in pDetail.childTrails) { GUILayout.BeginHorizontal(); GUILayout.Space(85); if (GUILayout.Button(child.name, GUILayout.Width(245))) { SelectObject(child.trailObject); } string trailTime = "Time:" + child.time; GUILayout.Label(trailTime, GUILayout.Width(80)); string trailMinVertexDistance = "MinVertexDistance:" + child.minVertexDistance; GUILayout.Label(trailMinVertexDistance, GUILayout.Width(200)); GUILayout.Label("Active: " + child.active.ToString()); GUILayout.EndHorizontal(); } } }
public override void AddObjectDetail(Object obj, Object refObj, Object detailRefObj) { ObjectDetail c = null; //先查缓存 foreach (var checker in CheckList) { if (checker.checkObject == obj) { c = checker; } } if (c == null) { c = new RefObjectDetail(obj, this); } if (refObj != null) { c.foundInReference.Add(refObj); } }
public override void AddObjectDetail(Object obj, Object refObj, Object detailRefObj) { Shader shader = obj as Shader; if (shader == null) { return; } ObjectDetail detail = null; foreach (var v in CheckList) { if (v.checkObject == obj) { detail = v; } } if (detail == null) { detail = new ShaderDetail(obj, this); } detail.AddObjectReference(refObj, detailRefObj); }
public override void ShowChildDetail(ObjectDetail detail) { ShaderDetail shaderDetail = detail as ShaderDetail; if (!shaderDetail.showShaderProperty) { return; } for (int i = 0; i < shaderDetail.propertyList.Count; i++) { ShaderProperty property = shaderDetail.propertyList[i]; if (property == null) { continue; } GUILayout.BeginHorizontal(); GUILayout.Space(720); GUILayout.Label(property.name, GUILayout.Width(100)); GUILayout.Label(property.type, GUILayout.Width(100)); GUILayout.Label(property.description, GUILayout.Width(100)); GUILayout.EndHorizontal(); } }
public override void ShowChildDetail(ObjectDetail detail) { MeshDetail md = detail as MeshDetail; if (md.showSubMesh) { foreach (var child in md.subMeshList) { GUILayout.BeginHorizontal(); GUILayout.Space(170); if (GUILayout.Button(child.name, GUILayout.Width(245))) { SelectObject(child.meshObject); } string vertexCount = "" + child.vertexCount; GUILayout.Label(vertexCount, GUILayout.Width(80)); string tranCount = "" + child.tranCount; GUILayout.Label(tranCount, GUILayout.Width(80)); GUILayout.Label(child.format, GUILayout.Width(200)); GUILayout.EndHorizontal(); } } }
public void ExportCheckResult(string path) { StreamWriter sw = new StreamWriter(path + "/" + checkerName + "CheckResult.txt", true, System.Text.Encoding.Default); string checkTitle = ""; foreach (var v in checkItem) { if (v.type == CheckType.Texture) { continue; } checkTitle += v.title + "\t"; } sw.WriteLine(checkTitle); for (int i = 0; i < FilterList.Count; i++) { ObjectDetail detail = FilterList[i]; string line = ""; checkItem.ForEach(item => GenerateDetailLine(ref line, detail, item)); sw.WriteLine(line); } sw.Close(); }
public override void AddObjectDetail(Object obj, Object refObj, Object detailRefObj) { AnimationClip animClip = obj as AnimationClip; if (animClip == null) { return; } ObjectDetail detail = null; foreach (var v in CheckList) { if (v.checkObject == obj) { detail = v; } } if (detail == null) { detail = new AnimClipDetail(obj, this); } detail.AddObjectReference(refObj, detailRefObj); }
public void SelectObjectDetail(ObjectDetail detail) { bool current = !detail.isSelected; foreach (var v in SelectList) { v.isSelected = false; } if (shiftPressed) { ShiftSelectObject(detail); } else { if (!ctrlPressed) { SelectList.Clear(); } if (current) { SelectList.Add(detail); } else { SelectList.Remove(detail); } } List <Object> list = new List <Object>(); foreach (var v in SelectList) { list.Add(v.checkObject); v.isSelected = true; } Selection.objects = list.ToArray(); }
public override void AddObjectDetail(Object obj, Object refObj, Object detailRefObj) { AudioClip clip = obj as AudioClip; if (clip == null) { return; } ObjectDetail detail = null; //先查缓存 foreach (var checker in CheckList) { if (checker.checkObject == obj) { detail = checker; } } if (detail == null) { detail = new AudioDetail(obj, this); } detail.AddObjectReference(refObj, detailRefObj); }
private void OnDetailRefButton(ObjectDetail detail) { checkModule.AddObjectToSideBarList(detail.totalRef); SelectObjects(detail.totalRef); }
private void OnRefButtonClick(ObjectDetail detail) { checkModule.AddObjectToSideBarList(detail.foundInReference); SelectObjects(detail.foundInReference); }
private void OnNameButtonClick(ObjectDetail detail) { //回调之前带了选中的功能,此处空实现 }
private void OnButtonSubMeshCountClick(ObjectDetail detail) { MeshDetail md = detail as MeshDetail; md.showSubMesh = !md.showSubMesh; }
private void OnButtonChildTrailComClick(ObjectDetail detail) { ParticleDetail pd = detail as ParticleDetail; pd.showChildTrailCom = !pd.showChildTrailCom; }
private void OnButtonShowPropertyClick(ObjectDetail detail) { ShaderDetail sd = detail as ShaderDetail; sd.showShaderProperty = !sd.showShaderProperty; }
public virtual void ShowChildDetail(ObjectDetail detail) { }