using UnityEngine;

public class UIHandleFriend : UIHandle
{
    protected KF3FriendContainer mContainer => Owner as KF3FriendContainer;

    public static UIHandleFriend CreateAsChild(KF3ObjectContainer owner)
    {
        var handle = CreateAsChild<UIHandleFriend>(owner.transform);
        handle.Init(owner).SetColor(Color.yellow).SetScale(1.5f);
        return handle;
    }

    public override UIHandle Init(ObjectContainer owner)
    {
        base.Init(owner);

        Popup.AddButton("Reset All", TransformResetAll);
        Popup.AddButton("Reset Position", TransformResetPosition);
        Popup.AddButton("Reset Rotation", TransformResetRotation);
        Popup.AddButton("Reset Scale", TransformResetScale);
        Popup.AddButton("Toggle Physics", () =>
        {
            mContainer.TogglePhysics();
            mContainer.SetKeyframe();
        });
        Popup.AddButton("Toggle Bones", () => mContainer.ToggleBonesVisible(!mContainer.BonesVisible));
        Popup.AddButton("Toggle IK", () => {
            mContainer.ToggleIK(!mContainer.IKEnabled);
            mContainer.SetKeyframe();
        });
        Popup.AddButton("Reset Bones", () => mContainer.ResetBones());
        Popup.AddButton("Delete", () => Destroy(Owner));

        return this;
    }

}
