示例#1
0
    private void mOneKeyBuildStep2()
    {
        string str = EditorPrefs.GetString(GetOneKeyBuildPrefKeyStep1(), string.Empty);

        EditorPrefs.DeleteKey(GetOneKeyBuildPrefKeyStep1());
        if (string.IsNullOrEmpty(str))
        {
            Debug.LogError("Can Not Find OneKeyBuildStep2 param");
            return;
        }
        Debug.Log("PlayerSettingTool Begin OneKeyBuildStep2");
        JsonData jsonData    = JsonMapper.ToObject(str);
        bool     useCodeMove = jsonData["useCodeMove"].GetBoolean();

#if UNITY_IPHONE
        string target_dir = jsonData["target_dir"].GetString();
#endif
        if (useCodeMove)
        {
#if USE_JSZ
            CodeManagerTool.moveUnUsedMonoCode(true);
#else
            CodeManagerTool.moveJSBFramework(true);
#endif
        }
        AssetBundleBuilder.ShowWindow();
        AssetBundleBuilder.Instance._slientMode = true;
        Debug.Log("PlayerSettingTool UpdateAllBundleName");
        AssetBundleBuilder.Instance.UpdateAllBundleName();
        if (AssetBundleBuilder._curResConfig == null)
        {
            throw new SystemException("AssetBundleBuilder._curResConfig == null");
        }
        Debug.Log("PlayerSettingTool BuildAllAssetBundle");
        AssetBundleBuilder.Instance.BuildAll(AssetBundleBuilder._curResConfig.Version + 1, true);
        AssetBundleBuilder.ShowWindow();
        EditorPrefs.SetString(GetOneKeyBuildPrefKeyStep2(), jsonData.ToJson());
        Debug.Log("PlayerSettingTool OneKeyBuildStep2 Finish");
#if UNITY_IPHONE
        mOneKeyBuildStep3();
#else
        if (!EditorApplication.isCompiling)
        {
            mOneKeyBuildStep3();
        }
#endif
    }
示例#2
0
    public static void OneKeyBuildAll(bool pForMobile, bool commandLine = false)
    {
        Debug.Log("Begin JSB OneKeyBuildAllStep1");
        cmd = commandLine;
        try
        {
            if (!cmd && EditorUtility.DisplayDialogComplex("TIP",
                                                           "One Key Build Js Code,This may take about 20 MIN. Are you sure to continue ?", "OK", "CANCEL",
                                                           String.Empty) != 0)
            {
                return;
            }
            if (EditorApplication.isCompiling)
            {
                const string tips = "Please wait EditorApplication Compiling";
                if (!cmd)
                {
                    EditorUtility.DisplayDialog("TIP", tips, "OK");
                }
                return;
            }
            if (!cmd && CheckTempJSBCodeRoot())
            {
                CodeManagerTool.RevertUnUsedMonoCode();
            }
            mOneKeyBuildAll = true;
            EditorUtility.DisplayCancelableProgressBar("OneKeyBuildAll", "GenerateJSCSBindings", 0.2f);
            CSGenerator.GenerateJSCSBindings(mOneKeyBuildAll);

            EditorUtility.DisplayCancelableProgressBar("OneKeyBuildAll", "GenerateJsTypeInfo", 0.4f);
            GenerateJsTypeInfo();

            JsonData jsonData = new JsonData();
            jsonData["pForMobile"] = pForMobile;
            jsonData["cmd"]        = cmd;
            EditorPrefs.SetString(GetPrefsKey(), jsonData.ToJson());
        }
        catch (Exception e)
        {
            GameDebuger.LogError(string.Format("OneKeyBuildAll failed , e:{0}", e));
            EditorUtility.ClearProgressBar();
        }
        //finally
        //{
        //    EditorUtility.ClearProgressBar();
        //}
    }
示例#3
0
    private void OneKeyBuildStep1()
    {
        EditorApplication.delayCall += () =>
        {
            if (CheckIsCompiling())
            {
                return;
            }
#if USE_JSZ
            bool converJSB    = EditorUtility.DisplayDialog("提示", "是否转换JSB", "是", "否");
            bool reverTempJSB = false;
            if (converJSB)
            {
                reverTempJSB = JsExternalTools.CheckTempJSBCodeRoot();
            }
#endif
            bool     useCodeMove = EditorUtility.DisplayDialog("提示", "是否移除JSB或业务代码", "移除", "不移除");
            JsonData jsonData    = new JsonData();
            jsonData["useCodeMove"] = useCodeMove;

#if UNITY_IPHONE
            string applicationPath = Application.dataPath.Replace("/Assets", "/../..");
            string target_dir      = EditorUtility.OpenFolderPanel("导出目录", applicationPath, "xcode");
            jsonData["target_dir"] = target_dir;
#endif
            Debug.Log("PlayerSettingTool Begin OneKeyBuildStep1");
#if USE_JSZ
            if (converJSB)
            {
                if (reverTempJSB)
                {
                    CodeManagerTool.revertUnUsedMonoCode(true);
                }
                JsExternalTools.OneKeyBuildAll(true, true);
            }
#endif
            EditorPrefs.SetString(GetOneKeyBuildPrefKeyStep1(), jsonData.ToJson());
#if !USE_JSZ
            OneKeyBuildStep2();
#else
            if (!converJSB)
            {
                OneKeyBuildStep2();
            }
#endif
        };
    }