//public string GetPath(bool isGet) //{ // string path = gameObject.name; // Transform tsTp = gameObject.transform; // if (isGet) // { // while (tsTp.parent && !tsTp.parent.name.Equals(_root)) // { // path = path.Insert(0, tsTp.parent.name + "/"); // tsTp = tsTp.parent; // } // return "SetTransform(\"" + path + "\")"; // } // return ""; //} public static string GetBindDataName(UITool_Attribute item) { if (!string.IsNullOrEmpty(item.GenAttribute_BindData)) { return("BindModel(\"" + item.GenAttribute_BindData.Trim() + "\")"); } return(null); }
private void OnGUI_EditorItemAutoSetvalue(UITool_Attribute item, int index) { GUILayout.BeginHorizontal(); //var oc = GUI.color; //GUI.color = Color.green; GUILayout.Label("自动赋值,字段名:" + item.ToolTag_FieldName); GUILayout.EndHorizontal(); }
private void OnSaveButtonClick() { for (int i = 0; i < itemList.Count; i++) { UITool_Attribute item = itemList[i]; item.name = tpNameList[i]; item.GenAttribute_TranformPath = tpIsBindList[i]; item.GenAttribute_BindData = tpBindNameList[i]; } }
private void OnGUI_EditorRegistViewItem(UITool_Attribute item, int index) { GUILayout.BeginVertical(); OnGUI_EditorItemName(item, index); GUI.color = Color.white; OnGUI_EditorItemIsBindPath(item, index); OnGUI_EditorItemBindData(item, index); OnGUI_EditorItemAutoSetvalue(item, index); GUILayout.EndVertical(); Layout_DrawSeparator(Color.gray, 2); }
private void OnGUI_EditorItemBindData(UITool_Attribute item, int index) { GUILayout.BeginHorizontal(); string tpName = tpNameList[index]; GUILayout.Label("绑定数据:", GUILayout.Width(70)); GUI.color = item.GenAttribute_BindData == tpBindNameList[index] ? Color.white : Color.yellow; tpBindNameList[index] = GUILayout.TextField(tpBindNameList[index], GUILayout.Width(180)); if (GUILayout.Button("保存", GUILayout.Width(70))) { item.GenAttribute_BindData = tpBindNameList[index]; AssetDatabase.SaveAssets(); } GUILayout.EndHorizontal(); }
private void GetRegistViewItems(Transform ts, ref List <UITool_Attribute> itemList) { UITool_Attribute item = ts.GetComponent <UITool_Attribute>(); if (item) { itemList.Add(item); } if (ts.childCount > 0) { for (int i = 0; i < ts.childCount; i++) { GetRegistViewItems(ts.GetChild(i), ref itemList); } } }
private void OnGUI_EditorItemIsBindPath(UITool_Attribute item, int index) { GUILayout.BeginHorizontal(); GUI.color = item.GenAttribute_TranformPath == tpIsBindList[index] ? Color.white : Color.yellow; string tp = string.Format(" 自动设置节点:{0}", tpIsBindList[index] ? Editor_UITool.GetBindPath(item.gameObject, targetName) : ""); tpIsBindList[index] = GUILayout.Toggle(tpIsBindList[index], "", GUILayout.Width(10)); //var oc = GUI.color; //GUI.color = Color.green; GUILayout.Label(tp); //GUI.color = oc; if (GUILayout.Button("保存", GUILayout.Width(70))) { item.GenAttribute_TranformPath = tpIsBindList[index]; AssetDatabase.SaveAssets(); } GUILayout.EndHorizontal(); }
private void OnGUI_EditorItemName(UITool_Attribute item, int index) { GUILayout.BeginHorizontal(); string tpName = tpNameList[index]; int count = (tpNameList.GroupBy(x => x).Where(x => x.Count() > 1)).Where(x => x.Key == tpName).ToList() .Count(); GUI.color = count > 0 ? Color.red : Color.white; if (GUI.color != Color.red) { GUI.color = item.name == tpNameList[index] ? Color.white : Color.yellow; } GUILayout.Label("Name:", GUILayout.Width(50)); tpNameList[index] = GUILayout.TextField(tpNameList[index], GUILayout.Width(200)); if (GUILayout.Button("保存", GUILayout.Width(70))) { item.name = tpNameList[index]; AssetDatabase.SaveAssets(); } GUILayout.EndHorizontal(); }