diff --git a/simulators/ursina/ursina_ui.py b/simulators/ursina/ursina_ui.py index 7d166c08e0e3291a430a86969ad2b2b49ce99540..61a54f5d07fe16b6def2ee7aaac4705a1ab18a38 100644 --- a/simulators/ursina/ursina_ui.py +++ b/simulators/ursina/ursina_ui.py @@ -161,10 +161,14 @@ class UrsinaUI: def callback_action(b=body): self.bodies_button_list_click(b) - distance_to_entity = distance(body.planet, camera) - d = distance_to_entity / UrsinaConfig.SCALE_FACTOR / AU - name = f"{body.name}\t距离:{d:.4f}天文单位" - button_dict[name] = callback_action + if body.appeared: + distance_to_entity = distance(body.planet, camera) + d = distance_to_entity / UrsinaConfig.SCALE_FACTOR / AU + name = f"{body.name}\t距离:{d:.4f}天文单位" + button_dict[name] = callback_action + else: + name = f"{body.name}\t距离太远,找不到了" + button_dict[name] = lambda: self.bodies_button_list_click(None) if hasattr(self, "bodies_button_list"): destroy(self.bodies_button_list) diff --git a/simulators/ursina_simulator.py b/simulators/ursina_simulator.py index 35e1813c250e85205d424eaa9d75128517edbfa1..bea805df33c1427fddbef5dd63198454da21370d 100644 --- a/simulators/ursina_simulator.py +++ b/simulators/ursina_simulator.py @@ -62,8 +62,8 @@ class UrsinaSimulator(Simulator): def on_searching_bodies(self, **kwargs): views = [] for view in self.body_views: - if view.appeared: - views.append(view) + # if view.appeared: + views.append(view) return views