The bound and resonant states of $D^{(*)}D^{(*)}$ and $D^{(*)}\bar{D}^{(*)}$ with the complex scaling method