Due to its strong flexibility, easy deployment and extensive connectivity, unmanned aerial vehicle (UAV) swarm has been widely used in emergency communication in recent years, especially in the case when terrestrial communication infrastructures are no longer available. Within a UAV swarm, the design of routing protocol is one of the most challenging problems that enables cooperation among multiple UAVs to perform complex tasks in disaster areas. Nevertheless, the routing protocols reported so far have made the simplifying assumption that the UAV nodes move randomly. In the context of mission-oriented scenarios, such as emergency communication in disaster areas, this assumption appears evidently impractical. On the contrary, for many UAV applications, the trajectories of UAVs are pre-planned in advance through mission planning and trajectory planning. Disregarding trajectory information from the application layer may result in routing protocols struggling to adapt to rapid changes in network topology and facing challenges in achieving optimal performance across various communication metrics. To break the bottleneck, in this paper, we propose an efficient trajectory-based optimized routing protocol (TORP) for mission-oriented UAV swarm. Firstly, we model the packet routing problem using the concept of time-dependent graph. The objective is to maximize network performance, considering the power consumption and end-to-end (E2E) delay. The formulated problem is a binary linear programming (BLP) problem which is intractable to solve. Firstly, we propose a modified dynamically weighted Dijkstra's algorithm (MDWD). Based on the MDWD algorithm, we further propose an efficient optimization scheme to solve the constructed optimization problem. The simulation results demonstrate that our algorithm can make effective routing selections in dynamic UAV network, thereby improving the system performance in terms of packet delivery ratio, end-toend delay and power consumption.