Package org.jruby

Examples of org.jruby.RubyObject$Finalizer


    // load rgss
    // RBRunTime.loadRGSS1();

    // load map
    final RubyObject o = RGSS1Helper.get(p, Type.MAP).get(id).getObject();

    // build map
    final Map m = new Map(RubyHelper.toInt(o, "@width"), RubyHelper.toInt(o, "@height"));
    m.setFilename(RGSS1Load.getMapFile(project, id));
    m.setProject(project);
    m.setMid(id);

    TileSet autotiles = buildAutoTileset(RubyHelper.toInt(o, "@tileset_id"));
    m.addTileset(autotiles);

    TileSet tileset = buildTileset(RubyHelper.toInt(o, "@tileset_id"));
    m.addTileset(tileset);
    m.setTileHeight(32);
    m.setTileWidth(32);
    // tileset.

    // def [](x,y=0,z=0)
    // @data[x+y*@xsize+z*@xsize*@ysize]

    // build layers
    // load map data
    IRubyObject[] data = ((RubyArray) ((RubyObject) o.getInstanceVariable("@data")).getInstanceVariable("@data")).toJavaArray();
    final String[] names = { "Down", "Middle", "Up" };
    int z = 0;

    for (final String a : names) {
      final TileLayer l = (TileLayer) m.addLayer();
View Full Code Here


   * @return
   * @throws IOException
   */
  protected TileSet buildTileset(int id) throws IOException {
    // load tileset
    RubyObject o = RGSS1Helper.get(project, Type.TILESET).get(id).getObject();

    // build tileset
    TileSet tileset = new TileSet();

    ArrayList<BufferedImage> images = RGSS1Load.loadTilesetAsImage(project, Integer.valueOf(id));

    // add all
    for (int i = 0, l = images.size(); i < l; i++) {
      Tile t = new Tile();
      t.setId(i);
      if (images.get(i) != null) {
        t.setImage(images.get(i));
      }
      t.setTileSet(tileset);
      tileset.addTile(t);
    }

    tileset.setName(o.getInstanceVariable("@name").toString());

    return tileset;
  }
View Full Code Here

   * @see de.yaams.packandgo.helper.gui.list.YSimpleList#add()
   */
  @Override
  public void add() {
    // ask the tab
    RubyObject o = tab.createObject();

    // add it
    tab.getElements().add(new SystemGObject(o));
    tab.getElements().get(tab.getElements().size() - 1).setModified(true);
    add(tab.getElements().size() - 1);
View Full Code Here

   *
   * @see de.yaams.packandgo.programm.tabs.YaTab#getContent()
   */
  public void buildForm(FormBuilder form, int id) {
    // get page
    RubyObject page = elements.get(id).getObject();

    // build
    form.addHeader("basic", new FormHeader(I18N.t("Grundlegenes"), "event"));
    form.addElement(
        "basic.trigger",
        RubyForm.getComboBoxNum(I18N.t("Trigger"), new String[] { "0", "1", "2", "3", "4" }, new String[] { "action button",
            "contact with player", "contact with event", "autorun", "parallel processing" }, page, "@trigger"));

    // animation
    form.addHeader("animation", new FormHeader(I18N.t("Animation"), "animation").setColumn(10).setCollapsed(true));
    form.addElement("animation.ani", RubyForm.getBoolean("Moving Animation", page, "@walk_anime"));
    form.addElement("animation.stop", RubyForm.getBoolean("Stopped Animation", page, "@step_anime"));
    form.addElement("animation.fix", RubyForm.getBoolean("Fixed Direction", page, "@direction_fix"));
    form.addElement("animation.move", RubyForm.getBoolean("Move Through", page, "@through"));
    form.addElement("animation.top", RubyForm.getBoolean("Always On Top", page, "@always_on_top"));

    // animation
    form.addHeader("move", new FormHeader(I18N.t("Bewegung"), "animation").setColumn(6));
    form.addElement(
        "move.typ",
        RubyForm.getComboBoxNum(I18N.t("Type"), new String[] { "0", "1", "2", "3" }, new String[] { "Fixed", "Random", "Approach",
            "Custom" }, page, "@move_type"));
    form.addElement(
        "move.speed",
        RubyForm.getComboBoxNum(I18N.t("Speed"), new String[] { "1", "2", "3", "4", "5", "6" }, new String[] { "slowest", "slower",
            "slow", "fast", "faster", "fastest" }, page, "@move_speed"));
    form.addElement(
        "move.freq",
        RubyForm.getComboBoxNum(I18N.t("Frequency"), new String[] { "1", "2", "3", "4", "5", "6" }, new String[] { "lowest",
            "lower", "low", "high", "higher", "highest" }, page, "@move_frequency"));

    // add contition
    RubyObject cond = (RubyObject) page.getInstanceVariable("@condition");
    form.addHeader("cond", new FormHeader(I18N.t("Bedingung"), "if").setColumn(8).setCollapsed(true));

    // add local switch
    FormCheckbox v = RubyForm.getBoolean("Local Switch", cond, "@self_switch_valid");
    form.addElement("cond.ls", v);
    form.addElement(
        "cond.ls2",
        FormHelper.setEnabeldWhenRightElementSelect(
            v,
            RubyForm.getComboBox("", new String[] { "A", "B", "C", "D" }, new String[] { "A", "B", "C", "D" },
                cond.getInstanceVariable("@self_switch_ch")), "true"));
    v.informListeners();

    // add switch 1
    v = RubyForm.getBoolean("Switch 1", cond, "@switch1_valid");
    form.addElement("cond.s1", v);
    form.addElement("cond.s12", FormHelper.setEnabeldWhenRightElementSelect(v, new FormSwitchVarSelector(project, "", cond,
        "@switch1_id", Type.SWITCH), "true"));
    v.informListeners();

    // add switch 2
    v = RubyForm.getBoolean("Switch 2", cond, "@switch2_valid");
    form.addElement("cond.s2", new FormEmpty());
    form.addElement("cond.s23", new FormEmpty());
    form.addElement("cond.s24", v);
    form.addElement("cond.s25", FormHelper.setEnabeldWhenRightElementSelect(v, new FormSwitchVarSelector(project, "", cond,
        "@switch2_id", Type.SWITCH), "true"));
    v.informListeners();

    // add variable
    v = RubyForm.getBoolean("Variable", cond, "@variable_valid");
    form.addElement("cond.v3", v);
    form.addElement("cond.v4", FormHelper.setEnabeldWhenRightElementSelect(v, new FormSwitchVarSelector(project, "", cond,
        "@variable_id", Type.VARIABLE), "true"));
    form.addElement("cond.v5",
        FormHelper.setEnabeldWhenRightElementSelect(v, RubyForm.getNumber(">=", cond, "@variable_value"), "true"));
    v.informListeners();

    // graphic
    RubyObject graph = (RubyObject) page.getInstanceVariable("@graphic");

    form.addHeader("graphic", new FormHeader(I18N.t("Graphic"), "graphic").setColumn(4).setCollapsed(true));

    // add select
    FormComboBox gS = new FormComboBox(I18N.t("Typ"), new String[] { "1", "0" }, new String[] { "Tile", "Character" });
    gS.selectField(RubyHelper.toInt(graph.getInstanceVariable("@tile_id")) == 0 ? "1" : "0");
    form.addElement("graphic.typ", gS.setSorting(-2));

    // add tile
    form.addElement("graphic.tile",
        FormHelper.setEnabeldWhenRightElementSelect(gS, RubyForm.getNumber(I18N.t("Tile"), graph, "@tile_id").setSorting(-1), "1"));
View Full Code Here

   * @see de.yaams.extensions.genericLoader.GTab#getInternContent(int)
   */
  @Override
  public void buildForm(FormBuilder form, int id) {
    // prepare
    RubyObject act = elements.get(id).getObject();

    // build basics
    form.addHeader("basic", new FormHeader(I18N.t("Grundlegenes"), getIcon() + "_info"));
    form.addElement("basic.name", RubyForm.getString(I18N.t("Name"), "@name", act));

    // animation
    form.addHeader("other", new FormHeader(I18N.t("Sonstiges"), "animation").setColumn(6));
    form.addElement("other.ani", new FormDBComboBox("Animation", project, Type.ANIMATION, act, "@animation_id", true));
    form.addElement("other.rat", RubyForm.getNumber(I18N.t("Rating"), act, "@rating").setMinMax(0, 10, 1));
    form.addElement("other.acc", RubyForm.getNumber(I18N.t("Accuracy"), act, "@hit_rate"));
    form.addElement("other.hp", RubyForm.getNumber(I18N.t("Max HP"), act, "@maxhp_rate"));
    form.addElement("other.sp", RubyForm.getNumber(I18N.t("Max SP"), act, "@maxsp_rate"));

    // values
    form.addHeader("feat", new FormHeader(I18N.t("Attribute"), "opts").setColumn(6));
    form.addElement(
        "feat.rest",
        RubyForm.getComboBoxNum("Restriction", new String[] { "0", "1", "2", "3", "4" }, new String[] { "None", "Can't use skills",
            "Always attack enemies", "Always attack allies", "All actions are disableld" }, act, "@restriction"));
    form.addElement("feat.unrest", RubyForm.getBoolean(I18N.t("Unresistable"), act, "@nonresistance"));
    form.addElement("feat.zerohp", RubyForm.getBoolean(I18N.t("Link with dead (HP 0)"), act, "@zero_hp"));
    form.addElement("feat.exp", RubyForm.getBoolean(I18N.t("Can't get exp"), act, "@cant_get_exp"));
    form.addElement("feat.eva", RubyForm.getBoolean(I18N.t("Evasion forbidden"), act, "@cant_evade"));
    form.addElement("feat.dam", RubyForm.getBoolean(I18N.t("Progressive Damage"), act, "@slip_damage"));

    // values
    form.addHeader("value", new FormHeader(I18N.t("Werte"), "systemmonitor").setColumn(8));
    form.addElement("value.str", RubyForm.getNumber(RGSS1Voc.str(project), act, "@str_rate"));
    form.addElement("value.dex", RubyForm.getNumber(RGSS1Voc.dex(project), act, "@dex_rate"));
    form.addElement("value.agi", RubyForm.getNumber(RGSS1Voc.agi(project), act, "@agi_rate"));
    form.addElement("value.int", RubyForm.getNumber(RGSS1Voc.inte(project), act, "@int_rate"));
    form.addElement("value.atk", RubyForm.getNumber("Attack Power", act, "@atk_rate"));
    form.addElement("value.pdef", RubyForm.getNumber("Phys Def", act, "@pdef_rate"));
    form.addElement("value.mdef", RubyForm.getNumber("Mag Def", act, "@mdef_rate"));
    form.addElement("value.eva", RubyForm.getNumber("Evasion", act, "@eva"));

    // build panel
    form.addHeader("rec", new FormHeader(I18N.t("Heilung"), "add").setColumn(4));
    form.addElement("rec.end", RubyForm.getBoolean(I18N.t("End After Battle"), act, "@battle_only"));
    form.addElement("rec.start",
        RubyForm.getNumber("Min. turn wait", act, "@hold_turn").setInfoTxt("How long must wait, to get a chance to recover"));
    form.addElement("rec.startrel", RubyForm.getNumber(I18N.t("% Chance to recover each turn"), act, "@auto_release_prob"));
    form.addElement(
        "rec.shockr",
        RubyForm.getNumber(I18N.t("% Chance to recover"), act, "@shock_release_prob").setInfoTxt(
            I18N.t("When damage is dealt, how big is the chance to recover?")));

    // build panel
    form.addHeader("result", new FormHeader(I18N.t("Setzen von Auswirkungen"), "status").setColumn(6).setSorting(4));

    form.addElement("result.element",
        new FormDBList(project, Type.ELEMENT, act.getInstanceVariable("@guard_element_set"), I18N.t("Attribute Resistance")));
    form.addElement("result.statusAdd",
        new FormDBList(project, Type.STATUS, act.getInstanceVariable("@plus_state_set"), I18N.t("Hinzufügen des Status.")));
    form.addElement("result.statusRemove",
        new FormDBList(project, Type.STATUS, act.getInstanceVariable("@minus_state_set"), I18N.t("Entfernen des Status.")));

  }
View Full Code Here

   * @see de.yaams.extensions.genericLoader.GTab#getInternContent(int)
   */
  @Override
  public void buildForm(FormBuilder form, int id) {
    // prepare
    RubyObject act = elements.get(id).getObject();

    // build basics
    form.addHeader("basic", new FormHeader(I18N.t("Grundlegenes"), getIcon() + "_info").setColumn(4));
    form.addElement("basic.name", RubyForm.getString("Name", "@name", act));
    form.addElement("basic.desc", RubyForm.getString(I18N.t("Beschreibung"), "@description", act));
    form.addElement("basic.image", new FormGraphEle(I18N.t("Bild"), project, RTP.ICON, act, "@icon_name", null));

    form.addHeader("usa", new FormHeader(I18N.t("Benutzung"), "info"));
    form.addElement("usa.price", RubyForm.getNumber(I18N.t("Preis"), act, "@price"));

    // values
    form.addHeader("value", new FormHeader(I18N.t("Werte"), "systemmonitor").setColumn(8));
    form.addElement("value.atk", RubyForm.getNumber("Attack Power", act, "@atk"));
    form.addElement("value.pdef", RubyForm.getNumber("Phys Defense", act, "@pdef"));
    form.addElement("value.mdef", RubyForm.getNumber("Mag Defense", act, "@mdef"));
    form.addElement("value.str", RubyForm.getNumber(RGSS1Voc.str(project), act, "@str_plus"));
    form.addElement("value.dex", RubyForm.getNumber(RGSS1Voc.dex(project), act, "@dex_plus"));
    form.addElement("value.agi", RubyForm.getNumber(RGSS1Voc.agi(project), act, "@agi_plus"));
    form.addElement("value.int", RubyForm.getNumber(RGSS1Voc.inte(project), act, "@int_plus"));

    // animation
    form.addHeader("other", new FormHeader(I18N.t("Sonstiges"), "animation").setColumn(4));
    form.addElement("other.user", new FormDBComboBox("User Animation", project, Type.ANIMATION, act, "@animation1_id", true));
    form.addElement("other.target", new FormDBComboBox("Target Animation", project, Type.ANIMATION, act, "@animation2_id", true));

    // build panel
    form.addHeader("result", new FormHeader(I18N.t("Setzen von Auswirkungen"), "skill").setColumn(6).setSorting(4));

    form.addElement("result.element",
        new FormDBList(project, Type.ELEMENT, act.getInstanceVariable("@element_set"), I18N.t("Setzen von Elementen")));
    form.addElement("result.statusAdd",
        new FormDBList(project, Type.STATUS, act.getInstanceVariable("@plus_state_set"), I18N.t("Hinzufügen des Status.")));
    form.addElement("result.statusRemove",
        new FormDBList(project, Type.STATUS, act.getInstanceVariable("@minus_state_set"), I18N.t("Entfernen des Status.")));

  }
View Full Code Here

   * @see de.yaams.extensions.genericLoader.GTab#getInternContent(int)
   */
  @Override
  public void buildForm(FormBuilder form, final int id) {
    // Load Map
    final RubyObject map = RGSS1Helper.get(project, Type.MAP).get(id).getObject();

    // add map view
    final YMapView view = new YMapView(map, project);
    view.recreateEventImage();

    // build basics
    form.addHeader("basic", new FormHeader(I18N.t("Grundlegenes"), getIcon() + "_info").setColumn(6));
    form.addElement("basic.name", RubyForm.getString("Name", "@name", map));
    form.addElement("basic.tile", new FormDBComboBox(I18N.t("Tileset"), project, Type.TILESET, map, "@tileset_id", false)
        .addChangeListener(new FormElementChangeListener() {

          @Override
          public void stateChanged(FormElement form) {
            view.recreateImage();

          }
        }));
    form.addElement("basic.size",
        new FormInfo(I18N.t("Size"), I18N.t("{0}x{1}", map.getInstanceVariable("@width"), map.getInstanceVariable("@height")))
            .setInfoTxt(I18N.t("You can chance the map size in the mapeditor.")));

    // sounds
    form.addHeader("sound", new FormHeader(I18N.t("Sounds"), "audio").setColumn(8));
    form.addElement("sound.bgm", new FormMusicEle("BGM", project, RTP.BGM, map.getInstanceVariable("@bgm")));
    form.addElement("sound.bgmauto", RubyForm.getBoolean("Autoplay", map, "@autoplay_bgm"));
    form.addElement("sound.bgs", new FormMusicEle("BGS", project, RTP.BGS, map.getInstanceVariable("@bgs")));
    form.addElement("sound.bgsauto", RubyForm.getBoolean("Autoplay", map, "@autoplay_bgs"));

    // build panel
    form.addHeader("troop",
        new FormHeader(RGSS1Helper.getName(Type.TROOP), RGSS1Helper.getIcon(Type.TROOP)).setColumn(4).setCollapsed(true));
    form.addElement("troop.step", RubyForm.getNumber("Encounter Step", map, "@encounter_step").setMinMax(0, 500, 1));
    form.addElement(
        "troop.troop",
        new FormDBList(project, Type.TROOP, map.getInstanceVariable("@encounter_list"), I18N.t("{0} auf der Karte",
            RGSS1Helper.getName(Type.TROOP))));

    form.addButton("map", YFactory.b("Edit Map", "map_edit", new AE() {

      @Override
View Full Code Here

   * @see de.yaams.extensions.genericLoader.GTab#createObject()
   */
  @Override
  public RubyObject createObject() {
    // create map
    RubyObject r = (RubyObject) RGSSProjectHelper.getInterpreter(project).runScriptlet("return RPG::Map.new(20,15)");
    r.setInstanceVariable("@name", RubyString.newEmptyString(r.getRuntime()));
    return r;

    // build it
    // return (RubyObject)
    // RBRunTime.interpreter.runScriptlet("return RPG::MapInfo()");
View Full Code Here

   * @see de.yaams.extensions.genericLoader.GTab#getInternContent(int)
   */
  @Override
  public void buildForm(FormBuilder form, int id) {
    // prepare
    RubyObject act = elements.get(id).getObject();

    // build basics
    form.addHeader("basic", new FormHeader(I18N.t("Grundlegenes"), getIcon() + "_info").setColumn(4));
    form.addElement("basic.name", RubyForm.getString(I18N.t("Name"), "@name", act));
    form.addElement(
        "basic.position",
        RubyForm.getComboBoxNum("Position", new String[] { "0", "1", "2", "3" }, new String[] { "Top", "Middle", "Bottom",
            "Whole Screen" }, act, "@position"));

    form.addHeader("graphic", new FormHeader(I18N.t("Graphics"), "graphic"));
    form.addElement("graphic.graphic", new FormGraphEle(I18N.t("Graphic"), project, RTP.ANIMATION, act, "@animation_name",
        "@animation_hue"));

    // build panel
    form.addHeader("animation", new FormHeader(I18N.t("Animationsoptionen"), "animation").setSorting(1).setColumn(2));
    form.addElement("animation.timing", new FormAnimationTimingList(getProject(), act.getInstanceVariable("@timings")));

    // build panel
    form.addHeader("unsupported", new FormHeader(I18N.t("Nicht unterstützt"), "error").setColumn(4).setCollapsed(true));
    form.addElement("unsupported.frames", RubyForm.getError("Frames", "@frames", act));
    form.addElement("unsupported.max", RubyForm.getError("Frames Max", "@frame_max", act));
View Full Code Here

   * @see de.yaams.extensions.genericLoader.GTab#getInternContent(int)
   */
  @Override
  public void buildForm(FormBuilder form, int id) {
    // prepare
    RubyObject act = elements.get(id).getObject();

    // build basics
    form.addHeader("basic", new FormHeader(I18N.t("Grundlegenes"), getIcon() + "_info"));
    form.addElement("basic.name", RubyForm.getString("Name", "@name", act));

    // build fog
    form.addHeader("graphic", new FormHeader(I18N.t("Grafiken"), "graphic").setColumn(4));
    form.addElement("graphic.tile", new FormGraphEle(I18N.t("Tileset"), project, RTP.TILESET, act, "@tileset_name", null));
    // form.addElement("graphic.atile", RubyForm.getError("Autotile",
    // "@autotile_names", act));
    form.addElement("graphic.pano", new FormGraphEle(I18N.t("Panorama"), project, RTP.PANORAMA, act, "@panorama_name", "@panorama_hue"));
    form.addElement("graphic.battle", new FormGraphEle(I18N.t("Battle Back"), project, RTP.BATTLEBACK, act, "@battleback_name", null));

    final RubyArray ra = (RubyArray) act.getInstanceVariable("@autotile_names");
    for (int i = 0; i < 7; i++) {
      final int j = i;
      form.addElement("graphic.atile" + i,
          new FormGraphEle(I18N.t("Autotile {0}", i), project, RTP.AUTOTILE, RubyString.newString(ra.getRuntime(), (String) ra.get(i)), i, null)
              .setSorting(i + 1).addChangeListener(new FormElementChangeListener() {

                @Override
                public void stateChanged(FormElement form) {
                  ra.remove(j);
                  ra.add(j, form.getContentAsString());

                }
              }));
    }

    // build fog
    form.addHeader("fog", new FormHeader(I18N.t("Nebel"), "info").setColumn(6));
    form.addElement("fog.afog", new FormGraphEle(I18N.t("Fog"), project, RTP.PANORAMA, act, "@fog_name", "@fog_hue"));
    form.addElement("fog.opa", RubyForm.getNumber(I18N.t("Opacity"), act, "@fog_opacity").setMinMax(0, 255, 1));
    form.addElement("fog.blend", RubyForm.getComboBoxNum(I18N.t("Blending Mode"), new String[] { "0", "1", "2" }, new String[] { "Normal", "Addition",
        "Subtraction" }, act, "@fog_blend_type"));
    form.addElement("fog.zoom", RubyForm.getNumber(I18N.t("Zoom"), act, "@fog_zoom"));
    form.addElement("fog.sx", RubyForm.getNumber(I18N.t("SX"), act, "@fog_sx").setInfoTxt(I18N.t("(automatic X-axis scrolling speed)")));
    form.addElement("fog.sy", RubyForm.getNumber(I18N.t("SY"), act, "@fog_sy").setInfoTxt(I18N.t("(automatic Y-axis scrolling speed)")));

    // build panel
    form.addHeader("tileset", new FormHeader(I18N.t("Tileset"), "tileset").setColumn(16));
    // load tileset
    ArrayList<BufferedImage> img = RGSS1Load.loadTilesetAsImage(project, id);

    // scale?
    JavaTable table = new JavaTable(act.getInstanceVariable("@passages"));
    int lg = img.size() + 384;
    if (lg != table.getX()) {
      table.setX(lg);
      new JavaTable(act.getInstanceVariable("@priorities")).setX(lg);
      new JavaTable(act.getInstanceVariable("@terrain_tags")).setX(lg);
    }

    for (int i = 0, l = img.size(); i < l; i++) {
      form.addElement("tileset." + i, new FormTileset(act, i + 384, img.get(i)).setSorting(i));
    }
View Full Code Here

TOP

Related Classes of org.jruby.RubyObject$Finalizer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.