add
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.Collections;
|
||||
|
||||
#if UNITY_3_5
|
||||
[CustomEditor(typeof(UIRichText4Chat))]
|
||||
#else
|
||||
[CustomEditor(typeof(UIRichText4Chat), true)]
|
||||
#endif
|
||||
public class UIRichText4ChatInspector : Editor {
|
||||
|
||||
UIRichText4Chat richText4Chat;
|
||||
public override void OnInspectorGUI ()
|
||||
{
|
||||
richText4Chat = target as UIRichText4Chat;
|
||||
GUILayout.BeginHorizontal();
|
||||
if (NGUIEditorTools.DrawPrefixButton ("Face Atlas")) {
|
||||
ComponentSelector.Show<UIAtlas> (OnSelectAtlas);
|
||||
}
|
||||
SerializedProperty atlas = NGUIEditorTools.DrawProperty("", serializedObject, "faceAtlas", GUILayout.MinWidth(20f));
|
||||
if (atlas != null) {
|
||||
UIAtlas atl = atlas.objectReferenceValue as UIAtlas;
|
||||
if(atl != richText4Chat.faceAtlas) {
|
||||
Debug.Log(atl.name);
|
||||
richText4Chat.faceAtlas = atl;
|
||||
richText4Chat.atlasName = atl.name;
|
||||
}
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Edit", GUILayout.Width(40f)))
|
||||
{
|
||||
if (atlas != null)
|
||||
{
|
||||
UIAtlas atl = atlas.objectReferenceValue as UIAtlas;
|
||||
NGUISettings.atlas = atl;
|
||||
NGUIEditorTools.Select(atl.gameObject);
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
DrawDefaultInspector ();
|
||||
}
|
||||
|
||||
void OnSelectAtlas (Object obj)
|
||||
{
|
||||
Debug.Log (obj.name);
|
||||
serializedObject.Update();
|
||||
SerializedProperty sp = serializedObject.FindProperty("faceAtlas");
|
||||
sp.objectReferenceValue = obj;
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
sp = serializedObject.FindProperty("atlasName"); // add by chenbin
|
||||
sp.stringValue = obj.name; // add by chenbin
|
||||
serializedObject.ApplyModifiedProperties(); // add by chenbin
|
||||
|
||||
NGUITools.SetDirty(serializedObject.targetObject);
|
||||
NGUISettings.atlas = obj as UIAtlas;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5be76ad9e40b34277ab6eb7c822df9df
|
||||
timeCreated: 1458617527
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user