コード例 #1
0
  @SuppressWarnings("unchecked")
  @Override
  public void read(Json json, JsonValue jsonData) {
    layers = json.readValue("layers", ArrayList.class, SceneLayer.class, jsonData);
    id = json.readValue("id", String.class, jsonData);
    state = json.readValue("state", String.class, jsonData);
    verbManager = json.readValue("verbs", VerbManager.class, jsonData);

    actors = json.readValue("actors", HashMap.class, BaseActor.class, jsonData);
    player = json.readValue("player", String.class, jsonData);

    for (BaseActor actor : actors.values()) {
      actor.setScene(this);

      SceneLayer layer = getLayer(actor.getLayer());
      layer.add(actor);
    }

    orderLayersByZIndex();

    backgroundAtlas = json.readValue("backgroundAtlas", String.class, jsonData);
    backgroundRegionId = json.readValue("backgroundRegionId", String.class, jsonData);
    lightMapAtlas = json.readValue("lightMapAtlas", String.class, jsonData);
    lightMapRegionId = json.readValue("lightMapRegionId", String.class, jsonData);

    musicFilename = json.readValue("musicFilename", String.class, jsonData);
    loopMusic = json.readValue("loopMusic", Boolean.class, jsonData);
    initialMusicDelay = json.readValue("initialMusicDelay", Float.class, jsonData);
    repeatMusicDelay = json.readValue("repeatMusicDelay", Float.class, jsonData);

    isPlayingSer = json.readValue("isPlaying", Boolean.class, jsonData);
    musicPosSer = json.readValue("musicPos", Float.class, jsonData);

    camera = json.readValue("camera", SceneCamera.class, jsonData);
    String followActorId = json.readValue("followActor", String.class, jsonData);

    setCameraFollowActor((SpriteActor) actors.get(followActorId));

    depthVector = json.readValue("depthVector", Vector2.class, jsonData);
    polygonalNavGraph = json.readValue("polygonalNavGraph", PolygonalNavGraph.class, jsonData);
  }
コード例 #2
0
  public void resetCamera(float worldWidth, float worldHeight) {
    camera.create(worldWidth, worldHeight);

    if (getPlayer() != null) setCameraFollowActor(getPlayer());
  }