Java 类org.newdawn.slick.particles.ConfigurableEmitter.RandomValue 实例源码

项目:trashjam2017    文件:ControlPanel.java   
/**
 * @see org.newdawn.slick.tools.peditor.InputPanelListener#valueUpdated(org.newdawn.slick.tools.peditor.ValuePanel)
 */
public void valueUpdated(ValuePanel source) {
    if (emitter == null) {
        return;
    }

    Value value = (Value) controlToData.get(source);
    if (value != null) {
        if( value instanceof SimpleValue)
            ((SimpleValue)value).setValue( source.getValue());
        else if( value instanceof RandomValue )
            ((RandomValue)value).setValue( source.getValue());
    } else {
        throw new RuntimeException("No data set specified for the GUI source");
    }
}
项目:Progetto-C    文件:ControlPanel.java   
/**
 * @see org.newdawn.slick.tools.peditor.InputPanelListener#valueUpdated(org.newdawn.slick.tools.peditor.ValuePanel)
 */
public void valueUpdated(ValuePanel source) {
    if (emitter == null) {
        return;
    }

    Value value = (Value) controlToData.get(source);
    if (value != null) {
        if( value instanceof SimpleValue)
            ((SimpleValue)value).setValue( source.getValue());
        else if( value instanceof RandomValue )
            ((RandomValue)value).setValue( source.getValue());
    } else {
        throw new RuntimeException("No data set specified for the GUI source");
    }
}
项目:Disparity-RHE    文件:ControlPanel.java   
/**
 * @see org.newdawn.slick.tools.peditor.InputPanelListener#valueUpdated(org.newdawn.slick.tools.peditor.ValuePanel)
 */
public void valueUpdated(ValuePanel source) {
    if (emitter == null) {
        return;
    }

    Value value = (Value) controlToData.get(source);
    if (value != null) {
        if( value instanceof SimpleValue)
            ((SimpleValue)value).setValue( source.getValue());
        else if( value instanceof RandomValue )
            ((RandomValue)value).setValue( source.getValue());
    } else {
        throw new RuntimeException("No data set specified for the GUI source");
    }
}
项目:slick2d-maven    文件:ControlPanel.java   
/**
 * @see org.newdawn.slick.tools.peditor.InputPanelListener#valueUpdated(org.newdawn.slick.tools.peditor.ValuePanel)
 */
public void valueUpdated(ValuePanel source) {
    if (emitter == null) {
        return;
    }

    Value value = (Value) controlToData.get(source);
    if (value != null) {
        if( value instanceof SimpleValue)
            ((SimpleValue)value).setValue( source.getValue());
        else if( value instanceof RandomValue )
            ((RandomValue)value).setValue( source.getValue());
    } else {
        throw new RuntimeException("No data set specified for the GUI source");
    }
}
项目:trashjam2017    文件:ParticleIO.java   
/**
 * Create an XML element based on a configured value
 * 
 * @param document
 *            The document the element will be part of
 * @param name
 *            The name to give the new element
 * @param value
 *            The configured value
 * @return A configure XML element based on the value
 */
private static Element createValueElement(Document document, String name,
        ConfigurableEmitter.Value value) {
    Element element = document.createElement(name);

    // void: now writes the value type
    if (value instanceof SimpleValue) {
        element.setAttribute("type", "simple");
        element.setAttribute("value", "" + value.getValue(0));
    } else if (value instanceof RandomValue) {
        element.setAttribute("type", "random");
        element
                .setAttribute("value", ""
                        + ((RandomValue) value).getValue());
    } else if (value instanceof LinearInterpolator) {
        element.setAttribute("type", "linear");
        element.setAttribute("min", ""
                + ((LinearInterpolator) value).getMin());
        element.setAttribute("max", ""
                + ((LinearInterpolator) value).getMax());
        element.setAttribute("active", ""
                + ((LinearInterpolator) value).isActive());

        ArrayList curve = ((LinearInterpolator) value).getCurve();
        for (int i = 0; i < curve.size(); i++) {
            Vector2f point = (Vector2f) curve.get(i);

            Element pointElement = document.createElement("point");
            pointElement.setAttribute("x", "" + point.x);
            pointElement.setAttribute("y", "" + point.y);

            element.appendChild(pointElement);
        }
    } else {
        Log.warn("unkown value type ignored: " + value.getClass());
    }

    return element;
}
项目:trashjam2017    文件:ControlPanel.java   
/**
 * Link a emitter configurable value to a value panel
 * 
 * @param value The configurable value from the emitter
 * @param panel The component to link against
 */
private void link(Value value, ValuePanel panel) {
    controlToData.put(panel, value);

    if( value instanceof SimpleValue )
        panel.setValue((int) ((SimpleValue)value).getValue( 0 ));
    else if( value instanceof RandomValue )
        panel.setValue((int) ((RandomValue)value).getValue());
}
项目:Progetto-C    文件:ParticleIO.java   
/**
 * Create an XML element based on a configured value
 * 
 * @param document
 *            The document the element will be part of
 * @param name
 *            The name to give the new element
 * @param value
 *            The configured value
 * @return A configure XML element based on the value
 */
private static Element createValueElement(Document document, String name,
        ConfigurableEmitter.Value value) {
    Element element = document.createElement(name);

    // void: now writes the value type
    if (value instanceof SimpleValue) {
        element.setAttribute("type", "simple");
        element.setAttribute("value", "" + value.getValue(0));
    } else if (value instanceof RandomValue) {
        element.setAttribute("type", "random");
        element
                .setAttribute("value", ""
                        + ((RandomValue) value).getValue());
    } else if (value instanceof LinearInterpolator) {
        element.setAttribute("type", "linear");
        element.setAttribute("min", ""
                + ((LinearInterpolator) value).getMin());
        element.setAttribute("max", ""
                + ((LinearInterpolator) value).getMax());
        element.setAttribute("active", ""
                + ((LinearInterpolator) value).isActive());

        ArrayList curve = ((LinearInterpolator) value).getCurve();
        for (int i = 0; i < curve.size(); i++) {
            Vector2f point = (Vector2f) curve.get(i);

            Element pointElement = document.createElement("point");
            pointElement.setAttribute("x", "" + point.x);
            pointElement.setAttribute("y", "" + point.y);

            element.appendChild(pointElement);
        }
    } else {
        Log.warn("unkown value type ignored: " + value.getClass());
    }

    return element;
}
项目:Progetto-C    文件:ControlPanel.java   
/**
 * Link a emitter configurable value to a value panel
 * 
 * @param value The configurable value from the emitter
 * @param panel The component to link against
 */
private void link(Value value, ValuePanel panel) {
    controlToData.put(panel, value);

    if( value instanceof SimpleValue )
        panel.setValue((int) ((SimpleValue)value).getValue( 0 ));
    else if( value instanceof RandomValue )
        panel.setValue((int) ((RandomValue)value).getValue());
}
项目:BaseClient    文件:ParticleIO.java   
/**
 * Create an XML element based on a configured value
 * 
 * @param document
 *            The document the element will be part of
 * @param name
 *            The name to give the new element
 * @param value
 *            The configured value
 * @return A configure XML element based on the value
 */
private static Element createValueElement(Document document, String name,
        ConfigurableEmitter.Value value) {
    Element element = document.createElement(name);

    // void: now writes the value type
    if (value instanceof SimpleValue) {
        element.setAttribute("type", "simple");
        element.setAttribute("value", "" + value.getValue(0));
    } else if (value instanceof RandomValue) {
        element.setAttribute("type", "random");
        element
                .setAttribute("value", ""
                        + ((RandomValue) value).getValue());
    } else if (value instanceof LinearInterpolator) {
        element.setAttribute("type", "linear");
        element.setAttribute("min", ""
                + ((LinearInterpolator) value).getMin());
        element.setAttribute("max", ""
                + ((LinearInterpolator) value).getMax());
        element.setAttribute("active", ""
                + ((LinearInterpolator) value).isActive());

        ArrayList curve = ((LinearInterpolator) value).getCurve();
        for (int i = 0; i < curve.size(); i++) {
            Vector2f point = (Vector2f) curve.get(i);

            Element pointElement = document.createElement("point");
            pointElement.setAttribute("x", "" + point.x);
            pointElement.setAttribute("y", "" + point.y);

            element.appendChild(pointElement);
        }
    } else {
        Log.warn("unkown value type ignored: " + value.getClass());
    }

    return element;
}
项目:GPVM    文件:ParticleIO.java   
/**
 * Create an XML element based on a configured value
 * 
 * @param document
 *            The document the element will be part of
 * @param name
 *            The name to give the new element
 * @param value
 *            The configured value
 * @return A configure XML element based on the value
 */
private static Element createValueElement(Document document, String name,
        ConfigurableEmitter.Value value) {
    Element element = document.createElement(name);

    // void: now writes the value type
    if (value instanceof SimpleValue) {
        element.setAttribute("type", "simple");
        element.setAttribute("value", "" + value.getValue(0));
    } else if (value instanceof RandomValue) {
        element.setAttribute("type", "random");
        element
                .setAttribute("value", ""
                        + ((RandomValue) value).getValue());
    } else if (value instanceof LinearInterpolator) {
        element.setAttribute("type", "linear");
        element.setAttribute("min", ""
                + ((LinearInterpolator) value).getMin());
        element.setAttribute("max", ""
                + ((LinearInterpolator) value).getMax());
        element.setAttribute("active", ""
                + ((LinearInterpolator) value).isActive());

        ArrayList curve = ((LinearInterpolator) value).getCurve();
        for (int i = 0; i < curve.size(); i++) {
            Vector2f point = (Vector2f) curve.get(i);

            Element pointElement = document.createElement("point");
            pointElement.setAttribute("x", "" + point.x);
            pointElement.setAttribute("y", "" + point.y);

            element.appendChild(pointElement);
        }
    } else {
        Log.warn("unkown value type ignored: " + value.getClass());
    }

    return element;
}
项目:GPVM    文件:ParticleIO.java   
/**
 * Create an XML element based on a configured value
 * 
 * @param document
 *            The document the element will be part of
 * @param name
 *            The name to give the new element
 * @param value
 *            The configured value
 * @return A configure XML element based on the value
 */
private static Element createValueElement(Document document, String name,
        ConfigurableEmitter.Value value) {
    Element element = document.createElement(name);

    // void: now writes the value type
    if (value instanceof SimpleValue) {
        element.setAttribute("type", "simple");
        element.setAttribute("value", "" + value.getValue(0));
    } else if (value instanceof RandomValue) {
        element.setAttribute("type", "random");
        element
                .setAttribute("value", ""
                        + ((RandomValue) value).getValue());
    } else if (value instanceof LinearInterpolator) {
        element.setAttribute("type", "linear");
        element.setAttribute("min", ""
                + ((LinearInterpolator) value).getMin());
        element.setAttribute("max", ""
                + ((LinearInterpolator) value).getMax());
        element.setAttribute("active", ""
                + ((LinearInterpolator) value).isActive());

        ArrayList curve = ((LinearInterpolator) value).getCurve();
        for (int i = 0; i < curve.size(); i++) {
            Vector2f point = (Vector2f) curve.get(i);

            Element pointElement = document.createElement("point");
            pointElement.setAttribute("x", "" + point.x);
            pointElement.setAttribute("y", "" + point.y);

            element.appendChild(pointElement);
        }
    } else {
        Log.warn("unkown value type ignored: " + value.getClass());
    }

    return element;
}
项目:SpaceStationAlpha    文件:ParticleIO.java   
/**
 * Create an XML element based on a configured value
 * 
 * @param document
 *            The document the element will be part of
 * @param name
 *            The name to give the new element
 * @param value
 *            The configured value
 * @return A configure XML element based on the value
 */
private static Element createValueElement(Document document, String name,
        ConfigurableEmitter.Value value) {
    Element element = document.createElement(name);

    // void: now writes the value type
    if (value instanceof SimpleValue) {
        element.setAttribute("type", "simple");
        element.setAttribute("value", "" + value.getValue(0));
    } else if (value instanceof RandomValue) {
        element.setAttribute("type", "random");
        element
                .setAttribute("value", ""
                        + ((RandomValue) value).getValue());
    } else if (value instanceof LinearInterpolator) {
        element.setAttribute("type", "linear");
        element.setAttribute("min", ""
                + ((LinearInterpolator) value).getMin());
        element.setAttribute("max", ""
                + ((LinearInterpolator) value).getMax());
        element.setAttribute("active", ""
                + ((LinearInterpolator) value).isActive());

        ArrayList curve = ((LinearInterpolator) value).getCurve();
        for (int i = 0; i < curve.size(); i++) {
            Vector2f point = (Vector2f) curve.get(i);

            Element pointElement = document.createElement("point");
            pointElement.setAttribute("x", "" + point.x);
            pointElement.setAttribute("y", "" + point.y);

            element.appendChild(pointElement);
        }
    } else {
        Log.warn("unkown value type ignored: " + value.getClass());
    }

    return element;
}
项目:Disparity-RHE    文件:ControlPanel.java   
/**
 * Link a emitter configurable value to a value panel
 * 
 * @param value The configurable value from the emitter
 * @param panel The component to link against
 */
private void link(Value value, ValuePanel panel) {
    controlToData.put(panel, value);

    if( value instanceof SimpleValue )
        panel.setValue((int) ((SimpleValue)value).getValue( 0 ));
    else if( value instanceof RandomValue )
        panel.setValue((int) ((RandomValue)value).getValue());
}
项目:cretion    文件:ParticleIO.java   
/**
 * Create an XML element based on a configured value
 * 
 * @param document
 *            The document the element will be part of
 * @param name
 *            The name to give the new element
 * @param value
 *            The configured value
 * @return A configure XML element based on the value
 */
private static Element createValueElement(Document document, String name,
        ConfigurableEmitter.Value value) {
    Element element = document.createElement(name);

    // void: now writes the value type
    if (value instanceof SimpleValue) {
        element.setAttribute("type", "simple");
        element.setAttribute("value", "" + value.getValue(0));
    } else if (value instanceof RandomValue) {
        element.setAttribute("type", "random");
        element
                .setAttribute("value", ""
                        + ((RandomValue) value).getValue());
    } else if (value instanceof LinearInterpolator) {
        element.setAttribute("type", "linear");
        element.setAttribute("min", ""
                + ((LinearInterpolator) value).getMin());
        element.setAttribute("max", ""
                + ((LinearInterpolator) value).getMax());
        element.setAttribute("active", ""
                + ((LinearInterpolator) value).isActive());

        ArrayList curve = ((LinearInterpolator) value).getCurve();
        for (int i = 0; i < curve.size(); i++) {
            Vector2f point = (Vector2f) curve.get(i);

            Element pointElement = document.createElement("point");
            pointElement.setAttribute("x", "" + point.x);
            pointElement.setAttribute("y", "" + point.y);

            element.appendChild(pointElement);
        }
    } else {
        Log.warn("unkown value type ignored: " + value.getClass());
    }

    return element;
}
项目:slick2d-maven    文件:ParticleIO.java   
/**
 * Create an XML element based on a configured value
 * 
 * @param document
 *            The document the element will be part of
 * @param name
 *            The name to give the new element
 * @param value
 *            The configured value
 * @return A configure XML element based on the value
 */
private static Element createValueElement(Document document, String name,
        ConfigurableEmitter.Value value) {
    Element element = document.createElement(name);

    // void: now writes the value type
    if (value instanceof SimpleValue) {
        element.setAttribute("type", "simple");
        element.setAttribute("value", "" + value.getValue(0));
    } else if (value instanceof RandomValue) {
        element.setAttribute("type", "random");
        element
                .setAttribute("value", ""
                        + ((RandomValue) value).getValue());
    } else if (value instanceof LinearInterpolator) {
        element.setAttribute("type", "linear");
        element.setAttribute("min", ""
                + ((LinearInterpolator) value).getMin());
        element.setAttribute("max", ""
                + ((LinearInterpolator) value).getMax());
        element.setAttribute("active", ""
                + ((LinearInterpolator) value).isActive());

        ArrayList curve = ((LinearInterpolator) value).getCurve();
        for (int i = 0; i < curve.size(); i++) {
            Vector2f point = (Vector2f) curve.get(i);

            Element pointElement = document.createElement("point");
            pointElement.setAttribute("x", "" + point.x);
            pointElement.setAttribute("y", "" + point.y);

            element.appendChild(pointElement);
        }
    } else {
        Log.warn("unkown value type ignored: " + value.getClass());
    }

    return element;
}
项目:slick2d-maven    文件:ControlPanel.java   
/**
 * Link a emitter configurable value to a value panel
 * 
 * @param value The configurable value from the emitter
 * @param panel The component to link against
 */
private void link(Value value, ValuePanel panel) {
    controlToData.put(panel, value);

    if( value instanceof SimpleValue )
        panel.setValue((int) ((SimpleValue)value).getValue( 0 ));
    else if( value instanceof RandomValue )
        panel.setValue((int) ((RandomValue)value).getValue());
}
项目:trashjam2017    文件:ParticleIO.java   
/**
 * Parse an XML element into a configured value
 * 
 * @param element
 *            The XML element to parse
 * @param value
 *            The value to configure based on the XML
 */
private static void parseValueElement(Element element,
        ConfigurableEmitter.Value value) {
    if (element == null) {
        return;
    }

    String type = element.getAttribute("type");
    String v = element.getAttribute("value");

    if (type == null || type.length() == 0) {
        // support for old style which did not write the type
        if (value instanceof SimpleValue) {
            ((SimpleValue) value).setValue(Float.parseFloat(v));
        } else if (value instanceof RandomValue) {
            ((RandomValue) value).setValue(Float.parseFloat(v));
        } else {
            Log.warn("problems reading element, skipping: " + element);
        }
    } else {
        // type given: this is the new style
        if (type.equals("simple")) {
            ((SimpleValue) value).setValue(Float.parseFloat(v));
        } else if (type.equals("random")) {
            ((RandomValue) value).setValue(Float.parseFloat(v));
        } else if (type.equals("linear")) {
            String min = element.getAttribute("min");
            String max = element.getAttribute("max");
            String active = element.getAttribute("active");

            NodeList points = element.getElementsByTagName("point");

            ArrayList curve = new ArrayList();
            for (int i = 0; i < points.getLength(); i++) {
                Element point = (Element) points.item(i);

                float x = Float.parseFloat(point.getAttribute("x"));
                float y = Float.parseFloat(point.getAttribute("y"));

                curve.add(new Vector2f(x, y));
            }

            ((LinearInterpolator) value).setCurve(curve);
            ((LinearInterpolator) value).setMin(Integer.parseInt(min));
            ((LinearInterpolator) value).setMax(Integer.parseInt(max));
            ((LinearInterpolator) value).setActive("true".equals(active));
        } else {
            Log.warn("unkown type detected: " + type);
        }
    }
}
项目:Progetto-C    文件:ParticleIO.java   
/**
 * Parse an XML element into a configured value
 * 
 * @param element
 *            The XML element to parse
 * @param value
 *            The value to configure based on the XML
 */
private static void parseValueElement(Element element,
        ConfigurableEmitter.Value value) {
    if (element == null) {
        return;
    }

    String type = element.getAttribute("type");
    String v = element.getAttribute("value");

    if (type == null || type.length() == 0) {
        // support for old style which did not write the type
        if (value instanceof SimpleValue) {
            ((SimpleValue) value).setValue(Float.parseFloat(v));
        } else if (value instanceof RandomValue) {
            ((RandomValue) value).setValue(Float.parseFloat(v));
        } else {
            Log.warn("problems reading element, skipping: " + element);
        }
    } else {
        // type given: this is the new style
        if (type.equals("simple")) {
            ((SimpleValue) value).setValue(Float.parseFloat(v));
        } else if (type.equals("random")) {
            ((RandomValue) value).setValue(Float.parseFloat(v));
        } else if (type.equals("linear")) {
            String min = element.getAttribute("min");
            String max = element.getAttribute("max");
            String active = element.getAttribute("active");

            NodeList points = element.getElementsByTagName("point");

            ArrayList curve = new ArrayList();
            for (int i = 0; i < points.getLength(); i++) {
                Element point = (Element) points.item(i);

                float x = Float.parseFloat(point.getAttribute("x"));
                float y = Float.parseFloat(point.getAttribute("y"));

                curve.add(new Vector2f(x, y));
            }

            ((LinearInterpolator) value).setCurve(curve);
            ((LinearInterpolator) value).setMin(Integer.parseInt(min));
            ((LinearInterpolator) value).setMax(Integer.parseInt(max));
            ((LinearInterpolator) value).setActive("true".equals(active));
        } else {
            Log.warn("unkown type detected: " + type);
        }
    }
}
项目:BaseClient    文件:ParticleIO.java   
/**
 * Parse an XML element into a configured value
 * 
 * @param element
 *            The XML element to parse
 * @param value
 *            The value to configure based on the XML
 */
private static void parseValueElement(Element element,
        ConfigurableEmitter.Value value) {
    if (element == null) {
        return;
    }

    String type = element.getAttribute("type");
    String v = element.getAttribute("value");

    if (type == null || type.length() == 0) {
        // support for old style which did not write the type
        if (value instanceof SimpleValue) {
            ((SimpleValue) value).setValue(Float.parseFloat(v));
        } else if (value instanceof RandomValue) {
            ((RandomValue) value).setValue(Float.parseFloat(v));
        } else {
            Log.warn("problems reading element, skipping: " + element);
        }
    } else {
        // type given: this is the new style
        if (type.equals("simple")) {
            ((SimpleValue) value).setValue(Float.parseFloat(v));
        } else if (type.equals("random")) {
            ((RandomValue) value).setValue(Float.parseFloat(v));
        } else if (type.equals("linear")) {
            String min = element.getAttribute("min");
            String max = element.getAttribute("max");
            String active = element.getAttribute("active");

            NodeList points = element.getElementsByTagName("point");

            ArrayList curve = new ArrayList();
            for (int i = 0; i < points.getLength(); i++) {
                Element point = (Element) points.item(i);

                float x = Float.parseFloat(point.getAttribute("x"));
                float y = Float.parseFloat(point.getAttribute("y"));

                curve.add(new Vector2f(x, y));
            }

            ((LinearInterpolator) value).setCurve(curve);
            ((LinearInterpolator) value).setMin(Integer.parseInt(min));
            ((LinearInterpolator) value).setMax(Integer.parseInt(max));
            ((LinearInterpolator) value).setActive("true".equals(active));
        } else {
            Log.warn("unkown type detected: " + type);
        }
    }
}
项目:GPVM    文件:ParticleIO.java   
/**
 * Parse an XML element into a configured value
 * 
 * @param element
 *            The XML element to parse
 * @param value
 *            The value to configure based on the XML
 */
private static void parseValueElement(Element element,
        ConfigurableEmitter.Value value) {
    if (element == null) {
        return;
    }

    String type = element.getAttribute("type");
    String v = element.getAttribute("value");

    if (type == null || type.length() == 0) {
        // support for old style which did not write the type
        if (value instanceof SimpleValue) {
            ((SimpleValue) value).setValue(Float.parseFloat(v));
        } else if (value instanceof RandomValue) {
            ((RandomValue) value).setValue(Float.parseFloat(v));
        } else {
            Log.warn("problems reading element, skipping: " + element);
        }
    } else {
        // type given: this is the new style
        if (type.equals("simple")) {
            ((SimpleValue) value).setValue(Float.parseFloat(v));
        } else if (type.equals("random")) {
            ((RandomValue) value).setValue(Float.parseFloat(v));
        } else if (type.equals("linear")) {
            String min = element.getAttribute("min");
            String max = element.getAttribute("max");
            String active = element.getAttribute("active");

            NodeList points = element.getElementsByTagName("point");

            ArrayList curve = new ArrayList();
            for (int i = 0; i < points.getLength(); i++) {
                Element point = (Element) points.item(i);

                float x = Float.parseFloat(point.getAttribute("x"));
                float y = Float.parseFloat(point.getAttribute("y"));

                curve.add(new Vector2f(x, y));
            }

            ((LinearInterpolator) value).setCurve(curve);
            ((LinearInterpolator) value).setMin(Integer.parseInt(min));
            ((LinearInterpolator) value).setMax(Integer.parseInt(max));
            ((LinearInterpolator) value).setActive("true".equals(active));
        } else {
            Log.warn("unkown type detected: " + type);
        }
    }
}
项目:GPVM    文件:ParticleIO.java   
/**
 * Parse an XML element into a configured value
 * 
 * @param element
 *            The XML element to parse
 * @param value
 *            The value to configure based on the XML
 */
private static void parseValueElement(Element element,
        ConfigurableEmitter.Value value) {
    if (element == null) {
        return;
    }

    String type = element.getAttribute("type");
    String v = element.getAttribute("value");

    if (type == null || type.length() == 0) {
        // support for old style which did not write the type
        if (value instanceof SimpleValue) {
            ((SimpleValue) value).setValue(Float.parseFloat(v));
        } else if (value instanceof RandomValue) {
            ((RandomValue) value).setValue(Float.parseFloat(v));
        } else {
            Log.warn("problems reading element, skipping: " + element);
        }
    } else {
        // type given: this is the new style
        if (type.equals("simple")) {
            ((SimpleValue) value).setValue(Float.parseFloat(v));
        } else if (type.equals("random")) {
            ((RandomValue) value).setValue(Float.parseFloat(v));
        } else if (type.equals("linear")) {
            String min = element.getAttribute("min");
            String max = element.getAttribute("max");
            String active = element.getAttribute("active");

            NodeList points = element.getElementsByTagName("point");

            ArrayList curve = new ArrayList();
            for (int i = 0; i < points.getLength(); i++) {
                Element point = (Element) points.item(i);

                float x = Float.parseFloat(point.getAttribute("x"));
                float y = Float.parseFloat(point.getAttribute("y"));

                curve.add(new Vector2f(x, y));
            }

            ((LinearInterpolator) value).setCurve(curve);
            ((LinearInterpolator) value).setMin(Integer.parseInt(min));
            ((LinearInterpolator) value).setMax(Integer.parseInt(max));
            ((LinearInterpolator) value).setActive("true".equals(active));
        } else {
            Log.warn("unkown type detected: " + type);
        }
    }
}
项目:SpaceStationAlpha    文件:ParticleIO.java   
/**
 * Parse an XML element into a configured value
 * 
 * @param element
 *            The XML element to parse
 * @param value
 *            The value to configure based on the XML
 */
private static void parseValueElement(Element element,
        ConfigurableEmitter.Value value) {
    if (element == null) {
        return;
    }

    String type = element.getAttribute("type");
    String v = element.getAttribute("value");

    if (type == null || type.length() == 0) {
        // support for old style which did not write the type
        if (value instanceof SimpleValue) {
            ((SimpleValue) value).setValue(Float.parseFloat(v));
        } else if (value instanceof RandomValue) {
            ((RandomValue) value).setValue(Float.parseFloat(v));
        } else {
            Log.warn("problems reading element, skipping: " + element);
        }
    } else {
        // type given: this is the new style
        if (type.equals("simple")) {
            ((SimpleValue) value).setValue(Float.parseFloat(v));
        } else if (type.equals("random")) {
            ((RandomValue) value).setValue(Float.parseFloat(v));
        } else if (type.equals("linear")) {
            String min = element.getAttribute("min");
            String max = element.getAttribute("max");
            String active = element.getAttribute("active");

            NodeList points = element.getElementsByTagName("point");

            ArrayList curve = new ArrayList();
            for (int i = 0; i < points.getLength(); i++) {
                Element point = (Element) points.item(i);

                float x = Float.parseFloat(point.getAttribute("x"));
                float y = Float.parseFloat(point.getAttribute("y"));

                curve.add(new Vector2f(x, y));
            }

            ((LinearInterpolator) value).setCurve(curve);
            ((LinearInterpolator) value).setMin(Integer.parseInt(min));
            ((LinearInterpolator) value).setMax(Integer.parseInt(max));
            ((LinearInterpolator) value).setActive("true".equals(active));
        } else {
            Log.warn("unkown type detected: " + type);
        }
    }
}
项目:cretion    文件:ParticleIO.java   
/**
 * Parse an XML element into a configured value
 * 
 * @param element
 *            The XML element to parse
 * @param value
 *            The value to configure based on the XML
 */
private static void parseValueElement(Element element,
        ConfigurableEmitter.Value value) {
    if (element == null) {
        return;
    }

    String type = element.getAttribute("type");
    String v = element.getAttribute("value");

    if (type == null || type.length() == 0) {
        // support for old style which did not write the type
        if (value instanceof SimpleValue) {
            ((SimpleValue) value).setValue(Float.parseFloat(v));
        } else if (value instanceof RandomValue) {
            ((RandomValue) value).setValue(Float.parseFloat(v));
        } else {
            Log.warn("problems reading element, skipping: " + element);
        }
    } else {
        // type given: this is the new style
        if (type.equals("simple")) {
            ((SimpleValue) value).setValue(Float.parseFloat(v));
        } else if (type.equals("random")) {
            ((RandomValue) value).setValue(Float.parseFloat(v));
        } else if (type.equals("linear")) {
            String min = element.getAttribute("min");
            String max = element.getAttribute("max");
            String active = element.getAttribute("active");

            NodeList points = element.getElementsByTagName("point");

            ArrayList curve = new ArrayList();
            for (int i = 0; i < points.getLength(); i++) {
                Element point = (Element) points.item(i);

                float x = Float.parseFloat(point.getAttribute("x"));
                float y = Float.parseFloat(point.getAttribute("y"));

                curve.add(new Vector2f(x, y));
            }

            ((LinearInterpolator) value).setCurve(curve);
            ((LinearInterpolator) value).setMin(Integer.parseInt(min));
            ((LinearInterpolator) value).setMax(Integer.parseInt(max));
            ((LinearInterpolator) value).setActive("true".equals(active));
        } else {
            Log.warn("unkown type detected: " + type);
        }
    }
}
项目:slick2d-maven    文件:ParticleIO.java   
/**
 * Parse an XML element into a configured value
 * 
 * @param element
 *            The XML element to parse
 * @param value
 *            The value to configure based on the XML
 */
private static void parseValueElement(Element element,
        ConfigurableEmitter.Value value) {
    if (element == null) {
        return;
    }

    String type = element.getAttribute("type");
    String v = element.getAttribute("value");

    if (type == null || type.length() == 0) {
        // support for old style which did not write the type
        if (value instanceof SimpleValue) {
            ((SimpleValue) value).setValue(Float.parseFloat(v));
        } else if (value instanceof RandomValue) {
            ((RandomValue) value).setValue(Float.parseFloat(v));
        } else {
            Log.warn("problems reading element, skipping: " + element);
        }
    } else {
        // type given: this is the new style
        if (type.equals("simple")) {
            ((SimpleValue) value).setValue(Float.parseFloat(v));
        } else if (type.equals("random")) {
            ((RandomValue) value).setValue(Float.parseFloat(v));
        } else if (type.equals("linear")) {
            String min = element.getAttribute("min");
            String max = element.getAttribute("max");
            String active = element.getAttribute("active");

            NodeList points = element.getElementsByTagName("point");

            ArrayList curve = new ArrayList();
            for (int i = 0; i < points.getLength(); i++) {
                Element point = (Element) points.item(i);

                float x = Float.parseFloat(point.getAttribute("x"));
                float y = Float.parseFloat(point.getAttribute("y"));

                curve.add(new Vector2f(x, y));
            }

            ((LinearInterpolator) value).setCurve(curve);
            ((LinearInterpolator) value).setMin(Integer.parseInt(min));
            ((LinearInterpolator) value).setMax(Integer.parseInt(max));
            ((LinearInterpolator) value).setActive("true".equals(active));
        } else {
            Log.warn("unkown type detected: " + type);
        }
    }
}