\(-x^2-y^2+xy+2x+2y=-\left[x^2-x\left(y+2\right)+\dfrac{1}{4}\left(y+2\right)^2\right]-\left(\dfrac{3}{4}y^2-3y+3\right)+4=-\left(x-\dfrac{1}{2}y-1\right)^2-\left(\dfrac{\sqrt{3}}{2}y-\sqrt{3}\right)^2+4\le4\)
\(max=4\Leftrightarrow\)\(\left\{{}\begin{matrix}x=2\\y=2\end{matrix}\right.\)