示例#1
0
    public static void BuildAb()
    {
        Object o       = Selection.activeObject;
        string outPath = Application.dataPath + "/../../FishesAssetbundles/";

        if (!Directory.Exists(outPath))
        {
            Directory.CreateDirectory(outPath);
        }
        string[] depenStr = AssetDatabase.GetDependencies(AssetDatabase.GetAssetPath(o));

        AssetBundleBuild[] builds = new AssetBundleBuild[depenStr.Length];
        for (int i = 0, imax = depenStr.Length; i < imax; ++i)
        {
            Object asset = AssetDatabase.LoadAssetAtPath <Object>(depenStr[i]);
            builds[i].assetBundleName = ABTool.FixedName(asset) + ".ab";
            builds[i].assetNames      = new string[] { depenStr[i] };
        }
        BuildPipeline.BuildAssetBundles(outPath, builds,
                                        BuildAssetBundleOptions.StrictMode
                                        | BuildAssetBundleOptions.DeterministicAssetBundle
                                        //            | BuildAssetBundleOptions.ForceRebuildAssetBundle
                                        , BuildTarget.StandaloneWindows64);
        Debug.Log("打包完成");
    }
示例#2
0
    public static void OpenPanel(string _modules, string _panelName, int _layer, LuaTable _tab)
    {
        string key = _modules + "." + _panelName;

        if (panel_GOs.ContainsKey(key))
        {
            GameObject go = panel_GOs[key];
            go.transform.SetSiblingIndex(go.transform.parent.childCount - 1);
            go.SetActive(true);
            go.GetComponent <PanelBase> ().Open();
            go.GetComponent <XLuaBehaviour> ().main.Get <Action <LuaTable> > ("onopen")(_tab);
        }
        else
        {
            string path = "/" + _modules + "/panels.assetbundle";
            ABTool.LoadGO(path, _panelName, (_go) =>
            {
                GameObject go = GameObject.Instantiate(_go);
                go.name       = _go.name;
                go.transform.SetParent(canves_T.GetChild(_layer), false);
                go.transform.SetSiblingIndex(go.transform.parent.childCount - 1);
                go.GetComponent <PanelBase> ().Open();
                go.GetComponent <XLuaBehaviour> ().main.Get <Action <LuaTable> > ("onopen")(_tab);
                panel_GOs[key] = go;
            });
        }
    }
示例#3
0
    IEnumerator LoadDepensBundle(string name)
    {
        AssetBundleCreateRequest request = AssetBundle.LoadFromFileAsync(assetFolder + name);

        yield return(request);

        Debug.Log("load depen AB Over " + name);
        abList.Add(ABTool.NameWithoutExtension(name), request.assetBundle);
    }
示例#4
0
    static void Build()
    {
        abPath = Path.Combine(Application.dataPath, abFolder).Replace("\\", "/");

        outPath = Path.Combine(Environment.CurrentDirectory, "AssetBundles").Replace("\\", "/");


        ABTool abWindow = (ABTool)EditorWindow.GetWindow(typeof(ABTool), false, "ABTool", true);

        abWindow.Show();
    }
示例#5
0
 void main()
 {
     Init();
     PanelTool.Init();
     ABTool.Init();
     HttpSerMng.Instance.Init();
     AudioMng.Instance.Init();
     ShareMng.Instance.Init();
     GVoiceMng.Instance.Init();
     initFinsh();
 }
示例#6
0
    void initFinsh()
    {
        string mcfgPath = QPathHelper.GetAssetBundleOutPath() + "/ModulesConfig.txt";

        if (!System.IO.File.Exists(mcfgPath))
        {
            Debug.Log("[AppMng.Init]未检测到ModulesConfig文件,开始拷贝资源文件夹");
            ABTool.Download(Application.streamingAssetsPath + "/" + QPathHelper.GetPlatformName(), "hall/files.txt", "...", (val) =>
            {
                Debug.LogFormat("[AppMng.Init]正在拷贝hall资源文件,已完成:{0}%", val * 100);
                if (val == 1)
                {
                    DataMng.Instance.ReadText(mcfgPath, (_mcfg_json) =>
                    {
                        byte downCount = 0;
                        Hashtable mcfg = MiniJSON.jsonDecode(_mcfg_json) as Hashtable;
                        Hashtable ms   = mcfg["ms"] as Hashtable;
                        foreach (var jd in ms.Values)
                        {
                            string modules = (jd as Hashtable) ["modules"].ToString();
                            ABTool.Download(Application.streamingAssetsPath + "/" + QPathHelper.GetPlatformName(), modules + "/files.txt", "...", (_val) =>
                            {
                                Debug.LogFormat("[AppMng.Init]正在拷贝{1}资源文件,已完成:{0}%", _val * 100, modules);
                                if (_val == 1)
                                {
                                    downCount++;
                                    if (downCount == ms.Count)
                                    {
                                        checkUpdates();
                                    }
                                }
                            });
                        }
                    });
                }
            });
        }
        else
        {
            checkUpdates();
        }
    }
示例#7
0
 void getAC(string _modules, string _name, Action <AudioClip> _callback)
 {
     if (!acs.ContainsKey(_modules))
     {
         acs.Add(_modules, new Dictionary <string, AudioClip>());
     }
     if (acs[_modules].ContainsKey(_name))
     {
         _callback(acs[_modules][_name]);
     }
     else
     {
         string path = "/" + _modules + "/audios.assetbundle";
         ABTool.LoadAC(path, _name, (ac) =>
         {
             acs[_modules].Add(_name, ac);
             _callback(ac);
         });
     }
 }
示例#8
0
    public static void InitPanel(string _modules, string _panelName, int _layer)
    {
        string key = _modules + "." + _panelName;

        if (panel_GOs.ContainsKey(key))
        {
            Debug.LogWarningFormat("[PanelTool.InitPanel]已有此界面:{0}.{1}", _modules, _panelName);
            return;
        }
        string path = "/" + _modules + "/panels.assetbundle";

        ABTool.LoadGO(path, _panelName, (_go) =>
        {
            GameObject go = GameObject.Instantiate(_go);
            go.name       = _go.name;
            go.transform.SetParent(canves_T.GetChild(_layer), false);
            panel_GOs[key] = go;
            go.SetActive(false);
        });
    }
示例#9
0
    public static void BuildAbMulty()
    {
        string outPath = Application.dataPath + "/../../FishesAssetbundles/";

        if (!Directory.Exists(outPath))
        {
            Directory.CreateDirectory(outPath);
        }
        List <string>           builtList  = new List <string>();
        List <AssetBundleBuild> buildsList = new List <AssetBundleBuild>();

        Object[] objects = Selection.objects;
        for (int i = 0, imax = objects.Length; i < imax; ++i)
        {
            Object   o        = objects[i];
            string[] depenStr = AssetDatabase.GetDependencies(AssetDatabase.GetAssetPath(o));

            for (int k = 0, kmax = depenStr.Length; k < kmax; ++k)
            {
                if (builtList.Contains(depenStr[k]))
                {
                    continue;
                }
                builtList.Add(depenStr[k]);
                Object           asset = AssetDatabase.LoadAssetAtPath <Object>(depenStr[k]);
                AssetBundleBuild abb   = new AssetBundleBuild();
                abb.assetBundleName = ABTool.FixedName(asset) + ".ab";
                abb.assetNames      = new string[] { depenStr[k] };
                buildsList.Add(abb);
            }
        }
        BuildPipeline.BuildAssetBundles(outPath, buildsList.ToArray(),
                                        BuildAssetBundleOptions.StrictMode
                                        | BuildAssetBundleOptions.DeterministicAssetBundle
                                        //            | BuildAssetBundleOptions.ForceRebuildAssetBundle
                                        , BuildTarget.StandaloneWindows64);
        Debug.Log("打包完成");
    }