Exemple #1
0
  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);
  }
Exemple #2
0
  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);
    }
  }
Exemple #3
0
  public void load_scene() {
    System.out.println(">> loading scene!");
    Scene temp_scene =
        Project_serializer.deserialize_scene(
            "scenes/default_scene.ser"); // current_scene.get_name ());

    for (Background current_bg : temp_scene.get_backgrounds()) current_bg.post_serialization();

    change_scene(temp_scene);

    current_project.add_scene(temp_scene);

    current_project.current_scene = temp_scene;
  }
Exemple #4
0
  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 ());
  }
Exemple #5
0
  public Controller(Editor p_editor, View p_view) {
    editor = p_editor;
    stage = p_view.get_stage();
    cam = stage.getCamera();

    view = p_view;

    input_multiplexer = new InputMultiplexer(this);
    input_multiplexer.addProcessor(stage);
    Gdx.input.setInputProcessor(input_multiplexer);

    //		try
    //		{
    //			////
    //			// loads the default project
    //
    //			load_project ();
    //		}
    //		catch (Exception e)
    //		{
    ////
    // in case of a load failure, most likely to occur after a change is made to the Scene or
    // Project class,
    // recreate the default project

    System.out.println(
        ">>>> NOTE: couldn't load project, probably incompatible version, reverting to default project");

    Scene default_scene = new Scene();
    default_scene.set_name("project_default_scene");

    Background bg_01 = new Background("data/backgrounds/bg_workshop_l010_a01.png");
    bg_01.set_name("bg_l1");
    bg_01.set_z(0f);
    Background bg_02 = new Background("data/backgrounds/bg_workshop_l020_a01.png");
    bg_02.set_name("bg_l2");
    bg_02.set_z(10f);

    Hotspot hotspot_01 =
        new Hotspot("data/sprites/woodrow_a01_talk_anim_a01.png", "say_anim", 4, 110, 190, 2, 2, 4);
    hotspot_01.new_animation(
        "data/sprites/woodrow_a01_idle_anim_a01.png", "idle_anim", 2, 110, 190, 2, 1, 4);
    hotspot_01.set_name("char");
    hotspot_01.set_z(5f);
    hotspot_01.set_position(200f, 50f);
    //			hotspot_01.set_scale_x (0.45f);
    //			hotspot_01.set_scale_y (0.45f);

    default_scene.add_background(bg_01);
    default_scene.add_background(bg_02);
    default_scene.add_hotspot(hotspot_01);

    current_project.add_scene(default_scene);

    current_project.current_scene = default_scene;

    change_scene(current_project.current_scene);

    editor.get_properties_editor().set_current_project(current_project);
    //		}
  }