private void DrewGUI(List <YuanPic> yuanPic, string listName, ComponentSelector.OnSelectionCallback callback, UIAtlas atlasCB) { if (NGUIEditorTools.DrawHeader(listName)) { if (!dicOut.ContainsKey(listName)) { dicOut.Add(listName, false); } atlasCB = (UIAtlas)EditorGUILayout.ObjectField(atlasCB, typeof(UIAtlas)); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format("{0}Atlas", listName))) { ComponentSelector.Show <UIAtlas>(callback); } GUILayout.Label(atlasCB != null ? atlasCB.name : "No Selected"); EditorGUILayout.EndHorizontal(); dicOut[listName] = EditorGUILayout.Foldout(dicOut[listName], listName); if (dicOut[listName]) { int count = yuanPic.Count; count = EditorGUILayout.IntField("Size:", count); if (yuanPic.Count < count) { int num = count - yuanPic.Count; for (int i = 0; i < num; i++) { YuanPic tempYuanPic = new YuanPic(); yuanPic.Add(tempYuanPic); tempYuanPic.atlas = atlasCB != null ? atlasCB : null; } } else { int num = yuanPic.Count - count; for (int i = 0; i < num; i++) { yuanPic.RemoveAt(yuanPic.Count - 1); } } int imageNum = 0; foreach (YuanPic item in yuanPic) { GUILayout.BeginHorizontal(); GUILayout.Label("Image" + imageNum.ToString() + ":"); if (GUILayout.Button(item.atlas != null ? item.atlas.name : "Select Atlas")) { cbAtlas = item; ComponentSelector.Show <UIAtlas>(OnSelectAtlas); } if (item.atlas != null) { if (GUILayout.Button(item.spriteName != null ? item.spriteName : "Select Sprite")) { NGUISettings.atlas = item.atlas; NGUISettings.selectedSprite = item.spriteName; SpriteSelector.Show(OnSelectSprite); // SpriteSelector.Show(item.atlas, item.spriteName, OnSelectSprite); cbSpriteName = item; } } GUILayout.EndHorizontal(); imageNum++; } } } }
private void SetPicInfo(UISprite mSprite, YuanPic yuanPic) { mSprite.atlas = yuanPic.atlas; mSprite.spriteName = yuanPic.spriteName; }