public void load_project() { System.out.println(">> loading project!"); Project temp_project = Project_serializer.deserialize_project( "projects/default_project.ser"); // current_scene.get_name ()); //// // trigger the .post_serialization on the backgrounds, which reinitializes a bunch of things, // that got lost // in the serialization for (Scene c_scene : temp_project.get_scenes()) { System.out.println("load_project - scene! - " + c_scene.get_name()); for (Background c_backgroud : c_scene.get_backgrounds()) { System.out.println("load_project - bg! - " + c_backgroud.get_name()); c_backgroud.post_serialization(); } for (Hotspot c_hotspot : c_scene.get_hotspots()) { System.out.println("load_project - hotspot! - " + c_hotspot.get_name()); c_hotspot.post_serialization(); } add_scene_event_listeners(c_scene); } current_project = temp_project; editor.get_properties_editor().set_current_project(current_project); change_scene(temp_project.current_scene); }
private void remove_scene_event_listeners(Scene p_scene) { for (Background c_background : p_scene.get_backgrounds()) { c_background.remove_KListener(this); } for (Hotspot c_hotspot : p_scene.get_hotspots()) { c_hotspot.remove_KListener(this); this.remove_KListener((KListener) c_hotspot); } for (KTextbox c_render_q_o : view.get_gui_textbox_list()) { this.remove_KListener(c_render_q_o); } }
public void save_scene() { System.out.println(">> saving scene!"); for (Background c_background : current_scene.get_backgrounds()) { c_background.remove_KListener(this); } for (Hotspot c_hotspot : current_scene.get_hotspots()) { c_hotspot.remove_KListener(this); this.remove_KListener(c_hotspot); } Project_serializer.serialize_scene( current_scene, "scenes/default_scene.ser"); // current_scene.get_name ()); }