Package org.jruby

Examples of org.jruby.RubyObject$VariableTableEntry


  @Override
  public void add() {
    Ruby run = RGSS1Helper.get(project, type).get(1).getObject().getRuntime();

    // build Object
    RubyObject o = new RubyObject(RubyClass.newClass(run, RGSS1Helper.get(project, Type.SYSTEM).get(0).getObject().getMetaClass()
        .getSuperClass()));
    o.setInstanceVariable("@id", RubyFixnum.newFixnum(run, ary.size() + 1));
    o.setInstanceVariable("@name", RubyString.newEmptyString(run));

    SystemGObject g = new SystemGObject(o);

    // add & config
    add(g);
View Full Code Here


  @Override
  public void viewToRaw(ArrayList<EventCode> list, List<Object> rawList, EventCode code) {

    // create for every parameter a new event raw code
    for (int i = 0, l = code.getParameters().size(); i < l; i++) {
      RubyObject obj;
      int nid = code.getId();
      int indent = code.getIndent();

      // first code?
      if (i == 0) {
        // get obj
        obj = code.getObject();
      } else {
        obj = (RubyObject) RGSSProjectHelper.getInterpreter(code.getYecl().getProject()).runScriptlet(
            "return RPG::EventCommand.new(" + id + ")");
        indent = code.getIndent();
        nid = id2;
      }

      // update indent
      obj.setInstanceVariable("@indent", new RubyFixnum(code.getObject().getRuntime(), indent));

      // update id
      obj.setInstanceVariable("@code", new RubyFixnum(code.getObject().getRuntime(), nid));

      // set parameter
      RubyArray r = (RubyArray) code.getObject().getInstanceVariable("@parameters");
      r.rb_clear();
      r.add(code.getParameters().get(i));
View Full Code Here

   * @param id
   * @return
   */
  public static RubyObject loadMapData(Project p, int id) {
    // Load Map
    RubyObject map = (RubyObject) loadFile(p, getMapFile(p, id));
    map.setInstanceVariable("@name", ((RubyObject) getMapsName(p).get(id)).getInstanceVariable("@name"));
    map.setInstanceVariable("@id", RubyFixnum.newFixnum(map.getRuntime(), id));

    return map;
  }
View Full Code Here

  public static ArrayList<BufferedImage> loadAutotilesAsImage(Project p, int id) {

    ArrayList<BufferedImage> b = new ArrayList<BufferedImage>();

    // load tileset
    RubyObject ts = RGSS1Helper.get(p, Type.TILESET).get(id).getObject();

    // load images

    // add autotiles
    List<?> autotiles = new ArrayList<Object>();
    autotiles.add(null);
    autotiles.addAll(((RubyArray) ts.getInstanceVariable("@autotile_names")).getList());
    for (Object autotile : autotiles) {
      // empty?
      if (autotile == null || autotile.toString().length() == 0) {
        for (int i = 0; i < 48; i++) {
          b.add(null);
View Full Code Here

  public static ArrayList<BufferedImage> loadTilesetAsImage(Project p, int id) {

    ArrayList<BufferedImage> b = new ArrayList<BufferedImage>();

    // load tileset
    RubyObject ts = RGSS1Helper.get(p, Type.TILESET).get(id).getObject();

    // load images

    // has tileset?
    String tilename = ts.getInstanceVariable("@tileset_name").asJavaString();
    if (tilename == null || tilename.length() == 0) {
      return b;
    }

    // add normal tileset
View Full Code Here

    final Object[] objects = ((RubyArray) loadFile(project, new File(RGSS1Load.getDataFile(project), name + ".rxdata"))).toArray();

    // convert code
    ArrayList<RubyObject> elements = new ArrayList<RubyObject>();
    for (Object o : objects) {
      final RubyObject r = (RubyObject) o;
      elements.add(r);
    }
    return elements;
  }
View Full Code Here

   */
  public static void saveMapData(Project project, RubyObject map) {
    // create filename
    File file = getMapFile(project, (Integer) map.getInstanceVariable("@id").toJava(Integer.class));
    // modi map
    RubyObject sMap = (RubyObject) map.rbClone();
    // remove attributs
    sMap.removeInstanceVariable("@name");
    sMap.removeInstanceVariable("@id");
    // save
    saveFile(project, file, sMap);
  }
View Full Code Here

      events = new HashMap<String, RubyObject>();
      RubyHash events = (RubyHash) map.getInstanceVariable("@events");

      for (Object id : events.keySet()) {
        // load event
        RubyObject event = (RubyObject) events.get(id);
        this.events
            .put(event.getInstanceVariable("@x").toJava(Integer.class) + "x"
                + event.getInstanceVariable("@y").toJava(Integer.class), event);
      }

      // build main gui
      left = new JPanel(new GridLayout(1, 1));
      main = new JPanel(new BorderLayout());
View Full Code Here

      }
    }

    // has event?
    if (events.containsKey(key)) {
      final RubyObject event = events.get(key);

      // add elements
      form.addElement("basic.name", RubyForm.getString(I18N.t("Name"), "@name", event));
      form.addElement("basic.id", new FormInfo("ID", event.getInstanceVariable("@id")));
      form.addElement("caction.edit", new FormButton(I18N.t("Editieren"), "edit", new AE() {

        @Override
        public void run() {
          YaFrame.open(EventTab.getId(project, mapID, RubyHelper.toInt(event.getInstanceVariable("@id"))));

        }
      }));
      form.addElement("caction.zdel", new FormButton(I18N.t("Löschen"), "trash", new AE() {
View Full Code Here

      if (!found) {
        break;
      }
    }

    RubyObject r = (RubyObject) RGSSProjectHelper.getInterpreter(project).runScriptlet(
        "r = RPG::Event.new(" + x + "," + y + "); r.id=" + id + ";" + "return r;");

    // create new class
    events.put(key, r);
View Full Code Here

TOP

Related Classes of org.jruby.RubyObject$VariableTableEntry

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.