//更新脚本 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 (!GFileOperation.IsExists(fileName)) { EditorUtility.DisplayDialog(GConfigure.msgTitle, GConfigure.notCreate, GConfigure.ok); return; } //重新更新BindUI文件 GFileOperation.WriteText(GConfigure.FilePath(GConfigure.UIBuildFileName), GetBuildUICode(), FileMode.Create); GetBindingInfo(); // if (GConfigure.Version == ScriptVersion.Mono) // { // GetBindingInfo(); // } // else // { // GetBindingInfoToJson(); // } GConfigure.Compiling(); AssetDatabase.Refresh(); }
private void OnTypeChanged(QVariableState state, string value) { state.Model.type = value; state.Model.name = GetName(string.Format("{0}{1}", GConfigure.GetShortTypeName(state.Model.type), GConfigure.RemoveFrontTypeName(target.name)), target); state.SetName(state.Model.name); state.Model.isUI = false; state.isSelectEvent = false; if (!IsUIType(state.Model.type)) { state.Model.eventType = state.Model.variableEvent = state.Model.actionName = state.Model.eventName = string.Empty; return; } var uiType = (UIType)Enum.Parse(typeof(UIType), state.Model.type); state.Model.variableEvent = string.Empty; switch (uiType) { case UIType.Button: state.Model.variableEvent = "onClick"; break; case UIType.InputField: state.Model.variableEvent = "onEndEdit"; break; case UIType.ScrollRect: case UIType.Dropdown: case UIType.Scrollbar: case UIType.Slider: case UIType.Toggle: state.Model.variableEvent = "onValueChanged"; break; } if (state.Model.variableEvent != string.Empty) { state.isSelectEvent = true; state.Model.eventType = parameters[(int)uiType]; state.Model.actionName = state.Model.variableEvent.Insert(state.Model.variableEvent.Length, state.attributeName); state.Model.eventName = GGlobalFun.GetFirstUpper(state.Model.actionName); } //Debug.LogError(state.Model.actionName + "---" + state.Model.variableEvent + "---" + state.attributeName); }
private void OnGUI() { if (GConfigure.selectTransform != Selection.activeTransform) { if (GConfigure.selectTransform != null) { m_Manager.Clear(); } GConfigure.selectTransform = Selection.activeTransform; if (GConfigure.selectTransform != null) { m_Manager.Init(); } if (Selection.gameObjects.Length == 1) { GConfigure.selectTransform = Selection.gameObjects[0].transform; if (GConfigure.selectTransform != null) { m_Manager.Init(); } } } EditorGUILayout.BeginHorizontal(); { DrawLeft(); DrawRight(); } EditorGUILayout.EndHorizontal(); if (!EditorApplication.isCompiling) { if (GConfigure.IsCompiling()) { m_Manager.Init(); } } }
// 创建脚本 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 (GFileOperation.IsExists(GConfigure.FilePath(GConfigure.UIBuildFileName))) { EditorUtility.DisplayDialog(GConfigure.msgTitle, GConfigure.haveBeenCreated, GConfigure.ok); return; } if (!GFileOperation.IsExists(GConfigure.FilePath(GConfigure.MainFileName))) { GFileOperation.WriteText(GConfigure.FilePath(GConfigure.MainFileName), GetMainCode()); } GFileOperation.WriteText(GConfigure.FilePath(GConfigure.UIBuildFileName), GetBuildUICode()); GetBindingInfo(); // if (GConfigure.Version == ScriptVersion.Mono) // { // GetBindingInfo(); // } // else // { // GetBindingInfoToJson(); // } GConfigure.Compiling(); AssetDatabase.Refresh(); }