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
        };
    }
Beispiel #2
0
    public static void GenerateJsTypeBindings(HashSet <Type> exportTypes, HashSet <Type> exportEnums, Type[] otherExportTypes)
    {
        OnBegin();

        // <typeName,members>
        var allExportInfoDic = new Dictionary <string, List <string> >();

        // classes
        foreach (var type in exportTypes)
        {
            List <string> memberNames;
            GenerateClass(type, out memberNames);
            allExportInfoDic.Add(JSNameMgr.GetJSTypeFullName(type), memberNames);
        }
        foreach (var type in otherExportTypes)
        {
            List <string> memberNames;
            GenerateClass(type, out memberNames);
            allExportInfoDic.Add(JSNameMgr.GetJSTypeFullName(type), memberNames);
        }

        foreach (var type in exportEnums)
        {
            GenerateEnum(type);
        }

        OnEnd();

        var sb = new StringBuilder();

        foreach (var item in allExportInfoDic)
        {
            sb.AppendFormat("[{0}]\r\n", item.Key);

            var lst = item.Value;
            foreach (string l in lst)
            {
                sb.AppendFormat("    {0}\r\n", l);
            }
            sb.Append("\r\n");
        }
        File.WriteAllText(JsExternalTools.GetAllExportedMembersFile(), sb.ToString());
    }