A General Framework for Learning Mean-Field Games