示例#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);
  }
示例#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);
    }
  }
示例#3
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 ());
  }
示例#4
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);
    //		}
  }
示例#5
0
  @Override
  public boolean touchDown(int arg0, int arg1, int arg2, int arg3) {
    ////
    // for checking proper clicks, and potentially drags

    currently_pressed_object =
        get_object_at(
            arg0,
            arg1); // view.get_top_object_at_coordinate (arg0, arg1); //
                   // p_y_pos)trigger_on_mouse_click_on_object_at (arg0, arg1);

    if (currently_pressed_object != null) {
      ////
      // sets the click_offset vector, to be used when dragging objects

      Vector2 modified_values = get_screen_to_stage_coordinates(arg0, arg1);

      modified_values.sub(view.MOVIE_DISPLAY_GROUP_OFFSET);

      click_offset = new Vector2(modified_values.sub(currently_pressed_object.get_position()));

      //			System.out.println (click_offset);

      ////
      // updates the Display_info_panel s Currently_touched (or something) label witht the object in
      // question
      // as well as the properties_list's currently selected row

      editor
          .get_properties_editor()
          .set_currently_selected_object((Main_object) currently_pressed_object);
      editor.get_properties_editor().set_row_selection();

      editor.get_display_info_panel().update_currently_pressed_object(currently_pressed_object);

      ////
      // in case of a hotspot, trigger hotspot's Script

      if (currently_pressed_object instanceof Hotspot) {
        System.out.println(
            "controller - Hotspot has been pressed, issuing Script! " + currently_pressed_object);
        //				System.out.println ("post stuff");

        Hotspot c_hotspot = (Hotspot) currently_pressed_object;

        System.out.println("the next event! " + c_hotspot.get_script().get_next_event());

        handle_new_script(c_hotspot.get_script());

        //    			KEvent <Hotspot> k_event = new KEvent <Hotspot> (KEvent.Type.SAY, (Hotspot)
        // currently_pressed_object);
        //    			dispatch_KEvent (k_event);
        //
        //    			view.display_text
        //				(
        //					"blorg!",
        //					currently_pressed_object.get_position ().add (view.get_movie_display_group_offset
        // ()).x,
        //					currently_pressed_object.get_position ().add (view.get_movie_display_group_offset
        // ()).y + 200
        //				);

      }
    }

    return false;
  }