Oxidation number of oxygen atoms in oxygen difluoride
Oxygen difluoride $\ce{OF2}$ has a single oxygen atom. You must mean dioxygen difluoride $\ce{O2F2}$.
The rules are the same as for hydrogen peroxide.
Both oxygen atoms in $\ce{O2F2}$  are equivalent, so their oxidation number is +1.