private string GetName(string value, Transform tr) { var str = GGlobalFun.GetString(value); string name = str; int i = 1; while (true) { if (nameDic.ContainsKey(name)) { if (nameDic[name] == tr) { break; } name = string.Format("{0}{1}", str, i++); } else { break; } } nameDic[name] = tr; return(name); }
public string GetMainCode() { switch (GConfigure.Version) { case ScriptVersion.Mono: return(string.Format(GConfigure.uiCode_Mono, GGlobalFun.GetString(GConfigure.selectTransform.name), GConfigure.uicodeOnAwake)); case ScriptVersion.Panel: return(string.Format(GConfigure.uiCode_Panel, GGlobalFun.GetString(GConfigure.selectTransform.name), GConfigure.uicodeQarthPanel)); case ScriptVersion.AnimPanel: return(string.Format(GConfigure.uiCode_AnimPanel, GGlobalFun.GetString(GConfigure.selectTransform.name), GConfigure.uicodeQarthAnimPanel)); default: return(string.Format(GConfigure.uiCode_Mono, GGlobalFun.GetString(GConfigure.selectTransform.name), GConfigure.uicodeOnAwake)); } }
private static string GetMainFileName() { return(string.Format("{0}", GGlobalFun.GetString(Selection.activeTransform.name))); }
private static string GetFileName(string suffix) { return(string.Format("{0}/{1}_{0}", suffix, GGlobalFun.GetString(Selection.activeTransform.name))); }
public static string GetSelectObjectRootPath() { var path = string.Format("{0}/{1}/{2}/", Application.dataPath, referencePath, GGlobalFun.GetString(Selection.activeTransform.name)); return(path); }
public static string FilePath(string name) { var filePath = string.Format("{0}/{1}/{2}/{3}.cs", Application.dataPath, referencePath, GGlobalFun.GetString(Selection.activeTransform.name), name); if (!GFileOperation.IsDirctoryName(filePath, true)) { EditorUtility.DisplayDialog(msgTitle, "文件夹无法创建", "OK"); Debug.LogException(new Exception("文件夹无法创建")); } return(filePath); }
public string GetBuildUICode() { newAttribute.Length = attributeVariable.Length = function.Length = register.Length = variable.Length = assetNotNull.Length = controllerEvent.Length = attribute.Length = find.Length = 0; foreach (var value in dic.Values) { if (!value.state.isVariable) { continue; } variable.AppendFormat(GConfigure.variableFormat, value.type, value.state.attributeName); assetNotNull.AppendFormat(GConfigure.assetNotNull, value.state.attributeName); for (int i = 0; i < value.LstSubModel.Count; i++) { if (value.LstSubModel[i].state.isVariable) { variable.AppendFormat(GConfigure.variableFormat, value.LstSubModel[i].type, value.LstSubModel[i].state.attributeName); assetNotNull.AppendFormat(GConfigure.assetNotNull, value.LstSubModel[i].state.attributeName); } } if (isFind) { find.AppendFormat(GConfigure.findFormat, value.name, value.path, value.type); } // if (value.state.isAttribute) // { // attribute.AppendFormat(GConfigure.attributeFormat, value.type, value.state.attributeName); // assetNotNull.AppendFormat(GConfigure.assetNotNull, value.state.attributeName); // } // for (int i = 0; i < value.LstSubModel.Count; i++) // { // if (value.LstSubModel[i].state.isAttribute) // { // attribute.AppendFormat(GConfigure.attributeFormat, value.LstSubModel[i].type, value.LstSubModel[i].state.attributeName); // assetNotNull.AppendFormat(GConfigure.assetNotNull, value.state.attributeName); // } // } if (value.variableEvent != string.Empty && value.state.isEvent) { controllerEvent.AppendFormat(GConfigure.controllerEventFormat, value.IsButton() ? string.Empty : string.Format("<{0}>", value.eventType), value.GetActionMethodName()); register.AppendFormat(GConfigure.registerFormat, value.state.attributeName, value.variableEvent, value.GetEventMethodName()); function.AppendFormat(GConfigure.functionFormat, value.eventName, value.eventType + (!value.eventType.IsLengthZero() ? " value" : string.Empty), value.state.attributeName, value.actionName, value.IsButton() ? string.Empty : "value"); } for (int i = 0; i < value.LstSubModel.Count; i++) { if (value.LstSubModel[i].variableEvent != string.Empty && value.LstSubModel[i].state.isEvent) { controllerEvent.AppendFormat(GConfigure.controllerEventFormat, value.LstSubModel[i].IsButton() ? string.Empty : string.Format("<{0}>", value.LstSubModel[i].eventType), value.LstSubModel[i].GetActionMethodName()); register.AppendFormat(GConfigure.registerFormat, value.LstSubModel[i].state.attributeName, value.LstSubModel[i].variableEvent, value.LstSubModel[i].GetEventMethodName()); function.AppendFormat(GConfigure.functionFormat, value.LstSubModel[i].eventName, value.LstSubModel[i].eventType + (!value.LstSubModel[i].eventType.IsLengthZero() ? " value" : string.Empty), value.LstSubModel[i].state.attributeName, value.LstSubModel[i].actionName, value.LstSubModel[i].IsButton() ? string.Empty : "value"); } } } var tmp = string.Format(GConfigure.Version == ScriptVersion.Mono ? GConfigure.uiClassCode_Mono : GConfigure.uiClassCode, variable, attributeVariable, controllerEvent, attribute, assetNotNull, find, newAttribute, register, function); return(string.Format(GConfigure.uiCode_BindUI, GGlobalFun.GetString(GConfigure.selectTransform.name), tmp)); }