Ejemplo n.º 1
0
        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() };
                    });
                }
            }
        }
Ejemplo n.º 2
0
        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;
            }
        }
Ejemplo n.º 3
0
        public override void OnInspectorGUI()
        {
            KVEditorHelper.DrawHelpBox("这是角色组件");
            KVEditorHelper.DrawSpace();
            KVEditorHelper.DrawButton("Open PlayerPart", () =>
            {
                PlayerPartWindow.OpenPlayerWindow();
            });
//            base.OnInspectorGUI();
        }
Ejemplo n.º 4
0
        public void OnGUI()
        {
            DrawPartBaseInfo();
            DrawPartAnim();

            m_scrollPosition = GUILayout.BeginScrollView(m_scrollPosition);
            DrawPartSlotInfo();
            GUILayout.EndScrollView();

            KVEditorHelper.DrawButton("Save", () =>
            {
                EditorUtility.SetDirty(editPartDef);
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();
            });
        }
Ejemplo n.º 5
0
        void DrawSlotInfo(int index)
        {
            KVEditorHelper.GroupVertical(MainGroupStyle, () =>
            {
                var slot = editPartDef.partSlots[index];
                EditorGUILayout.BeginHorizontal();
                KVEditorHelper.DrawLabel($"插槽信息:{index}");
                if (GUILayout.Button("", "PaneOptions"))
                {
                    KVEditorHelper.PaneOptions(
                        editPartDef.partSlots, slot,
                        delegate(PlayerPartSlot[] newPartSlots) { editPartDef.partSlots = newPartSlots; });
                }
                EditorGUILayout.EndHorizontal();

                slot.slotType = (PlayerPartSoltType)EditorGUILayout.EnumPopup("插槽类型", slot.slotType);
                KVEditorHelper.DrawSpineBoneSelecter("插槽骨骼", editPartDef.skeletonDataAsset,
                                                     slot.slotName,
                                                     s => { slot.slotName = s; });
                slot.orderInLayer = EditorGUILayout.IntField("OrderInLayer", slot.orderInLayer);
            });
        }