示例#1
0
    def __init__(self, parent, tile_width, use_svg, use_char):

        super(FloorItem, self).__init__(parent)
        ResetItem.__init__(self, tile_width)

        klass = self.svg_klass if use_svg else self.nonsvg_klass

        #turned off isosvg
        if (use_svg and self.use_iso):
            self.child = klass(parent, tile_width)
            #self.child = None

        # use_char for characters on the tiles
        elif not (use_svg and self.use_iso) and not use_char:
            self.child = None
        else:
            self.child = klass(self, tile_width)

        self._use_svg = use_svg
        self._transitions = {}
        self._adjacent_transitions = {}
        self._svg_transitions = {}

        points = [QtCore.QPointF(p[0]*self.tile_width, p[1]*self.tile_width) for p in self.points]
        poly = QtGui.QPolygonF(points)
        self.setPolygon(poly)
示例#2
0
    def __init__(self, parent, tile_width, use_svg, seethrough, debug, use_char):
        super(BackgroundWidget, self).__init__(parent, tile_width)
        ResetItem.__init__(self, tile_width)

        self.floor = self.floor_klass(self, tile_width, use_svg, use_char)
        self.spell = self.spell_klass(self, tile_width, use_svg)
        self.spell.setZValue(100)
示例#3
0
    def __init__(self, parent, points, other, out=False):
        #parent shall be the adjacent tile so we can set the transition ontop of it.
        
        super(TransitionItem, self).__init__(parent)
        ResetItem.__init__(self, None)

        self.setZValue(other['zval'])
        self._color = QtGui.QColor(other['background'])
        self._points = points
        self.setPoints(out)
示例#4
0
    def __init__(self, parent, tile_width, use_svg):
        super(CharFeatureItem, self).__init__(parent)
        ResetItem.__init__(self, tile_width)
        self._use_svg = use_svg

        if use_svg:
            self.item = SvgItem(self, tile_width)
        else:
            self.item = CharItem(self, tile_width)
        self.svg_item = None
示例#5
0
    def __init__(self, parent, tile_width, direction):
        super(ChibiDirectionWidget, self).__init__(parent)
        ResetItem.__init__(self, tile_width)
        self._direction = direction
        #self.animation = OpacityAnimation(self, force=True)

        self.items = {}
        side, flip = self.dirs[self._direction]
        for part in self.parts[side]:
            item = ChibiPartItem(self, tile_width, side, part)
            self.items[part] = item
示例#6
0
    def __init__(self, parent, tile_width, use_svg):
        super(InventoryWidget, self).__init__(parent, tile_width)
        ResetItem.__init__(self, tile_width)

        klass = self.svg_klass if use_svg else self.nonsvg_klass
        self.item = klass(self, tile_width)
        self.item._allow_fallback = True

        self.opaciter = OpacityAnimation(self)
        self._inventory = None
        self.__args = None
示例#7
0
    def __init__(self, parent, tile_width, use_svg):
        super(FeatureItem, self).__init__(parent)
        ResetItem.__init__(self, tile_width)
        self._use_svg = use_svg

        if use_svg:
            self.svg_item = SvgFeatureItem(self, tile_width)
            self.svg_item.setZValue(1)
            self.svg_item._flipped = False
        else:
            self.svg_item = None
示例#8
0
    def __init__(self, parent, tile_width):
        super(FloorDebugItem, self).__init__(parent)
        ResetItem.__init__(self, tile_width)

        self.setBrush(QtGui.QBrush(QtGui.QColor('red')))
        font = self.font()
        font.setFamily('monospace')
        font.setWeight(100)
        font.setPixelSize(tile_width * .2)
        self.setFont(font)
        self.setZValue(2)
        self.setOpacity(.5)
示例#9
0
    def __init__(self, parent, tile_width, direction):
        super(RayItem, self).__init__(parent)
        ResetItem.__init__(self, tile_width)

        path = QtGui.QPainterPath()
        w = tile_width
        d = self.wandDirection(direction)
        xo, yo = self.corners[d.opposite]
        path.moveTo(xo*w,  yo*w)
        xo, yo = self.corners[d.abr]
        path.lineTo(xo*w, yo*w)
        self.setPath(path)
示例#10
0
    def __init__(self, tile_width, use_svg, seethrough, debug, use_char):
        super(TileWidget, self).__init__()
        ResetItem.__init__(self, tile_width)

        self._seethrough = seethrough
        self._use_svg = use_svg
        self.being = None
        self.background = self.background_klass(self, tile_width, use_svg, seethrough, debug, use_char)
        self.inventory = InventoryWidget(self, tile_width, use_svg)
        self.features = {}
        for name, klass in self.feature_klasses.items():
            self.features[name] = klass(self, tile_width, use_svg)
            self.features[name].setZValue(2)

        self.debug = FloorDebugItem(self, tile_width) if debug else None
        self.debug and self.debug.setZValue(101)
示例#11
0
    def __init__(self, parent, tile_width, use_svg, is_player):
        super(BeingWidget, self).__init__(parent, tile_width)
        ResetItem.__init__(self, tile_width)

        if use_svg and is_player:
            klass = ChibiDirectionWidget
        elif use_svg:
            klass = SvgSpeciesItem
        else:
            klass = CharItem

        self._current = None
        self.items = {}
        for direction in Direction.viewable(use_svg):
            self.items[direction] = klass(self, tile_width, direction)
            #FIXME figure out some other place to do this
            if not use_svg:
                self.items[direction].setBold()

        self.animation = BeingAnimation(self)
示例#12
0
    def __init__(self, parent, tile_width):
        super(SvgItem, self).__init__(parent)
        ResetItem.__init__(self, tile_width)

        self._factor = None
        self._size = None
示例#13
0
 def __init__(self, parent, tile_width):
     super(SpellItem, self).__init__(parent)
     ResetItem.__init__(self, tile_width)
     self.setRect(self.getRect(tile_width))
     self.setPen(QtGui.QPen(QtCore.Qt.NoPen))
示例#14
0
 def __init__(self, parent, tile_width, use_svg):
     super(StairsItem, self).__init__(parent)
     ResetItem.__init__(self, tile_width)