void DrawPartSlotInfo() { if (!partInfo.partAnim) { return; } showSlot = EditorGUILayout.Foldout(showSlot, "插槽"); if (showSlot) { if (editPartDef.partSlots.Length > 0) { for (int i = 0; i < editPartDef.partSlots.Length; i++) { DrawSlotInfo(i); } } else { KVEditorHelper.DrawButton("AddNew", () => { editPartDef.partSlots = new PlayerPartSlot[] { new PlayerPartSlot() }; }); } } }
void DrawPartAnim() { EditorGUI.BeginChangeCheck(); editPartDef.skeletonDataAsset = EditorGUILayout.ObjectField("动画", editPartDef.skeletonDataAsset, typeof(SkeletonDataAsset)) as SkeletonDataAsset; if (!editPartDef.skeletonDataAsset) { KVEditorHelper.DrawHelpBox("请设置动画", MessageType.Error); return; } if (!partInfo.partAnim) { KVEditorHelper.DrawButton("加载动画", () => { LoadPartAnim(); }); } else { partInfo.partAnim = EditorGUILayout.ObjectField( "动画Object", partInfo.partAnim, typeof(SkeletonAnimation)) as SkeletonAnimation; } }
public override void OnInspectorGUI() { KVEditorHelper.DrawHelpBox("这是角色组件"); KVEditorHelper.DrawSpace(); KVEditorHelper.DrawButton("Open PlayerPart", () => { PlayerPartWindow.OpenPlayerWindow(); }); // base.OnInspectorGUI(); }
public void OnGUI() { DrawPartBaseInfo(); DrawPartAnim(); m_scrollPosition = GUILayout.BeginScrollView(m_scrollPosition); DrawPartSlotInfo(); GUILayout.EndScrollView(); KVEditorHelper.DrawButton("Save", () => { EditorUtility.SetDirty(editPartDef); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); }); }