private IDrawer CreateDefaultValuesListDrawer(IEnumerable <DefaultValue> defaultValues) { //TODO make that 25 button width value as a constant somewhere. return(ListDrawer <DefaultValue> .CreateButtonedLabelList(defaultValues, s => "Key: " + s.Key + " | Value: " + s.Value, null, new List <Button.ButtonInfo <DefaultValue> > { new Button.ButtonInfo <DefaultValue>("x", 25, OnRemovePressed) }).SetEmptyDrawer(new Label.Label("No Default Values Found."))); }
protected override void OnInspectorGUI(List <Object> found) { GUI.enabled = true; ListDrawer <Object> drawer = new ListDrawer <Object>(found); drawer.Draw(); }
private void VisualizeDups() { if (dups.Count == 0) { return; } EditorGUILayout.LabelField("Duplicates", EditorStyles.boldLabel); EditorGUI.indentLevel += 2; foreach (UIWidgetClassifier.WidgetType widgetType in EnumUtil.Values <UIWidgetClassifier.WidgetType>()) { MultiMap <string, DupEntry> map = null; if (dups.TryGetValue(widgetType, out map) && map.Count > 0) { EditorGUILayout.LabelField(widgetType.ToString(), EditorStyles.boldLabel); EditorGUI.indentLevel += 2; foreach (KeyValuePair <string, List <DupEntry> > slot in map) { ListDrawer <DupEntry> drawer = new ListDrawer <DupEntry>(slot.Value, new NamedObjDrawer <DupEntry>()); drawer.Draw(); EditorGUILayout.Space(); } EditorGUI.indentLevel -= 2; } } EditorGUI.indentLevel -= 2; }
public override void OnInspectorGUI() { foreach (Type type in targets.Keys) { EditorGUILayout.TextField(type.FullName, EditorStyles.toolbarTextField, GUILayout.ExpandWidth(false)); ListDrawer <Component> drawer = new ListDrawer <Component>(targets[type]); drawer.Draw(); } }
public override void OnInspectorGUI() { if (refDiffs != null) { EditorGUI.indentLevel++; ListDrawer <RefDiff> drawer = new ListDrawer <RefDiff>(refDiffs); drawer.Draw(); EditorGUI.indentLevel--; } }
private void CheckAnimation() { List <Animation> anims = new List <Animation>(); foreach (Animation anim in EditorAssetUtil.FindSceneComponents <Animation>()) { if (anim.cullingType == AnimationCullingType.AlwaysAnimate) { anims.Add(anim); } } if (anims.Count > 0) { GUILayout.Label("AnimationCullingType.AlwaysAnimate", EditorStyles.boldLabel); var drawer = new ListDrawer <Animation>(anims, new ObjListItemDrawer <Animation>()); drawer.Draw(); } }
protected override void OnInspectorGUI(List <Object> found) { GUI.enabled = true; if (allocInfo.Count > 0) { ListDrawer <FieldRef> drawer = new ListDrawer <FieldRef>(allocInfo, new FieldRefDrawer()); drawer.Draw(); } if (simpleRef.Count > 0) { var drawer = new ListDrawer <Object>(simpleRef, new ObjListItemDrawer <Object>()); drawer.Draw(); } if (allocInfo.Count == 0 && simpleRef.Count == 0) { EditorGUILayout.HelpBox("No reference found", MessageType.Info); } }
private void VisualizeGroup() { foreach (UIWidgetClassifier.WidgetType widgetType in EnumUtil.Values <UIWidgetClassifier.WidgetType>()) { List <GameObject> list = classifier[widgetType]; if (list.Count == 0) { continue; } EditorGUILayout.LabelField(widgetType.ToString(), EditorStyles.boldLabel); var drawer = new ListDrawer <GameObject>(list, new ObjListItemDrawer <GameObject>()); drawer.Draw(); } EditorGUILayout.LabelField("Panel", EditorStyles.boldLabel); var panelDrawer = new ListDrawer <GameObject>(panels, new ObjListItemDrawer <GameObject>()); panelDrawer.Draw(); EditorGUI.indentLevel -= 2; }
private IDrawer CreateIAPProductListDrawer(IEnumerable <HMSIAPProductEntry> products) { return(ListDrawer <HMSIAPProductEntry> .CreateButtonedLabelList(products, s => "Identifier: " + s.Identifier + " | Type: " + s.Type.ToString(), null, new List <Button.ButtonInfo <HMSIAPProductEntry> > { new Button.ButtonInfo <HMSIAPProductEntry>("x", 25, OnRemovePressed) }).SetEmptyDrawer(new Label.Label("No Products Found."))); }
private IDrawer CreateLeaderboardListDrawer(IEnumerable <HMSLeaderboardEntry> leaderboards) { return(ListDrawer <HMSLeaderboardEntry> .CreateButtonedLabelList(leaderboards, s => "Name: " + s.Name + " | ID: " + s.Id, null, new List <Button.ButtonInfo <HMSLeaderboardEntry> > { new Button.ButtonInfo <HMSLeaderboardEntry>("x", 25, OnRemoveLeaderboardPressed) }).SetEmptyDrawer(new Label.Label("No Leaderboard Found."))); }
private IDrawer CreateAchievementListDrawer(IEnumerable <HMSAchievementEntry> achievements) { return(ListDrawer <HMSAchievementEntry> .CreateButtonedLabelList(achievements, s => "Name: " + s.Name + " | ID: " + s.Id, null, new List <Button.ButtonInfo <HMSAchievementEntry> > { new Button.ButtonInfo <HMSAchievementEntry>("x", 25, OnRemoveAchievementsPressed) }).SetEmptyDrawer(new Label.Label("No Achievement Found."))); }
public override void OnInspectorGUI() { if (EditorUI.DrawHeader("Sprite -> Texture")) { EditorUI.BeginContents(); EditorGUILayout.BeginHorizontal(); EditorGUILayoutUtil.ObjectField <Object>("Folder", ref texFolder, false); if (GUILayout.Button("Sprite -> Texture") && EditorUtility.DisplayDialog("Warning", "BackUp?", "OK", "Cancel")) { ConvertToTexture(texFolder); } EditorGUILayout.EndHorizontal(); var drawer = new ListDrawer <UITexture>(texList, new ObjListItemDrawer <UITexture>()); drawer.Draw(); EditorUI.EndContents(); } if (EditorUI.DrawHeader("Texture -> Sprite")) { EditorUI.BeginContents(); EditorGUILayout.BeginHorizontal(); ComponentSelector.Draw <NGUIAtlas>("Atlas", atlasToAdd, OnSelectAtlas, true, GUILayout.MinWidth(80f)); if (GUILayout.Button("Add Selected")) { foreach (Object o in Selection.objects) { if (o is GameObject) { OnSelectAtlas((o as GameObject).GetComponent <NGUIAtlas>()); } } } EditorGUILayout.EndHorizontal(); EditorGUILayoutUtil.TextField("Search sprite", ref searchSpriteName); if (!searchSpriteName.IsEmpty()) { List <NGUIAtlas> filtered = new List <NGUIAtlas>(); foreach (NGUIAtlas a in atlasRefs) { if (a.GetSprite(searchSpriteName) != null) { filtered.Add(a); } } var drawer = new ListDrawer <NGUIAtlas>(filtered, new ObjListItemDrawer <NGUIAtlas>()); drawer.Draw(); EditorGUILayout.BeginHorizontal(); EditorGUILayoutUtil.Popup("Change to", ref changeAtlas, filtered); if (GUILayout.Button("Apply")) { EditorTraversal.ForEachAsset <GameObject>(FileType.Prefab, (path, prefab) => { ChangeAtlas(prefab, filtered, changeAtlas); }); EditorTraversal.ForEachScene(s => { foreach (var r in s.GetRootGameObjects()) { ChangeAtlas(r.gameObject, filtered, changeAtlas); } return(null); }); } EditorGUILayout.EndHorizontal(); var spriteDrawer = new ListDrawer <UISprite>(spriteList, new ObjListItemDrawer <UISprite>()); spriteDrawer.Draw(); } else { var drawer = new ListDrawer <NGUIAtlas>(atlasRefs, new ObjListItemDrawer <NGUIAtlas>()); if (drawer.Draw()) { SaveAtlasRefs(); } } if (!dupSprites.IsEmpty()) { if (EditorUI.DrawHeader("Duplicate sprites")) { EditorUI.BeginContents(); float cellWidth = 200f; float width = GetWidth(); int column = Mathf.Max((int)(width / cellWidth), 1); int i = 0; foreach (string d in dupSprites) { if (i == 0) { EditorGUILayout.BeginHorizontal(); } if (GUILayout.Button(d, GUILayout.Width(200))) { searchSpriteName = d; } i = i + 1; if (i == column) { EditorGUILayout.EndHorizontal(); i = 0; } } if (i != 0) { EditorGUILayout.EndHorizontal(); } EditorUI.EndContents(); } } EditorGUILayout.BeginHorizontal(); EditorGUILayoutUtil.ObjectField("Target", ref targetObj, true); GUI.enabled = targetObj != null; if (GUILayout.Button("Convert to Sprite") && EditorUtility.DisplayDialog("Warning", "BackUp?", "OK")) { ConvertToSprite(); } if (GUILayout.Button("Set TexSetter")) { foreach (UITexture tex in targetObj.GetComponentsInChildren <UITexture>(true)) { TexSetterInspector.SetIfCdn(tex); } } GUI.enabled = true; EditorGUILayout.EndHorizontal(); // collect atlas GUI.enabled = targetObj != null; if (EditorUI.DrawHeader("Member Atlases")) { EditorUI.BeginContents(); if (targetObj != null) { MultiMap <NGUIAtlas, UISprite> collect = new MultiMap <NGUIAtlas, UISprite>(); foreach (UISprite s in targetObj.GetComponentsInChildren <UISprite>(true)) { collect.Add(s.atlas as NGUIAtlas, s); } foreach (KeyValuePair <NGUIAtlas, List <UISprite> > pair in collect) { if (EditorGUILayout.Foldout(folding.Contains(pair.Key), pair.Key.name())) { folding.Add(pair.Key); EditorGUI.indentLevel++; foreach (UISprite s in pair.Value) { EditorGUILayout.ObjectField(s.gameObject, typeof(GameObject), true); } EditorGUI.indentLevel--; } else { folding.Remove(pair.Key); } } } EditorUI.EndContents(); } if (EditorUI.DrawHeader("Orphan Texture")) { EditorUI.BeginContents(); if (targetObj != null) { foreach (UITexture tex in targetObj.GetComponentsInChildren <UITexture>(true)) { if (tex.GetComponent <TexLoader>() == null) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.ObjectField(tex.gameObject, typeof(GameObject), true); EditorGUILayout.ObjectField(tex.mainTexture, typeof(Texture), false); EditorGUILayout.EndHorizontal(); } } } EditorUI.EndContents(); } GUI.enabled = true; EditorUI.EndContents(); } if (EditorUI.DrawHeader("Find All Sprites")) { EditorUI.BeginContents(); EditorGUILayout.BeginHorizontal(); ComponentSelector.Draw <NGUIAtlas>("Atlas", atlas4Sprite, OnSelectAtlasForSprite, true, GUILayout.MinWidth(80f)); if (GUILayout.Button("Find")) { var list = Resources.FindObjectsOfTypeAll <UISprite>().ToList(i => i as UISprite); s4a.Clear(); foreach (var s in list) { if (s.atlas == atlas4Sprite) { s4a.Add(s); } } } EditorGUILayout.EndHorizontal(); EditorUI.EndContents(); } GUI.enabled = true; }
public override void OnInspectorGUI() { var drawer = new ListDrawer <NamedObj>(nullRefs.ConvertAll(t => (NamedObj)t), new NamedObjDrawer <NamedObj>()); drawer.Draw(); }
protected override void OnInspectorGUI(List <ShaderSearchItem> found) { var drawer = new ListDrawer <ShaderSearchItem>(found, new ShaderSearchItemDrawer()); drawer.Draw(); }