Exemplo n.º 1
0
        public void CreateFile()
        {
            if (QConfigure.selectTransform == null)
            {
                EditorUtility.DisplayDialog(QConfigure.msgTitle, QConfigure.noSelect, QConfigure.ok);
                return;
            }
            if (EditorApplication.isCompiling)
            {
                EditorUtility.DisplayDialog(QConfigure.msgTitle, QConfigure.editorCompiling, QConfigure.ok);
                return;
            }
            if (QFileOperation.IsExists(QConfigure.FilePath(QConfigure.UIBuildFileName)))
            {
                EditorUtility.DisplayDialog(QConfigure.msgTitle, QConfigure.haveBeenCreated, QConfigure.ok);
                return;
            }

            QFileOperation.WriteText(QConfigure.FilePath(QConfigure.UIFileName), GetUICode());
            QFileOperation.WriteText(QConfigure.FilePath(QConfigure.UIBuildFileName), GetBuildUICode());

            if (QConfigure.isCreateModel)
            {
                QFileOperation.WriteText(QConfigure.FilePath(QConfigure.ModelFileName), GetModelCode());
            }

            if (QConfigure.isCreateController)
            {
                QFileOperation.WriteText(QConfigure.FilePath(QConfigure.ControllerFileName), GetControllerCode());
                QFileOperation.WriteText(QConfigure.FilePath(QConfigure.ControllerBuildFileName), GetControllerBuildCode());
            }

            if (QConfigure.version == 1)
            {
                GetBindingInfo();
            }
            else
            {
                GetBindingInfoToJson();
            }
            QConfigure.Compiling();
            AssetDatabase.Refresh();
        }
Exemplo n.º 2
0
        public void Update()
        {
            if (QConfigure.selectTransform == null)
            {
                return;
            }
            if (EditorApplication.isCompiling)
            {
                EditorUtility.DisplayDialog(QConfigure.msgTitle, QConfigure.editorCompiling, QConfigure.ok);
                return;
            }
            var fileName = QConfigure.FilePath(QConfigure.UIBuildFileName);

            if (!QFileOperation.IsExists(fileName))
            {
                EditorUtility.DisplayDialog(QConfigure.msgTitle, QConfigure.notCreate, QConfigure.ok);
                return;
            }
            QFileOperation.WriteText(QConfigure.FilePath(QConfigure.UIBuildFileName), GetBuildUICode(), FileMode.Create);

            if (QConfigure.isCreateController)
            {
                QFileOperation.WriteText(QConfigure.FilePath(QConfigure.ControllerBuildFileName), GetControllerBuildCode(), FileMode.Create);
            }

            if (QConfigure.version == 1)
            {
                GetBindingInfo();
            }
            else
            {
                GetBindingInfoToJson();
            }
            QConfigure.Compiling();
            AssetDatabase.Refresh();
        }