This commit is contained in:
2020-07-04 14:41:25 +08:00
parent 70c346d2c1
commit a8f02e4da5
3748 changed files with 587372 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
using UnityEngine;
using System.Collections;
using UnityEditor;
using System.IO;
using Coolape;
[CanEditMultipleObjects]
[CustomEditor (typeof(CLBaseLua), true)]
public class CLBaseLuaInspector :Editor
{
private CLBaseLua instance;
Object luaAsset = null;
public override void OnInspectorGUI ()
{
instance = target as CLBaseLua;
DrawDefaultInspector ();
if (instance != null) {
init ();
drawLuaInfor();
}
}
public void drawLuaInfor()
{
instance = target as CLBaseLua;
ECLEditorUtl.BeginContents();
{
GUILayout.BeginHorizontal();
{
EditorGUILayout.LabelField("Lua Text", GUILayout.Width(100));
luaAsset = EditorGUILayout.ObjectField(luaAsset, typeof(UnityEngine.Object), GUILayout.Width(125));
}
GUILayout.EndHorizontal();
string luaPath = AssetDatabase.GetAssetPath(luaAsset);
// if(!string.IsNullOrEmpty(luaPath)) {
instance.luaPath = Utl.filterPath(luaPath);
// }
EditorUtility.SetDirty(instance);
GUI.contentColor = Color.yellow;
EditorGUILayout.LabelField("注意绑定的lua要求返回luatable");
GUI.contentColor = Color.white;
}
ECLEditorUtl.EndContents();
}
bool isFinishInit = false;
void init ()
{
if (!isFinishInit || luaAsset == null) {
isFinishInit = true;
if (!string.IsNullOrEmpty (instance.luaPath)) {
string tmpPath = instance.luaPath.Replace ("/upgradeRes", "/upgradeRes4Dev");
luaAsset = AssetDatabase.LoadMainAssetAtPath ("Assets/" + tmpPath);
}
}
}
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d929109f9a91141bb9d52c40dabd4624
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@@ -0,0 +1,14 @@
using UnityEngine;
using System.Collections;
using UnityEditor;
using System.IO;
using Coolape;
[CustomEditor (typeof(CLBehaviour4Lua), true)]
public class CLBehaviour4LuaInspector :CLBaseLuaInspector
{
public override void OnInspectorGUI ()
{
base.OnInspectorGUI ();
}
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 912f97c50f2824ff98ad25977ec13b13
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@@ -0,0 +1,14 @@
using UnityEngine;
using System.Collections;
using UnityEditor;
using System.IO;
using Coolape;
[CustomEditor (typeof(CLBehaviourWithUpdate4Lua), true)]
public class CLBehaviourWithUpdate4LuaInspector :CLBaseLuaInspector
{
public override void OnInspectorGUI ()
{
base.OnInspectorGUI ();
}
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 95421440f7bf647b2a3cc05b9dd9a869
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@@ -0,0 +1,25 @@
using UnityEngine;
using System.Collections;
using UnityEditor;
using System.IO;
using Coolape;
//页面视图
[CustomEditor (typeof(CLCellLua), true)]
public class CLCellLuaInspector : CLBehaviour4LuaInspector
{
CLCellLua cell;
public override void OnInspectorGUI ()
{
cell = target as CLCellLua;
base.OnInspectorGUI ();
if (GUILayout.Button ("Reset Atlas & Font")) {
if (cell.isNeedResetAtlase) {
// CLUIInit.self.init ();
CLUIUtl.resetAtlasAndFont (cell.transform, false);
// CLUIInit.self.clean ();
}
}
}
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 193dd3695c6224bd992c45c4e768593c
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@@ -0,0 +1,174 @@
using UnityEngine;
using System.Collections;
using UnityEditor;
using System.IO;
using Coolape;
//页面视图
[CustomEditor(typeof(CLPanelLua), true)]
public class CLPanelLuaInspector : CLBehaviour4LuaInspector
{
private CLPanelLua panel;
Object panelData;
Object frameObj;
bool _isFinishInit = false;
public override void OnInspectorGUI()
{
panel = target as CLPanelLua;
panel.isNeedMask4Init = EditorGUILayout.Toggle ("Is Need Mask 4 Show", panel.isNeedMask4Init);
if (panel.isNeedMask4Init) {
panel.isNeedMask4InitOnlyOnce = EditorGUILayout.Toggle (" Only First Show", panel.isNeedMask4InitOnlyOnce);
}
base.OnInspectorGUI();
init();
GUILayout.BeginHorizontal();
{
EditorGUILayout.LabelField("背景框", GUILayout.Width(100));
frameObj = EditorGUILayout.ObjectField(frameObj, typeof(UnityEngine.Object), GUILayout.Width(125));
}
GUILayout.EndHorizontal();
string path = AssetDatabase.GetAssetPath(frameObj);
panel.frameName = Path.GetFileNameWithoutExtension(path);
EditorUtility.SetDirty(panel);
if (GUILayout.Button("增加渐显缩放效果"))
{
//instance.EffectList.Count
TweenScale ts = panel.gameObject.AddComponent<TweenScale>();
ts.from = Vector3.one * 1.5f;
ts.to = Vector3.one;
ts.duration = 0.5f;
ts.method = UITweener.Method.EaseInOut;
ts.enabled = false;
panel.EffectList.Add(ts);
TweenAlpha ta = panel.gameObject.AddComponent<TweenAlpha>();
ta.from = 0.1f;
ta.to = 1;
ta.duration = 0.5f;
ta.method = UITweener.Method.EaseInOut;
ta.enabled = false;
panel.EffectList.Add(ta);
panel.effectType = CLPanelBase.EffectType.synchronized;
EditorUtility.SetDirty(panel);
}
if (GUILayout.Button("增加渐显左移效果"))
{
//instance.EffectList.Count
TweenPosition ts = panel.gameObject.AddComponent<TweenPosition>();
ts.from = Vector3.left * 1920;
ts.to = Vector3.zero;
ts.duration = 0.5f;
ts.method = UITweener.Method.EaseInOut;
ts.enabled = false;
panel.EffectList.Add(ts);
TweenAlpha ta = panel.gameObject.AddComponent<TweenAlpha>();
ta.from = 0.1f;
ta.to = 1;
ta.duration = 0.5f;
ta.method = UITweener.Method.EaseInOut;
ta.enabled = false;
panel.EffectList.Add(ta);
panel.effectType = CLPanelBase.EffectType.synchronized;
EditorUtility.SetDirty(panel);
}
if (GUILayout.Button("增加渐显下移效果"))
{
//instance.EffectList.Count
TweenPosition ts = panel.gameObject.AddComponent<TweenPosition>();
ts.from = Vector3.up * 1080;
ts.to = Vector3.zero;
ts.duration = 0.5f;
ts.method = UITweener.Method.EaseInOut;
ts.enabled = false;
panel.EffectList.Add(ts);
TweenAlpha ta = panel.gameObject.AddComponent<TweenAlpha>();
ta.from = 0.1f;
ta.to = 1;
ta.duration = 0.5f;
ta.method = UITweener.Method.EaseInOut;
ta.enabled = false;
panel.EffectList.Add(ta);
panel.effectType = CLPanelBase.EffectType.synchronized;
EditorUtility.SetDirty(panel);
}
NGUIEditorTools.BeginContents();
{
GUILayout.Space(3);
// if (GUILayout.Button("Reload Lua")) {
// reloadLua();
// }
if (GUILayout.Button("Reset Atlas & Font")) {
if (panel.isNeedResetAtlase) {
// CLUIInit.self.init ();
CLUIUtl.resetAtlasAndFont(panel.transform, false);
// CLUIInit.self.clean();
}
}
if (GUILayout.Button("Save Panel 2 U3dType")) {
saveToU3d();
}
}
NGUIEditorTools.EndContents();
GUILayout.Space(5);
}
void reloadLua()
{
panel.setLua();
}
void saveToU3d()
{
GameObject go = AssetDatabase.LoadAssetAtPath("Assets/" + CLPathCfg.self.basePath + "/upgradeRes4Dev/priority/ui/panel/" + panel.name + ".prefab", typeof(GameObject)) as GameObject;
doSaveAsset(go);
EditorUtility.DisplayDialog("success", "cuccess!", "Okey");
}
public static void doSaveAsset(GameObject go)
{
CLPanelBase panel = go.GetComponent<CLPanelBase>();
if (panel == null)
return;
Debug.Log(panel.name);
if (panel.isNeedResetAtlase) {
CLUIUtl.resetAtlasAndFont(panel.transform, true);
PrefabUtility.SavePrefabAsset(go);
}
string dir = Application.dataPath + "/" + ECLEditorUtl.getPathByObject(go);
dir = Path.GetDirectoryName(dir);
ECLCreatAssetBundle4Update.createAssets4Upgrade(dir, panel.gameObject, true);
// 必须再取一次好像执行了上面一句方法后cell就会变成null
panel = go.GetComponent<CLPanelBase>();
if (panel != null && panel.isNeedResetAtlase) {
CLUIUtl.resetAtlasAndFont(panel.transform, false);
PrefabUtility.SavePrefabAsset(go);
}
}
void init()
{
if (!_isFinishInit || frameObj == null)
{
_isFinishInit = true;
if (!string.IsNullOrEmpty(panel.frameName))
{
string tmpPath = PStr.b().a("Assets/").a(CLPathCfg.self.basePath).a("/upgradeRes4Dev/priority/ui/other/").a(panel.frameName).a(".prefab").e();
frameObj = AssetDatabase.LoadMainAssetAtPath(tmpPath);
}
}
}
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d050f2ce2bcfc403ba2e81db8029189b
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@@ -0,0 +1,45 @@
using UnityEngine;
using System.Collections;
using UnityEditor;
using System.IO;
using Coolape;
//页面视图
using System.Collections.Generic;
[CustomEditor (typeof(CLPathCfg), true)]
public class CLPathCfgInspector : Editor
{
CLPathCfg instance;
public override void OnInspectorGUI ()
{
instance = target as CLPathCfg;
NGUIEditorTools.BeginContents ();
{
GUILayout.Space (3);
GUILayout.BeginHorizontal ();
{
GUILayout.Label ("Project Name");
instance.basePath = EditorGUILayout.TextField (instance.basePath);
if (GUILayout.Button ("Reset Path")) {
resetPath ();
EditorUtility.SetDirty (instance);
}
}
GUILayout.EndHorizontal ();
}
NGUIEditorTools.EndContents ();
DrawDefaultInspector ();
}
public void resetPath ()
{
instance.resetPath (instance.basePath);
}
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 88209f531e5254c7eb765da46f404226
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@@ -0,0 +1,64 @@
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using Coolape;
public class CLPrefabLightmapDataEditor : Editor
{
// 把renderer上面的lightmap信息保存起来以便存储到prefab上面
public static void SaveLightmapInfo ()
{
GameObject go = Selection.activeGameObject;
if (go == null) {
EditorUtility.DisplayDialog("Alert", "Please select a gameObject!", "Okey");
return;
}
CLPrefabLightmapData data = go.GetComponent<CLPrefabLightmapData>();
if (data == null) {
data = go.AddComponent<CLPrefabLightmapData>();
}
data.SaveLightmap();
EditorUtility.SetDirty(go);
}
// 把保存的lightmap信息恢复到renderer上面
public static void LoadLightmapInfo()
{
GameObject go = Selection.activeGameObject;
if (go == null) {
EditorUtility.DisplayDialog("Alert", "Please select a gameObject!", "Okey");
return;
}
CLPrefabLightmapData data = go.GetComponent<CLPrefabLightmapData>();
if (data == null) {
EditorUtility.DisplayDialog("Alert", "Can't find [CLPrefabLightmapData] component!", "Okey");
return;
}
data.LoadLightmap();
EditorUtility.SetDirty(go);
}
public static void ClearLightmapInfo()
{
GameObject go = Selection.activeGameObject;
if (go == null) {
EditorUtility.DisplayDialog("Alert", "Please select a gameObject!", "Okey");
return;
}
CLPrefabLightmapData data = go.GetComponent<CLPrefabLightmapData>();
if (data == null) {
EditorUtility.DisplayDialog("Alert", "Can't find [CLPrefabLightmapData] component!", "Okey");
return;
}
data.m_RendererInfo.Clear();
data.m_Lightmaps = null;
EditorUtility.SetDirty(go);
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: ab953b7471ece451a9f363214019840e
timeCreated: 1447747442
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,101 @@
using UnityEditor;
using UnityEngine;
using System.Collections;
using Coolape;
using System.Collections.Generic;
[CustomEditor (typeof(CLRoleAction), true)]
public class CLRoleActionInspector : Editor
{
CLRoleAction roleAction;
CLEffect effect;
CLRoleAction.Action action = CLRoleAction.Action.idel;
static List<int> pausePersent = new List<int> ();
static int onePersent = 100;
static int index = 0;
void onActionCallback (params object[] args)
{
roleAction.pause ();
}
void onFinishActionCallback (params object[] args)
{
roleAction.regain ();
roleAction.setAction (CLRoleAction.Action.idel, null);
}
public override void OnInspectorGUI ()
{
base.OnInspectorGUI ();
NGUIEditorTools.BeginContents ();
{
roleAction = (CLRoleAction)target;
GUILayout.BeginHorizontal ();
{
action = (CLRoleAction.Action)EditorGUILayout.EnumPopup ("Action", action);
if (GUILayout.Button ("Play")) {
roleAction.regain ();
index = 0;
if (pausePersent.Count == 0)
return;
Callback cb = onActionCallback;
Hashtable cbs = new Hashtable ();
for (int i = 0; i < pausePersent.Count; i++) {
cbs [pausePersent [i]] = cb;
}
cbs [100] = (Callback)onFinishActionCallback;
roleAction.setAction (action, cbs);
if (effect != null) {
effect.gameObject.SetActive (true);
}
}
if (GUILayout.Button ("Continue")) {
index++;
roleAction.regain ();
if (index > pausePersent.Count) {
index = 0;
roleAction.setAction (CLRoleAction.Action.idel, null);
return;
}
}
}
GUILayout.EndHorizontal ();
GUILayout.BeginHorizontal ();
{
EditorGUILayout.LabelField ("Effect object");
effect = (CLEffect)(EditorGUILayout.ObjectField (effect, typeof(CLEffect)));
}
GUILayout.EndHorizontal ();
for (int i = 0; i < pausePersent.Count; i++) {
GUILayout.BeginHorizontal ();
{
pausePersent [i] = EditorGUILayout.IntField (pausePersent [i], GUILayout.Width (100));
if (GUILayout.Button ("-")) {
pausePersent.RemoveAt (i);
break;
}
}
GUILayout.EndHorizontal ();
}
GUILayout.BeginHorizontal ();
{
onePersent = EditorGUILayout.IntField (onePersent, GUILayout.Width (100));
if (GUILayout.Button ("+")) {
onePersent = 100;
pausePersent.Add (onePersent);
return;
}
}
GUILayout.EndHorizontal ();
}
NGUIEditorTools.EndContents ();
}
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bcae1a1ef38b746ac8976575d8877c90
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@@ -0,0 +1,395 @@
using UnityEngine;
using System.Collections;
using UnityEditor;
using System.IO;
using Coolape;
using System.Collections.Generic;
[CustomEditor (typeof(CLRoleAvata), true)]
public class CLRoleAvataInspector : CLBehaviour4LuaInspector
{
CLRoleAvata avata;
private static bool isShowNewBodyPart = false;
private static CLBodyPart newBodyPart = new CLBodyPart ();
private static string cellName = "";
private static GameObject onePartObj;
private static Material material;
private static int selectedPartindex = -1;
private string testPartName = "";
private string testCellName = "";
static bool isShowBones = false;
static bool isAddBones = false;
static string addBoneName = "";
static Transform addBone;
public override void OnInspectorGUI ()
{
avata = (CLRoleAvata)target;
ECLEditorUtl.BeginContents ();
{
if (isAddBones || isShowBones) {
GUILayout.BeginHorizontal ();
{
EditorGUILayout.LabelField ("Bone Name", GUILayout.Width (100));
EditorGUILayout.LabelField ("Bone Transform", GUILayout.Width (150));
}
GUILayout.EndHorizontal ();
}
if (isShowBones) {
for (int i = 0; i < avata.bonesNames.Count; i++) {
GUILayout.BeginHorizontal ();
{
EditorGUILayout.TextField (avata.bonesNames [i], GUILayout.Width (100));
EditorGUILayout.ObjectField (avata.bonesList [i], typeof(Transform), GUILayout.Width (150));
if (GUILayout.Button ("-")) {
if (EditorUtility.DisplayDialog ("Confirm", "确定要删除?", "Okay", "Cancel")) {
avata.bonesNames.RemoveAt (i);
avata.bonesList.RemoveAt (i);
EditorUtility.SetDirty (avata);
break;
}
}
}
GUILayout.EndHorizontal ();
}
}
if (isAddBones) {
GUILayout.BeginHorizontal ();
{
addBoneName = EditorGUILayout.TextField (addBoneName, GUILayout.Width (100));
addBone = (Transform)(EditorGUILayout.ObjectField (addBone, typeof(Transform), GUILayout.Width (150)));
if (GUILayout.Button ("+")) {
if (string.IsNullOrEmpty (addBoneName)) {
EditorUtility.DisplayDialog ("Confirm", "Bone Name can not null", "Okay");
return;
}
if (avata.bonesMap.ContainsKey (addBoneName)) {
EditorUtility.DisplayDialog ("Confirm", "Bone Name allready exsit, please check then name Uniqueness", "Okay");
return;
}
if (addBone == null) {
EditorUtility.DisplayDialog ("Confirm", "Bone can not null", "Okay");
return;
}
avata.bonesNames.Add (addBoneName);
avata.bonesList.Add (addBone);
avata.bonesMap [addBoneName] = addBone;
EditorUtility.SetDirty (avata);
addBone = null;
addBoneName = "";
}
}
GUILayout.EndHorizontal ();
}
GUILayout.BeginHorizontal ();
{
if (GUILayout.Button (isShowBones ? "Hide Bones" : "Show Bones")) {
isShowBones = !isShowBones;
}
if (GUILayout.Button ("Add Bones")) {
isAddBones = true;
}
}
GUILayout.EndHorizontal ();
}
ECLEditorUtl.EndContents ();
ECLEditorUtl.BeginContents ();
{
if (avata.bodyPartNames != null) {
for (int i = 0; i < avata.bodyPartNames.Count; i++) {
GUILayout.BeginHorizontal ();
{
if (selectedPartindex == i) {
GUI.color = Color.yellow;
}
if (GUILayout.Button (avata.bodyPartNames [i])) {
selectedPartindex = i;
isShowNewBodyPart = false;
}
GUI.color = Color.white;
if (GUILayout.Button ("-", GUILayout.Width (30))) {
if (EditorUtility.DisplayDialog ("Confirm", "确定要删除?", "Okay", "Cancel")) {
avata.bodyPartNames.RemoveAt (i);
break;
}
}
}
GUILayout.EndHorizontal ();
if (selectedPartindex == i) {
avata.bodyParts [i] = showOnePart (avata.bodyParts [i], false);
}
}
}
if (isShowNewBodyPart) {
newBodyPart = newBodyPart == null ? new CLBodyPart () : newBodyPart;
newBodyPart = showOnePart (newBodyPart, true);
GUILayout.BeginHorizontal ();
{
if (GUILayout.Button ("Clean")) {
newBodyPart.cellNames.Clear ();
// newBodyPart.materials.Clear ();
newBodyPart.materialNames.Clear ();
newBodyPart.partObjs.Clear ();
newBodyPart.animatorControllers.Clear ();
cellName = "";
onePartObj = null;
}
if (GUILayout.Button ("Save Body Part")) {
doAddBodyPart ();
}
}
GUILayout.EndHorizontal ();
}
if (GUILayout.Button ("Add Body Part")) {
selectedPartindex = -1;
newBodyPart = new CLBodyPart ();
isShowNewBodyPart = true;
}
}
ECLEditorUtl.EndContents ();
testPartName = EditorGUILayout.TextField ("Part Name", testPartName);
testCellName = EditorGUILayout.TextField ("Cell Name", testCellName);
if (GUILayout.Button ("test")) {
avata.setMapindex ();
avata.switch2xx (testPartName, testCellName);
}
if (GUILayout.Button ("clean Material")) {
avata.cleanMaterial ();
}
if (GUILayout.Button ("set Default Material")) {
avata.setDefaultMaterial ();
}
}
CLBodyPart showOnePart (CLBodyPart aBodyPart, bool isNew)
{
NGUIEditorTools.BeginContents ();
{
if (isNew) {
GUI.color = Color.red;
EditorGUILayout.LabelField ("新增一个部位", GUILayout.Width (200));
GUI.color = Color.yellow;
} else {
GUI.color = Color.white;
}
GUILayout.BeginHorizontal ();
{
EditorGUILayout.LabelField ("身体部位", GUILayout.Width (100));
aBodyPart.partName = GUILayout.TextField (aBodyPart.partName);
}
GUILayout.EndHorizontal ();
//=========================
GUILayout.BeginHorizontal ();
{
EditorGUILayout.LabelField ("换装方式", GUILayout.Width (100));
aBodyPart.switchType = (CLSwitchType)EditorGUILayout.EnumPopup ("", aBodyPart.switchType);
}
GUILayout.EndHorizontal ();
//=========================
EditorGUILayout.LabelField ("该部位中所有部件(" + aBodyPart.cellNames.Count + ")", GUILayout.Width (150));
if (aBodyPart.switchType == CLSwitchType.showOrHide) {
NGUIEditorTools.BeginContents ();
{
if (aBodyPart.cellNames.Count > 0) {
GUILayout.BeginHorizontal ();
{
EditorGUILayout.LabelField ("名字Key", GUILayout.Width (100));
EditorGUILayout.LabelField ("部件(GameObject)");
}
GUILayout.EndHorizontal ();
}
for (int i = 0; i < aBodyPart.cellNames.Count; i++) {
GUILayout.BeginHorizontal ();
{
aBodyPart.cellNames [i] = EditorGUILayout.TextField (aBodyPart.cellNames [i], GUILayout.Width (100));
aBodyPart.partObjs [i] = (GameObject)(EditorGUILayout.ObjectField (aBodyPart.partObjs [i], typeof(GameObject)));
if (GUILayout.Button ("-")) {
aBodyPart.cellNames.RemoveAt (i);
aBodyPart.partObjs.RemoveAt (i);
break;
}
}
GUILayout.EndHorizontal ();
//=========================
}
GUILayout.BeginHorizontal ();
{
cellName = EditorGUILayout.TextField (cellName, GUILayout.Width (100));
onePartObj = (GameObject)(EditorGUILayout.ObjectField (onePartObj, typeof(GameObject)));
if (cellName == "" && onePartObj != null) {
cellName = onePartObj.name;
}
if (GUILayout.Button ("+")) {
if (string.IsNullOrEmpty (cellName) || onePartObj == null) {
EditorUtility.DisplayDialog ("Alert", "名字和对象不能为空!", "ok");
} else {
aBodyPart.cellNames.Add (cellName);
aBodyPart.partObjs.Add (onePartObj);
cellName = "";
onePartObj = null;
}
}
}
GUILayout.EndHorizontal ();
//=========================
}
NGUIEditorTools.EndContents ();
//=========================
} else if (aBodyPart.switchType == CLSwitchType.switchShader) {
GUILayout.BeginHorizontal ();
{
EditorGUILayout.LabelField ("Render(渲染器)", GUILayout.Width (100));
aBodyPart.render = (Renderer)(EditorGUILayout.ObjectField (aBodyPart.render, typeof(Renderer)));
}
GUILayout.EndHorizontal ();
//=========================
NGUIEditorTools.BeginContents ();
{
if (aBodyPart.cellNames.Count > 0) {
GUILayout.BeginHorizontal ();
{
EditorGUILayout.LabelField ("名字Key", GUILayout.Width (100));
EditorGUILayout.LabelField ("部件(Material)");
}
GUILayout.EndHorizontal ();
}
for (int i = 0; i < aBodyPart.cellNames.Count; i++) {
GUILayout.BeginHorizontal ();
{
aBodyPart.cellNames [i] = EditorGUILayout.TextField (aBodyPart.cellNames [i], GUILayout.Width (100));
Material mat = null;
if (aBodyPart.materialNames.Count > i) {
mat = (Material)(EditorGUILayout.ObjectField (getMat (aBodyPart.materialNames [i]), typeof(Material)));
} else {
aBodyPart.materialNames = new List<string> (aBodyPart.cellNames.Count);
mat = (Material)(EditorGUILayout.ObjectField (mat, typeof(Material)));
}
if (mat != null) {
aBodyPart.materialNames [i] = getMatName (mat);
}
if (GUILayout.Button ("-")) {
aBodyPart.cellNames.RemoveAt (i);
// aBodyPart.materials.RemoveAt (i);
aBodyPart.materialNames.RemoveAt (i);
break;
}
}
GUILayout.EndHorizontal ();
//=========================
}
GUILayout.BeginHorizontal ();
{
cellName = EditorGUILayout.TextField (cellName, GUILayout.Width (100));
material = (Material)(EditorGUILayout.ObjectField (material, typeof(Material)));
if (cellName == "" && material != null) {
cellName = material.name;
}
if (GUILayout.Button ("+")) {
if (string.IsNullOrEmpty (cellName) || material == null) {
EditorUtility.DisplayDialog ("Alert", "名字和对象不能为空!", "ok");
} else {
aBodyPart.cellNames.Add (cellName);
aBodyPart.materialNames.Add (getMatName (material));
cellName = "";
material = null;
}
}
}
GUILayout.EndHorizontal ();
//=========================
}
NGUIEditorTools.EndContents ();
}
GUILayout.BeginHorizontal ();
{
EditorGUILayout.LabelField ("是否需要换动作", GUILayout.Width (100));
aBodyPart.needSwitchController = EditorGUILayout.Toggle (aBodyPart.needSwitchController);
}
GUILayout.EndHorizontal ();
if (aBodyPart.needSwitchController) {
if (aBodyPart.cellNames.Count > 0) {
GUILayout.BeginHorizontal ();
{
EditorGUILayout.LabelField ("名字Key", GUILayout.Width (100));
EditorGUILayout.LabelField ("部件(AnimatorController)");
}
GUILayout.EndHorizontal ();
}
for (int i = aBodyPart.animatorControllers.Count; i < aBodyPart.cellNames.Count; i++) {
aBodyPart.animatorControllers.Add (null);
}
for (int i = 0; i < aBodyPart.cellNames.Count; i++) {
GUILayout.BeginHorizontal ();
{
EditorGUILayout.LabelField (aBodyPart.cellNames [i], GUILayout.Width (100));
aBodyPart.animatorControllers [i] = (RuntimeAnimatorController)(EditorGUILayout.ObjectField (aBodyPart.animatorControllers [i], typeof(RuntimeAnimatorController)));
}
GUILayout.EndHorizontal ();
}
}
}
NGUIEditorTools.EndContents ();
GUI.color = Color.white;
return aBodyPart;
}
void doAddBodyPart ()
{
if (string.IsNullOrEmpty (newBodyPart.partName)) {
EditorUtility.DisplayDialog ("Alert", "身体部位名称不能为空!", "ok");
return;
}
if (newBodyPart.switchType == CLSwitchType.showOrHide) {
if (newBodyPart.partObjs.Count <= 0) {
EditorUtility.DisplayDialog ("Alert", "没有部件可保存!", "ok");
return;
}
newBodyPart.materialNames.Clear ();
} else if (newBodyPart.switchType == CLSwitchType.switchShader) {
if (newBodyPart.materialNames.Count <= 0) {
EditorUtility.DisplayDialog ("Alert", "没有部件可保存!", "ok");
return;
}
newBodyPart.partObjs.Clear ();
}
avata.bodyPartNames.Add (newBodyPart.partName);
avata.bodyParts.Add (newBodyPart);
Debug.LogError ("newBodyPart.materialNames.Count==" + newBodyPart.materialNames.Count);
Debug.LogError ("newBodyPart.partObjs.Count==" + newBodyPart.partObjs.Count);
EditorUtility.SetDirty (avata);
newBodyPart = null;
isShowNewBodyPart = false;
}
string getMatName (Material mat)
{
string materialPath = ECLEditorUtl.getPathByObject (mat);
materialPath = materialPath.Replace (CLPathCfg.self.basePath + "/upgradeRes4Dev/other/Materials/", "");
materialPath = materialPath.Replace (".mat", "");
materialPath = materialPath.Replace ("/", ".");
return materialPath;
}
Material getMat (string matName)
{
if (string.IsNullOrEmpty (matName))
return null;
string path = "Assets/" + CLPathCfg.self.basePath + "/upgradeRes4Dev/other/Materials/" + matName.Replace(".", "/") + ".mat";
Material mat = AssetDatabase.LoadAssetAtPath (path, typeof(Material)) as Material;
return mat;
}
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 07024c7af43aa47bcb97fe4a4e15ed98
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@@ -0,0 +1,432 @@
using UnityEditor;
using UnityEngine;
using System.Collections;
using Coolape;
using System.Collections.Generic;
using System.IO;
using UnityEditorHelper;
[CustomEditor (typeof(CLSharedAssets), true)]
public class CLSharedAssetsInspector : Editor
{
CLSharedAssets instance;
bool state1 = true;
bool state2 = true;
string tabName = "";
static Hashtable MaterialMap = new Hashtable ();
static Hashtable MeshMap = new Hashtable ();
void OnEnable ()
{
instance = target as CLSharedAssets;
EditorPrefs.SetBool("CLS0", EventDelegate.IsValid(instance.onFinshLoad));
}
public override void OnInspectorGUI ()
{
instance = target as CLSharedAssets;
ECLEditorUtl.BeginContents ();
{
GUI.color = Color.yellow;
instance.isDonnotResetAssets = EditorGUILayout.Toggle ("is Donnot Reset Assets", instance.isDonnotResetAssets);
instance.isSkipModel = EditorGUILayout.Toggle ("is Skip Manage Model", instance.isSkipModel);
GUI.color = Color.white;
}
ECLEditorUtl.EndContents ();
if (state1) {
tabName = "Click Close Materials";
} else {
tabName = "Click Open Materials";
}
using (new FoldableBlock (ref state1, tabName, null)) {
if (state1) {
for (int i = 0; i < instance.materials.Count; i++) {
ECLEditorUtl.BeginContents ();
{
GUILayout.BeginHorizontal ();
{
EditorGUILayout.ObjectField ("Render", (Object)(instance.materials [i].render), typeof(Renderer), true);
GUI.color = Color.red;
if (GUILayout.Button ("Delete", GUILayout.Width (60))) {
if (EditorUtility.DisplayDialog ("Alert", "Really want to delete?", "Okay", "Cancel")) {
instance.materials.RemoveAt (i);
break;
}
}
GUI.color = Color.white;
}
GUILayout.EndHorizontal ();
// EditorGUILayout.IntField ("Index", instance.materials [i].index);
EditorGUILayout.TextField ("Material Name", instance.materials [i].materialName);
EditorGUILayout.ObjectField ("Material", (Object)(getMaterial (instance.materials [i].materialName)), typeof(Material), true);
}
ECLEditorUtl.EndContents ();
}
}
}
if (state2) {
tabName = "Click Close Meshs";
} else {
tabName = "Click Open Meshs";
}
using (new FoldableBlock (ref state2, tabName, null)) {
if (state2) {
for (int i = 0; i < instance.meshs.Count; i++) {
ECLEditorUtl.BeginContents ();
{
GUILayout.BeginHorizontal ();
{
if (instance.meshs [i].meshFilter != null) {
EditorGUILayout.ObjectField ("Mesh Fiter", (Object)(instance.meshs [i].meshFilter), typeof(MeshFilter), true);
} else if(instance.meshs[i].skinnedMesh != null) {
EditorGUILayout.ObjectField ("Skinned Mesh", (Object)(instance.meshs [i].skinnedMesh), typeof(SkinnedMeshRenderer), true);
} else if(instance.meshs[i].animator != null) {
EditorGUILayout.ObjectField ("Animator", (Object)(instance.meshs[i].animator), typeof(Animator), true);
}
GUI.color = Color.red;
if (GUILayout.Button ("Delete", GUILayout.Width (60))) {
if (EditorUtility.DisplayDialog ("Alert", "Really want to delete?", "Okay", "Cancel")) {
instance.meshs.RemoveAt (i);
break;
}
}
GUI.color = Color.white;
}
GUILayout.EndHorizontal ();
if (instance.meshs [i].animator != null) {
EditorGUILayout.ObjectField ("Avatar", (Object)(getAvatar (instance.meshs [i].modelName)), typeof(Avatar), true);
}
EditorGUILayout.TextField ("Model Name", instance.meshs [i].modelName);
EditorGUILayout.ObjectField ("Mesh", (Object)(getMesh (instance.meshs [i].modelName, instance.meshs [i].meshName)), typeof(Mesh), true);
}
ECLEditorUtl.EndContents ();
}
}
}
GUILayout.BeginHorizontal ();
{
if (GUILayout.Button ("Get")) {
getAssets (instance, instance.transform);
EditorUtility.SetDirty (instance);
EditorUtility.DisplayDialog ("Success", "Finish get Assets", "Okay");
}
if (GUILayout.Button ("Clean")) {
cleanMaterialInfor ();
EditorUtility.DisplayDialog ("Success", "Finish clean Assets", "Okay");
}
if (GUILayout.Button ("Reset")) {
instance.reset ();
instance.resetAssets ();
EditorUtility.DisplayDialog ("Success", "Finish reset Assets", "Okay");
}
}
GUILayout.EndHorizontal ();
// base.OnInspectorGUI ();
GUILayout.Space(3f);
NGUIEditorTools.SetLabelWidth(80f);
bool minimalistic = NGUISettings.minimalisticLook;
DrawEvents("CLS0", "On Finish Load", instance.onFinshLoad, minimalistic);
}
void DrawEvents (string key, string text, List<EventDelegate> list, bool minimalistic)
{
if (!NGUIEditorTools.DrawHeader(text, key, false, minimalistic)) return;
NGUIEditorTools.BeginContents();
EventDelegateEditor.Field(instance, list, null, null, minimalistic);
NGUIEditorTools.EndContents();
}
public Avatar getAvatar (string path)
{
if (MeshMap [path] == null) {
string matPath = PStr.b ().a (CLPathCfg.self.basePath).a ("/")
.a ("upgradeRes4Dev").a ("/other/model/").a (path.Replace (".", "/")).a (".FBX").e ();
Debug.Log (matPath);
MeshMap [path] = ECLEditorUtl.getObjectByPath (matPath);
}
GameObject mi = MeshMap [path] as GameObject;
Animator animator = mi.GetComponent<Animator>();
if (animator == null) {
animator = mi.GetComponentInChildren<Animator>();
}
if(animator != null) {
return animator.avatar;
}
return null;
}
public Mesh getMesh (string path, string meshName)
{
if (MeshMap [path] == null) {
string matPath = PStr.b ().a (CLPathCfg.self.basePath).a ("/")
.a ("upgradeRes4Dev").a ("/other/model/").a (path.Replace (".", "/")).a (".FBX").e ();
Debug.Log (matPath);
MeshMap [path] = ECLEditorUtl.getObjectByPath (matPath);
}
GameObject mi = MeshMap [path] as GameObject;
if (mi != null) {
MeshFilter[] mfs = mi.GetComponentsInChildren<MeshFilter>();
if (mfs != null && mfs.Length > 0) {
for(int i=0;i < mfs.Length; i++) {
if (mfs [i].sharedMesh.name == meshName) {
return mfs[i].sharedMesh;
}
}
} else {
SkinnedMeshRenderer[] smrs = mi.GetComponentsInChildren<SkinnedMeshRenderer>();
if (smrs != null) {
for(int i=0;i < smrs.Length; i++) {
if (smrs [i].sharedMesh.name == meshName) {
return smrs[i].sharedMesh;
}
}
}
}
}
return null;
}
public Object getMaterial (string path)
{
if (MaterialMap [path] == null) {
string matPath = PStr.b ().a (CLPathCfg.self.basePath).a ("/")
.a ("upgradeRes4Dev").a ("/other/Materials/").a (path.Replace (".", "/")).a (".mat").e ();
// Debug.Log (matPath);
Object obj = ECLEditorUtl.getObjectByPath (matPath);
MaterialMap [path] = obj;
return obj;
} else {
return (Object)(MaterialMap [path]);
}
}
public void cleanMaterialInfor ()
{
instance.cleanRefAssets ();
}
public static bool getAssets (CLSharedAssets sharedAsset, Transform tr)
{
bool ret1 = false;
//fbx
sharedAsset.meshs.Clear ();
if (!sharedAsset.isSkipModel) {
ret1 = getMeshRef (sharedAsset, tr);
}
//sound
//material
sharedAsset.materials.Clear ();
return getMaterialRef (sharedAsset, tr) || ret1;
}
/// <summary>
/// Ises the can add shared asset proc. 判断是需要共享资源的处理
/// </summary>
/// <returns><c>true</c>, if can add shared asset proc was ised, <c>false</c> otherwise.</returns>
/// <param name="go">Go.</param>
public static bool isCanAddSharedAssetProc (GameObject go)
{
Object[] res = EditorUtility.CollectDependencies (new Object[] { go });
if (res == null || res.Length == 0) {
return false;
} else {
for (int i = 0; i < res.Length; i++) {
// 如何只引用了ui相关的图集与font也认为是没有引用资源
if (res [i].name != "EmptyAtlas" &&
res [i].name != "EmptyFont" &&
res [i].name != "atlasAllReal") {
return true;
}
}
return false;
}
}
/// <summary>
/// Gets the material reference.
/// </summary>
/// <returns><c>true</c>, 说明有新资源移动到开发目录 <c>false</c> otherwise.</returns>
/// <param name="sharedAsset">Shared asset.</param>
/// <param name="tr">Tr.</param>
public static bool getMaterialRef (CLSharedAssets sharedAsset, Transform tr)
{
bool ret = false;
bool ret1 = false;
bool ret2 = false;
bool ret3 = false;
Renderer[] rds = tr.GetComponents<Renderer> ();
Renderer rd = null;
for (int r = 0; r < rds.Length; r++) {
rd = rds [r];
if (rd == null)
continue;
if (rd.sharedMaterials != null && rd.sharedMaterials.Length > 0) {
for (int i = 0; i < rd.sharedMaterials.Length; i++) {
if (rd.sharedMaterials [i] == null)
continue;
Coolape.CLSharedAssets.CLMaterialInfor clMat = new Coolape.CLSharedAssets.CLMaterialInfor ();
clMat.render = rd;
clMat.index = i;
ret1 = ECLEditorUtl.moveAsset4Upgrade (rd.sharedMaterials [i]) || ret1 ? true : false;
string materialName = ECLEditorUtl.getAssetName4Upgrade (rd.sharedMaterials [i]);
clMat.materialName = materialName;
sharedAsset.materials.Add (clMat);
// save to cfg file
ArrayList propNames = new ArrayList ();
ArrayList texNames = new ArrayList ();
ArrayList texPaths = new ArrayList ();
ret2 = ECLEditorUtl.getTexturesFromMaterial (rd.sharedMaterials [i], ref propNames, ref texNames, ref texPaths) || ret2 ? true : false;
saveMaterialTexCfg (materialName, propNames, texNames, texPaths);
}
}
}
for (int i = 0; i < tr.childCount; i++) {
ret3 = getMaterialRef (sharedAsset, tr.GetChild (i)) || ret3 ? true : false;
}
return ret1 || ret2 || ret3;
}
public static bool getMeshRef (CLSharedAssets sharedAsset, Transform tr)
{
bool ret = false;
bool ret1 = false;
bool ret2 = false;
bool ret3 = false;
MeshFilter[] mfs = tr.GetComponents<MeshFilter> ();
Mesh mesh = null;
for (int i = 0; i < mfs.Length; i++) {
mesh = (mfs [i]).sharedMesh;
if (mesh != null) {
Coolape.CLSharedAssets.CLMeshInfor clMesh = new Coolape.CLSharedAssets.CLMeshInfor ();
clMesh.meshFilter = mfs [i];
ret1 = ECLEditorUtl.moveAsset4Upgrade (mfs [i].sharedMesh) || ret1 ? true : false;
string modelName = ECLEditorUtl.getAssetName4Upgrade (mfs [i].sharedMesh);
ECLEditorUtl.cleanModleMaterials (modelName);
clMesh.modelName = modelName;
clMesh.meshName = mesh.name;
sharedAsset.meshs.Add (clMesh);
}
}
SkinnedMeshRenderer[] smrs = tr.GetComponents<SkinnedMeshRenderer> ();
for (int i = 0; i < smrs.Length; i++) {
mesh = (smrs [i]).sharedMesh;
if (mesh != null) {
Coolape.CLSharedAssets.CLMeshInfor clMesh = new Coolape.CLSharedAssets.CLMeshInfor ();
clMesh.skinnedMesh = smrs [i];
ret2 = ECLEditorUtl.moveAsset4Upgrade (smrs [i].sharedMesh) || ret2 ? true : false;
string modelName = ECLEditorUtl.getAssetName4Upgrade (smrs [i].sharedMesh);
ECLEditorUtl.cleanModleMaterials (modelName);
clMesh.modelName = modelName;
clMesh.meshName = mesh.name;
sharedAsset.meshs.Add (clMesh);
}
}
Animator[] anis = tr.GetComponents<Animator> ();
for (int i = 0; i < anis.Length; i++) {
if (anis [i].avatar == null)
continue;
Coolape.CLSharedAssets.CLMeshInfor clMesh = new Coolape.CLSharedAssets.CLMeshInfor ();
ret2 = ECLEditorUtl.moveAsset4Upgrade (anis [i].avatar) || ret2 ? true : false;
string modelName = ECLEditorUtl.getAssetName4Upgrade (anis [i].avatar);
clMesh.modelName = modelName;
clMesh.animator = anis [i];
sharedAsset.meshs.Add (clMesh);
}
for (int i = 0; i < tr.childCount; i++) {
ret3 = getMeshRef (sharedAsset, tr.GetChild (i)) || ret3 ? true : false;
}
return ret1 || ret2 || ret3;
}
static string arrayList2Str(ArrayList list)
{
if (list == null) return "";
string str = "";
for (int i = 0; i < list.Count; i++)
{
str = PStr.b().a(str).a(list[i].ToString()).a("_").e();
}
return str;
}
public static bool needSave(string matName, ArrayList propNames, ArrayList texNames, ArrayList texPaths)
{
if (propNames == null || propNames.Count <= 0)
{
Debug.Log("There is no textures");
return false;
}
//Debug.Log("matName===" + matName);
Hashtable map = MapEx.getMap(CLMaterialPool.materialTexRefCfg, matName);
if (map == null)
{
return true;
}
ArrayList _propNames = MapEx.getList(map, "pp");
ArrayList _texNames = MapEx.getList(map, "tn");
ArrayList _texPaths = MapEx.getList(map, "tp");
if (!arrayList2Str(_propNames).Equals(arrayList2Str(propNames))
|| !arrayList2Str(_texNames).Equals(arrayList2Str(texNames))
|| !arrayList2Str(_texPaths).Equals(arrayList2Str(texPaths)))
{
return true;
}
return false;
}
public static void saveMaterialTexCfg (string matName, ArrayList propNames, ArrayList texNames, ArrayList texPaths)
{
if (propNames == null || propNames.Count <= 0) {
Debug.Log ("There is no textures");
return;
}
if (!needSave(matName, propNames, texNames, texPaths))
{
return;
}
Hashtable map = MapEx.getMap (CLMaterialPool.materialTexRefCfg, matName);
if (map == null) {
map = new Hashtable ();
}
map ["pp"] = propNames;
map ["tn"] = texNames;
map ["tp"] = texPaths;
CLMaterialPool.materialTexRefCfg [matName] = map;
MemoryStream ms = new MemoryStream ();
B2OutputStream.writeObject (ms, CLMaterialPool.materialTexRefCfg);
Directory.CreateDirectory (Path.GetDirectoryName (CLMaterialPool.materialTexRefCfgPath));
//File.WriteAllBytes (CLMaterialPool.materialTexRefCfgPath, ms.ToArray ());
byte[] bytes = ms.ToArray();
FileStream fs = new FileStream(CLMaterialPool.materialTexRefCfgPath, FileMode.OpenOrCreate);
fs.Write(bytes, 0, bytes.Length);
fs.Close();
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 1b00763bb40484db6ac221b98ef743f9
timeCreated: 1486273972
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,14 @@
using UnityEngine;
using System.Collections;
using UnityEditor;
using Coolape;
[CustomEditor (typeof(UIGridPage), true)]
public class CLUIGridPageInspector : UIGridEditor
{
public override void OnInspectorGUI ()
{
// base.OnInspectorGUI ();
DrawDefaultInspector ();
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 23a5d970238194932b64437f107e266f
timeCreated: 1449818087
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,16 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using Coolape;
[CanEditMultipleObjects]
[CustomEditor(typeof(CLUIJumpLabel), true)]
public class CLUIJumpLabelInspector : UILabelInspector
{
protected override bool ShouldDrawProperties()
{
NGUIEditorTools.DrawProperty("speed", serializedObject, "speed", GUILayout.MinWidth(40f));
return base.ShouldDrawProperties();
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0740184c2ee904ae0ab48c4b1546defe
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,26 @@
using UnityEngine;
using System.Collections;
using UnityEditor;
using Coolape;
[CustomEditor (typeof(CLUILoopGrid), true)]
public class CLUILoopGridInspector : Editor
{
CLUILoopGrid loopGrid;
public override void OnInspectorGUI ()
{
loopGrid = (CLUILoopGrid)target;
EditorGUILayout.BeginHorizontal ();
{
EditorGUILayout.LabelField ("Is Play Tween");
loopGrid.isPlayTween = EditorGUILayout.Toggle (loopGrid.isPlayTween);
}
EditorGUILayout.EndHorizontal ();
if (loopGrid.isPlayTween) {
base.OnInspectorGUI ();
} else {
loopGrid.cellCount = EditorGUILayout.IntField("Cell Count", loopGrid.cellCount);
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 998ffc511d6b344059dd85a0a4c74f5d
timeCreated: 1449814076
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,50 @@
using UnityEngine;
using System.Collections;
using UnityEditor;
using System.IO;
using Coolape;
[CustomEditor(typeof(CLUIPlaySound), true)]
public class CLUIPlaySoundInspector : Editor {
CLUIPlaySound instance;
Object asset = null;
public override void OnInspectorGUI ()
{
instance = target as CLUIPlaySound;
DrawDefaultInspector ();
if (instance != null) {
init ();
NGUIEditorTools.BeginContents ();
{
GUILayout.BeginHorizontal ();{
EditorGUILayout.LabelField ("AudioClip", GUILayout.Width (100));
asset = EditorGUILayout.ObjectField (asset, typeof(UnityEngine.Object), GUILayout.Width (125));
}
GUILayout.EndHorizontal ();
string soundPath = ECLEditorUtl.getPathByObject (asset);
instance.soundFileName = Path.GetFileName(soundPath);
instance.soundName = Path.GetFileNameWithoutExtension(soundPath);
EditorUtility.SetDirty (instance);
}
NGUIEditorTools.EndContents ();
}
}
bool isFinishInit = false;
void init ()
{
if (!isFinishInit || asset == null) {
isFinishInit = true;
if (!string.IsNullOrEmpty (instance.soundFileName) && CLPathCfg.self != null) {
string tmpPath = CLPathCfg.self.basePath+"/upgradeRes4Dev/other/sound/" + instance.soundFileName;
asset = ECLEditorUtl.getObjectByPath(tmpPath);
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 15bd5b5792869478da3618feed3787f6
timeCreated: 1449451771
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,60 @@
//----------------------------------------------
// NGUI: Next-Gen UI kit
// Copyright © 2011-2015 Tasharen Entertainment
//----------------------------------------------
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
using Coolape;
/// <summary>
/// Inspector class used to edit UITextures.
/// </summary>
[CanEditMultipleObjects]
[CustomEditor(typeof(CLUITextureUseAtlas), true)]
public class CLUITextureUseAtlasInspector : UITextureInspector
{
CLUITextureUseAtlas mTex;
protected override void OnEnable ()
{
base.OnEnable();
mTex = target as CLUITextureUseAtlas;
}
protected override bool ShouldDrawProperties ()
{
if (target == null) return false;
GUILayout.BeginHorizontal();
if (NGUIEditorTools.DrawPrefixButton("Atlas"))
ComponentSelector.Show<UIAtlas>(OnSelectAtlas);
EditorGUILayout.ObjectField (mTex.mAtlas, typeof(UIAtlas), GUILayout.Width (100));
GUILayout.EndHorizontal();
SerializedProperty isSharedMaterial = NGUIEditorTools.DrawProperty("isSharedMaterial", serializedObject, "isSharedMaterial", GUILayout.MinWidth(20f));
base.ShouldDrawProperties ();
return true;
}
void OnSelectAtlas (Object obj)
{
serializedObject.Update();
// SerializedProperty sp = serializedObject.FindProperty("mAtlas");
// sp.objectReferenceValue = obj;
// serializedObject.ApplyModifiedProperties();
SerializedProperty 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;
}
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 753cab5c1a93e441a825176d2f7453b0
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@@ -0,0 +1,29 @@
using UnityEditor;
using UnityEngine;
using System.Collections;
using Coolape;
[CustomEditor (typeof(CombineChildren), true)]
public class CombineChildrenInspector : Editor
{
CombineChildren combine;
Object luaAsset = null;
public override void OnInspectorGUI ()
{
combine = (CombineChildren)target;
base.OnInspectorGUI ();
if (GUILayout.Button ("Combine to Save")) {
combine.combineChildren (true);
EditorUtility.SetDirty (combine);
}
if (GUILayout.Button ("Combine")) {
combine.combineChildren ();
}
if (GUILayout.Button ("Explain")) {
combine.explainChildren ();
}
}
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0e403ad0a4fdc45e490ab9267675cfb3
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@@ -0,0 +1,28 @@
using UnityEngine;
using UnityEditor;
using System.Collections;
using Coolape;
[CanEditMultipleObjects]
[CustomEditor(typeof(UISlicedSprite), true)]
public class UISlicedSpriteInspector : UISpriteInspector
{
/// <summary>
/// Draw the atlas and sprite selection fields.
/// </summary>
protected override bool ShouldDrawProperties ()
{
GUILayout.BeginHorizontal();
SerializedProperty atlas = NGUIEditorTools.DrawProperty("Center rect", serializedObject, "mCenter", GUILayout.MinWidth(20f));
GUILayout.EndHorizontal();
base.ShouldDrawProperties();
return true;
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 4c8fe39301c5741319016bff7f250b42
timeCreated: 1450338737
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: