Example #1
0
    public static void CopyAndroidSDKResources(string channelName)
    {
        string targetPath = Path.Combine(Application.dataPath, "Plugins");

        targetPath = Path.Combine(targetPath, "Android");
        GameUtility.SafeClearDir(targetPath);

        string channelPath = Path.Combine(Environment.CurrentDirectory, "Channel");
        string resPath     = Path.Combine(channelPath, "UnityCallAndroid_" + channelName);

        if (!Directory.Exists(resPath))
        {
            resPath = Path.Combine(channelPath, "UnityCallAndroid");
        }

        EditorUtility.DisplayProgressBar("提示", "正在拷贝SDK资源,请稍等", 0f);
        PackageUtils.CopyJavaFolder(resPath + "/assets", targetPath + "/assets");
        EditorUtility.DisplayProgressBar("提示", "正在拷贝SDK资源,请稍等", 0.3f);
        PackageUtils.CopyJavaFolder(resPath + "/libs", targetPath + "/libs");
        EditorUtility.DisplayProgressBar("提示", "正在拷贝SDK资源,请稍等", 0.6f);
        PackageUtils.CopyJavaFolder(resPath + "/res", targetPath + "/res");
        if (File.Exists(resPath + "/bin/UnityCallAndroid.jar"))
        {
            File.Copy(resPath + "/bin/UnityCallAndroid.jar", targetPath + "/libs/UnityCallAndroid.jar", true);
        }
        if (File.Exists(resPath + "/AndroidManifest.xml"))
        {
            File.Copy(resPath + "/AndroidManifest.xml", targetPath + "/AndroidManifest.xml", true);
        }

        EditorUtility.DisplayProgressBar("提示", "正在拷贝SDK资源,请稍等", 1f);
        EditorUtility.ClearProgressBar();
        AssetDatabase.Refresh();
    }