Example #1
0
        //更新脚本
        public void UpdateFile()
        {
            if (GConfigure.selectTransform == null)
            {
                return;
            }
            if (EditorApplication.isCompiling)
            {
                EditorUtility.DisplayDialog(GConfigure.msgTitle, GConfigure.editorCompiling, GConfigure.ok);
                return;
            }
            var fileName = GConfigure.FilePath(GConfigure.UIBuildFileName);

            if (!FileHelper.IsExists(fileName))
            {
                EditorUtility.DisplayDialog(GConfigure.msgTitle, GConfigure.notCreate, GConfigure.ok);
                return;
            }
            //重新更新BindUI文件
            FileHelper.WriteText(GConfigure.FilePath(GConfigure.UIBuildFileName), GetBuildUICode(), FileMode.Create);

            GetBindingInfo();
            // if (GConfigure.Version == ScriptVersion.Mono)
            // {
            //     GetBindingInfo();
            // }
            // else
            // {
            //     GetBindingInfoToJson();
            // }
            GConfigure.Compiling();
            AssetDatabase.Refresh();
        }
Example #2
0
        // 创建脚本
        public void CreateFile()
        {
            if (GConfigure.selectTransform == null)
            {
                EditorUtility.DisplayDialog(GConfigure.msgTitle, GConfigure.noSelect, GConfigure.ok);
                return;
            }
            if (EditorApplication.isCompiling)
            {
                EditorUtility.DisplayDialog(GConfigure.msgTitle, GConfigure.editorCompiling, GConfigure.ok);
                return;
            }
            if (FileHelper.IsExists(GConfigure.FilePath(GConfigure.UIBuildFileName)))
            {
                EditorUtility.DisplayDialog(GConfigure.msgTitle, GConfigure.haveBeenCreated, GConfigure.ok);
                return;
            }

            if (!FileHelper.IsExists(GConfigure.FilePath(GConfigure.MainFileName)))
            {
                FileHelper.WriteText(GConfigure.FilePath(GConfigure.MainFileName), GetMainCode());
            }

            FileHelper.WriteText(GConfigure.FilePath(GConfigure.UIBuildFileName), GetBuildUICode());

            GetBindingInfo();
            // if (GConfigure.Version == ScriptVersion.Mono)
            // {
            //     GetBindingInfo();
            // }
            // else
            // {
            //     GetBindingInfoToJson();
            // }
            GConfigure.Compiling();
            AssetDatabase.Refresh();
        }