public override void OnInspectorGUI() { base.OnInspectorGUI(); CText text = target as CText; GUI.changed = false; if (text.font != null) { NGUILinkEditor.RegisterUndo("CImage Change", text); if (string.IsNullOrEmpty(text.FontName) || text.FontName != text.font.name) { text.FontName = text.font.name; } } EditorGUILayout.LabelField("预制颜色"); if (null != colors && colors.Length > 0) { //text.color = GetColor("", text.colorIdx); for (int i = 0; i < colors.Length; i++) { if (i % 4 == 0) { EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); } GUIStyle myStyle = GUI.skin.box; myStyle.fontStyle = FontStyle.Bold; myStyle.normal.textColor = GetColor("", i); myStyle.fixedWidth = 80; if (GUILayout.Button(colors[i], myStyle)) { if (text) { text.colorIdx = i; //text.color = GetColor("", text.colorIdx); //SetStyle(text, 1); //SetStyle(text); SetTextColorFromColorText(text, colors[i]); } } } } EditorUtility.SetDirty(text); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); CImage image = target as CImage; GUI.changed = false; if (image.sprite != null) { NGUILinkEditor.RegisterUndo("CImage Change", image); if (string.IsNullOrEmpty(image.SpriteName) || image.SpriteName != image.sprite.name) { image.SpriteName = image.sprite.name; } if (string.IsNullOrEmpty(image.AtlasName) || image.AtlasName != image.sprite.texture.name.ToLower()) { image.AtlasName = image.sprite.texture.name.ToLower(); } } EditorUtility.SetDirty(image); }