void OnEnable() { string xmlPath = Application.dataPath + @"/Editor/AssetBundle/AssetBundleConfig.xml"; m_DAL = new AssetBundleDAL(xmlPath); m_List = m_DAL.GetList(); m_Dic = new Dictionary <string, bool>(); if (m_List == null) { m_List = new List <AssetBundleEntity>(); } for (int i = 0; i < m_List.Count; ++i) { if (m_List[i].Game.Equals(arrGame[gameIndex], StringComparison.CurrentCultureIgnoreCase) || m_List[i].Game.Equals("common", StringComparison.CurrentCultureIgnoreCase)) { m_Dic[m_List[i].Key] = true; } else { m_Dic[m_List[i].Key] = false; } } }
public void OnEnable() { string xmlPath = Application.dataPath + @"/Editor/AssetBundle/AssetBundleConfig.xml"; dal = new AssetBundleDAL(xmlPath); m_List = dal.GetList(); m_Dic = new Dictionary <string, bool>(); for (int i = 0; i < m_List.Count; i++) { m_Dic[m_List[i].Key] = true; } }
public AssetBundleWindow() { string path = Application.dataPath + @"\Editor\AssetBundle\AssetBundleConfig.xml"; dal = new AssetBundleDAL(path); list = dal.GetList(); dic = new Dictionary <string, bool>(); foreach (var item in list) { dic[item.Key] = true; } }
/// <summary> /// 构造函数 /// </summary> public AssetBundleWindow() { string xmlPath = Application.dataPath + @"\Editor\AssetBundle\AssetBundleConfig.xml"; dal = new AssetBundleDAL(xmlPath); m_List = dal.GetList(); //实例化字典,并添加数据 m_Dic = new Dictionary <string, bool>(); for (int i = 0; i < m_List.Count; i++) { m_Dic[m_List[i].Key] = true;//默认都选中 } }
public void OnEnable() { XMLPath = Application.dataPath + @"\Editor\AssetBundle\AssetBundleConfig.xml"; mDal = new AssetBundleDAL(XMLPath); mList = mDal.GetList(); mDic = new Dictionary <string, bool>(); foreach (var item in mList) { mDic[item.key] = false; } /* * for (int i = 0; i < list.Count; i++) * { * Debug.Log(list[i].key); * } * */ }
/// <summary> /// 绘制窗口 /// </summary> public void OnGUI() { while (IsRun) { string path = Application.dataPath + "/Editor/AssetBundle/AssetBundleConfig.xml"; dal = new AssetBundleDAL(path); mList = dal.GetList(); mDic = new Dictionary <string, bool>(); for (int i = 0; i < mList.Count; i++) { mDic[mList[i].Key] = true; } IsRun = false; break; } if (mList == null) { return; } #region 钮行 EditorGUILayout.BeginHorizontal("box"); //新建一个下拉列表 tagIndex = EditorGUILayout.Popup(tagIndex, arrTag, GUILayout.Width(100)); //创建一个按钮 if (GUILayout.Button("选定Tag", GUILayout.Width(100))) { EditorApplication.delayCall = OnSelectTagCallBack; } //新建一个下拉列表 buildTargetIndex = EditorGUILayout.Popup(buildTargetIndex, arrBuidTarget, GUILayout.Width(100)); if (GUILayout.Button("选定Target", GUILayout.Width(100))) { EditorApplication.delayCall = OnSelectTargetCallBack; } if (GUILayout.Button("打AssetBundle包", GUILayout.Width(200))) { EditorApplication.delayCall = OnAssetBundleCallBack; } if (GUILayout.Button("清空AssetBundle包", GUILayout.Width(200))) { EditorApplication.delayCall = OnClearAssetBundleCallBack; } EditorGUILayout.Space();//用空白自动填充剩余的部分 EditorGUILayout.EndHorizontal(); #endregion #region 显示包内容 GUILayout.BeginHorizontal("BOX"); GUILayout.Label("包名"); GUILayout.Label("标记", GUILayout.Width(100)); GUILayout.Label("保存路径", GUILayout.Width(200)); GUILayout.Label("版本", GUILayout.Width(100)); GUILayout.Label("大小", GUILayout.Width(100)); GUILayout.EndHorizontal(); #endregion GUILayout.BeginVertical(); pos = EditorGUILayout.BeginScrollView(pos); for (int i = 0; i < mList.Count; i++) { AssetBundleEntity entity = mList[i]; GUILayout.BeginHorizontal("box"); mDic[entity.Key] = GUILayout.Toggle(mDic[entity.Key], "", GUILayout.Width(20)); GUILayout.Label(entity.Name); GUILayout.Label(entity.Tag, GUILayout.Width(100)); GUILayout.Label(entity.ToPath, GUILayout.Width(200)); GUILayout.Label(entity.Version.ToString(), GUILayout.Width(100)); GUILayout.Label(entity.Size.ToString(), GUILayout.Width(100)); GUILayout.EndHorizontal(); foreach (string path in entity.PathList) { GUILayout.BeginHorizontal("box"); GUILayout.Space(40); GUILayout.Label(path); GUILayout.EndHorizontal(); } } EditorGUILayout.EndScrollView(); GUILayout.EndVertical(); }