def FromXML(cls, doc, element): """Construct using an ElementTree-style element.""" type = element.get("type", "relative") x = None y = None for subelem in element: tag = realtag(subelem) if tag == "x": x = NumberDef(subelem.text) elif tag == "y": y = NumberDef(subelem.text) return cls(type, x, y)
def __setstate__(self, state): state = dict(state) fire = state["fire"] params = [NumberDef(param) for param in state.get("params", [])] self.__init__(fire, ParamList(params))
def FromXML(cls, doc, element, default="absolute"): """Construct using an ElementTree-style element.""" return cls(element.get("type", default), NumberDef(element.text))
def __setstate__(self, state): state = dict(state) self.__init__(state["type"], NumberDef(state["value"]))
def __setstate__(self, state): state = dict(state) x = NumberDef(state["x"]) if "x" in state else None y = NumberDef(state["y"]) if "y" in state else None self.__init__(state["type"], x, y)
def __setstate__(self, state): state = dict(state) action = state["action"] params = [NumberDef(param) for param in state.get("params", [])] self.__init__(action, ParamList(params))
def __setstate__(self, state): state = dict(state) bullet = state["bullet"] params = [NumberDef(param) for param in state.get("params", [])] self.__init__(bullet, ParamList(params))
def FromXML(cls, doc, element): """Construct using an ElementTree-style element.""" return cls([ NumberDef(subelem.text) for subelem in element if realtag(subelem) == "param" ])
def __setstate__(self, state): state = dict(state) self.__init__(INumberDef(state["frames"]), Speed(state["type"], NumberDef(state["value"])))