public static void DrawUpdateKeyTextField(IUIUpdate ui) { if (!(ui is Object)) { return; } Color oldColor = GUI.color; GUI.color = new Color(0.8f, 1f, 0.8f, 1); GUILayout.Space(5); string updateKey = EditorGUILayout.TextField("更新健", ui.updateKey); GUILayout.Space(5); GUI.color = oldColor; if (GUI.changed) { EditorTools.RegisterUndo(ui.GetType().ToString(), ui as Object); ui.updateKey = updateKey; EditorTools.SetDirty(ui as Object); } }
private static void DrawUpdateGroup(UIUpdateGroup uigroup, int tagidx, Color color) { if (uigroup == null) { return; } GUI.backgroundColor = color; GUILayout.BeginHorizontal(); GUILayout.Space(tagidx * 50); // EditorGUILayout.ObjectField (uigroup, uigroup.GetType (),false); GUI.contentColor = Color.white; EditorTools.DrawPingBox(uigroup, string.Format("{0} <{1}>", uigroup.updateKey, uigroup.GetType().Name)); GUILayout.EndHorizontal(); ++tagidx; for (int k = 0; k < uigroup.ListUpdateUI.Count; k++) { if (uigroup.ListUpdateUI [k] is UIUpdateGroup) { DrawUpdateGroup(uigroup.ListUpdateUI [k] as UIUpdateGroup, tagidx, color); } else { GUI.backgroundColor = color; GUILayout.BeginHorizontal(); GUILayout.Space(tagidx * 50); IUIUpdate ui = uigroup.ListUpdateUI[k] as IUIUpdate; if (ui != null) { EditorTools.DrawPingBox(uigroup.ListUpdateUI[k], string.Format("{0} <{1}>", ui.updateKey, ui.GetType().Name)); } else { GUI.backgroundColor = Color.grey; EditorTools.DrawPingBox(null, "<null>"); } GUILayout.EndHorizontal(); } } if (uigroup.MapDynamicUI != null) { ++tagidx; foreach (Object obj in uigroup.MapDynamicUI.Values) { if (obj is UIUpdateGroup) { DrawUpdateGroup(obj as UIUpdateGroup, tagidx, Color.red); } else { GUI.backgroundColor = color; GUILayout.BeginHorizontal(); GUILayout.Space(tagidx * 50); IUIUpdate ui = obj as IUIUpdate; if (ui != null) { EditorTools.DrawPingBox(obj, string.Format("{0} <{1}>", ui.updateKey, ui.GetType().Name)); } else { GUI.backgroundColor = Color.grey; EditorTools.DrawPingBox(null, "<null>"); } GUILayout.EndHorizontal(); } } } }